Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

stripe: Fix the invoice item description for flat discounts.

Prakhar Pratyush976354dbda76
diff --git a/corporate/lib/stripe.py b/corporate/lib/stripe.py
index e554e49b1e3..5734b5e59cb 100644
--- a/corporate/lib/stripe.py
+++ b/corporate/lib/stripe.py
@@ -1421,7 +1421,7 @@ class BillingSession(ABC):
stripe.InvoiceItem.create(
currency="usd",
customer=customer.stripe_customer_id,
- description=f"${customer.flat_discount}/month new customer discount",
+ description=f"${cents_to_dollar_string(customer.flat_discount)}/month new customer discount",
# Negative value to apply discount.
amount=(-1 * discount),
)
diff --git a/corporate/tests/stripe_fixtures/invoice_initial_remote_realm_upgrade--Customer.create.1.json b/corporate/tests/stripe_fixtures/invoice_initial_remote_realm_upgrade--Customer.create.1.json
new file mode 100644
index 00000000000..c356e43b609
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_initial_remote_realm_upgrade--Customer.create.1.json
@@ -0,0 +1,33 @@
+{
+ "address": null,
+ "balance": 0,
+ "created": 1704972543,
+ "currency": null,
+ "default_currency": null,
+ "default_source": null,
+ "delinquent": false,
+ "description": "zulip.testserver cb199a84-eda",
+ "discount": null,
+ "email": "[email protected]",
+ "id": "cus_PM4aUmlJ9zzguj",
+ "invoice_prefix": "D31E4CAA",
+ "invoice_settings": {
+ "custom_fields": null,
+ "default_payment_method": null,
+ "footer": null,
+ "rendering_options": null
+ },
+ "livemode": false,
+ "metadata": {
+ "remote_realm_host": "zulip.testserver",
+ "remote_realm_uuid": "cb199a84-edad-4a44-9dca-70e5478fb9fb"
+ },
+ "name": null,
+ "next_invoice_sequence": 1,
+ "object": "customer",
+ "phone": null,
+ "preferred_locales": [],
+ "shipping": null,
+ "tax_exempt": "none",
+ "test_clock": null
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_initial_remote_realm_upgrade--Customer.modify.1.json b/corporate/tests/stripe_fixtures/invoice_initial_remote_realm_upgrade--Customer.modify.1.json
new file mode 100644
index 00000000000..e1471152821
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_initial_remote_realm_upgrade--Customer.modify.1.json
@@ -0,0 +1,33 @@
+{
+ "address": null,
+ "balance": 0,
+ "created": 1704972543,
+ "currency": null,
+ "default_currency": null,
+ "default_source": null,
+ "delinquent": false,
+ "description": "zulip.testserver cb199a84-eda",
+ "discount": null,
+ "email": "[email protected]",
+ "id": "cus_PM4aUmlJ9zzguj",
+ "invoice_prefix": "D31E4CAA",
+ "invoice_settings": {
+ "custom_fields": null,
+ "default_payment_method": "pm_1OXMRZDEQaroqDjsU307ZStO",
+ "footer": null,
+ "rendering_options": null
+ },
+ "livemode": false,
+ "metadata": {
+ "remote_realm_host": "zulip.testserver",
+ "remote_realm_uuid": "cb199a84-edad-4a44-9dca-70e5478fb9fb"
+ },
+ "name": null,
+ "next_invoice_sequence": 1,
+ "object": "customer",
+ "phone": null,
+ "preferred_locales": [],
+ "shipping": null,
+ "tax_exempt": "none",
+ "test_clock": null
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_initial_remote_realm_upgrade--Customer.retrieve.1.json b/corporate/tests/stripe_fixtures/invoice_initial_remote_realm_upgrade--Customer.retrieve.1.json
new file mode 100644
index 00000000000..2e2feec7c73
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_initial_remote_realm_upgrade--Customer.retrieve.1.json
@@ -0,0 +1,79 @@
+{
+ "address": null,
+ "balance": 0,
+ "created": 1704972543,
+ "currency": null,
+ "default_currency": null,
+ "default_source": null,
+ "delinquent": false,
+ "description": "zulip.testserver cb199a84-eda",
+ "discount": null,
+ "email": "[email protected]",
+ "id": "cus_PM4aUmlJ9zzguj",
+ "invoice_prefix": "D31E4CAA",
+ "invoice_settings": {
+ "custom_fields": null,
+ "default_payment_method": {
+ "billing_details": {
+ "address": {
+ "city": null,
+ "country": null,
+ "line1": null,
+ "line2": null,
+ "postal_code": null,
+ "state": null
+ },
+ "email": null,
+ "name": null,
+ "phone": null
+ },
+ "card": {
+ "brand": "visa",
+ "checks": {
+ "address_line1_check": null,
+ "address_postal_code_check": null,
+ "cvc_check": "pass"
+ },
+ "country": "US",
+ "exp_month": 1,
+ "exp_year": 2025,
+ "fingerprint": "9XKsMixKBi6kIIzd",
+ "funding": "credit",
+ "generated_from": null,
+ "last4": "4242",
+ "networks": {
+ "available": [
+ "visa"
+ ],
+ "preferred": null
+ },
+ "three_d_secure_usage": {
+ "supported": true
+ },
+ "wallet": null
+ },
+ "created": 1704972545,
+ "customer": "cus_PM4aUmlJ9zzguj",
+ "id": "pm_1OXMRZDEQaroqDjsU307ZStO",
+ "livemode": false,
+ "metadata": {},
+ "object": "payment_method",
+ "type": "card"
+ },
+ "footer": null,
+ "rendering_options": null
+ },
+ "livemode": false,
+ "metadata": {
+ "remote_realm_host": "zulip.testserver",
+ "remote_realm_uuid": "cb199a84-edad-4a44-9dca-70e5478fb9fb"
+ },
+ "name": null,
+ "next_invoice_sequence": 1,
+ "object": "customer",
+ "phone": null,
+ "preferred_locales": [],
+ "shipping": null,
+ "tax_exempt": "none",
+ "test_clock": null
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_initial_remote_realm_upgrade--Customer.retrieve.2.json b/corporate/tests/stripe_fixtures/invoice_initial_remote_realm_upgrade--Customer.retrieve.2.json
new file mode 100644
index 00000000000..2e2feec7c73
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_initial_remote_realm_upgrade--Customer.retrieve.2.json
@@ -0,0 +1,79 @@
+{
+ "address": null,
+ "balance": 0,
+ "created": 1704972543,
+ "currency": null,
+ "default_currency": null,
+ "default_source": null,
+ "delinquent": false,
+ "description": "zulip.testserver cb199a84-eda",
+ "discount": null,
+ "email": "[email protected]",
+ "id": "cus_PM4aUmlJ9zzguj",
+ "invoice_prefix": "D31E4CAA",
+ "invoice_settings": {
+ "custom_fields": null,
+ "default_payment_method": {
+ "billing_details": {
+ "address": {
+ "city": null,
+ "country": null,
+ "line1": null,
+ "line2": null,
+ "postal_code": null,
+ "state": null
+ },
+ "email": null,
+ "name": null,
+ "phone": null
+ },
+ "card": {
+ "brand": "visa",
+ "checks": {
+ "address_line1_check": null,
+ "address_postal_code_check": null,
+ "cvc_check": "pass"
+ },
+ "country": "US",
+ "exp_month": 1,
+ "exp_year": 2025,
+ "fingerprint": "9XKsMixKBi6kIIzd",
+ "funding": "credit",
+ "generated_from": null,
+ "last4": "4242",
+ "networks": {
+ "available": [
+ "visa"
+ ],
+ "preferred": null
+ },
+ "three_d_secure_usage": {
+ "supported": true
+ },
+ "wallet": null
+ },
+ "created": 1704972545,
+ "customer": "cus_PM4aUmlJ9zzguj",
+ "id": "pm_1OXMRZDEQaroqDjsU307ZStO",
+ "livemode": false,
+ "metadata": {},
+ "object": "payment_method",
+ "type": "card"
+ },
+ "footer": null,
+ "rendering_options": null
+ },
+ "livemode": false,
+ "metadata": {
+ "remote_realm_host": "zulip.testserver",
+ "remote_realm_uuid": "cb199a84-edad-4a44-9dca-70e5478fb9fb"
+ },
+ "name": null,
+ "next_invoice_sequence": 1,
+ "object": "customer",
+ "phone": null,
+ "preferred_locales": [],
+ "shipping": null,
+ "tax_exempt": "none",
+ "test_clock": null
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_initial_remote_realm_upgrade--Customer.retrieve.3.json b/corporate/tests/stripe_fixtures/invoice_initial_remote_realm_upgrade--Customer.retrieve.3.json
new file mode 100644
index 00000000000..2e2feec7c73
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_initial_remote_realm_upgrade--Customer.retrieve.3.json
@@ -0,0 +1,79 @@
+{
+ "address": null,
+ "balance": 0,
+ "created": 1704972543,
+ "currency": null,
+ "default_currency": null,
+ "default_source": null,
+ "delinquent": false,
+ "description": "zulip.testserver cb199a84-eda",
+ "discount": null,
+ "email": "[email protected]",
+ "id": "cus_PM4aUmlJ9zzguj",
+ "invoice_prefix": "D31E4CAA",
+ "invoice_settings": {
+ "custom_fields": null,
+ "default_payment_method": {
+ "billing_details": {
+ "address": {
+ "city": null,
+ "country": null,
+ "line1": null,
+ "line2": null,
+ "postal_code": null,
+ "state": null
+ },
+ "email": null,
+ "name": null,
+ "phone": null
+ },
+ "card": {
+ "brand": "visa",
+ "checks": {
+ "address_line1_check": null,
+ "address_postal_code_check": null,
+ "cvc_check": "pass"
+ },
+ "country": "US",
+ "exp_month": 1,
+ "exp_year": 2025,
+ "fingerprint": "9XKsMixKBi6kIIzd",
+ "funding": "credit",
+ "generated_from": null,
+ "last4": "4242",
+ "networks": {
+ "available": [
+ "visa"
+ ],
+ "preferred": null
+ },
+ "three_d_secure_usage": {
+ "supported": true
+ },
+ "wallet": null
+ },
+ "created": 1704972545,
+ "customer": "cus_PM4aUmlJ9zzguj",
+ "id": "pm_1OXMRZDEQaroqDjsU307ZStO",
+ "livemode": false,
+ "metadata": {},
+ "object": "payment_method",
+ "type": "card"
+ },
+ "footer": null,
+ "rendering_options": null
+ },
+ "livemode": false,
+ "metadata": {
+ "remote_realm_host": "zulip.testserver",
+ "remote_realm_uuid": "cb199a84-edad-4a44-9dca-70e5478fb9fb"
+ },
+ "name": null,
+ "next_invoice_sequence": 1,
+ "object": "customer",
+ "phone": null,
+ "preferred_locales": [],
+ "shipping": null,
+ "tax_exempt": "none",
+ "test_clock": null
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_initial_remote_realm_upgrade--Customer.retrieve.4.json b/corporate/tests/stripe_fixtures/invoice_initial_remote_realm_upgrade--Customer.retrieve.4.json
new file mode 100644
index 00000000000..2e2feec7c73
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_initial_remote_realm_upgrade--Customer.retrieve.4.json
@@ -0,0 +1,79 @@
+{
+ "address": null,
+ "balance": 0,
+ "created": 1704972543,
+ "currency": null,
+ "default_currency": null,
+ "default_source": null,
+ "delinquent": false,
+ "description": "zulip.testserver cb199a84-eda",
+ "discount": null,
+ "email": "[email protected]",
+ "id": "cus_PM4aUmlJ9zzguj",
+ "invoice_prefix": "D31E4CAA",
+ "invoice_settings": {
+ "custom_fields": null,
+ "default_payment_method": {
+ "billing_details": {
+ "address": {
+ "city": null,
+ "country": null,
+ "line1": null,
+ "line2": null,
+ "postal_code": null,
+ "state": null
+ },
+ "email": null,
+ "name": null,
+ "phone": null
+ },
+ "card": {
+ "brand": "visa",
+ "checks": {
+ "address_line1_check": null,
+ "address_postal_code_check": null,
+ "cvc_check": "pass"
+ },
+ "country": "US",
+ "exp_month": 1,
+ "exp_year": 2025,
+ "fingerprint": "9XKsMixKBi6kIIzd",
+ "funding": "credit",
+ "generated_from": null,
+ "last4": "4242",
+ "networks": {
+ "available": [
+ "visa"
+ ],
+ "preferred": null
+ },
+ "three_d_secure_usage": {
+ "supported": true
+ },
+ "wallet": null
+ },
+ "created": 1704972545,
+ "customer": "cus_PM4aUmlJ9zzguj",
+ "id": "pm_1OXMRZDEQaroqDjsU307ZStO",
+ "livemode": false,
+ "metadata": {},
+ "object": "payment_method",
+ "type": "card"
+ },
+ "footer": null,
+ "rendering_options": null
+ },
+ "livemode": false,
+ "metadata": {
+ "remote_realm_host": "zulip.testserver",
+ "remote_realm_uuid": "cb199a84-edad-4a44-9dca-70e5478fb9fb"
+ },
+ "name": null,
+ "next_invoice_sequence": 1,
+ "object": "customer",
+ "phone": null,
+ "preferred_locales": [],
+ "shipping": null,
+ "tax_exempt": "none",
+ "test_clock": null
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_initial_remote_realm_upgrade--Event.list.1.json b/corporate/tests/stripe_fixtures/invoice_initial_remote_realm_upgrade--Event.list.1.json
new file mode 100644
index 00000000000..bf846c330a1
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_initial_remote_realm_upgrade--Event.list.1.json
@@ -0,0 +1,60 @@
+{
+ "data": [
+ {
+ "api_version": "2020-08-27",
+ "created": 1704972547,
+ "data": {
+ "object": {
+ "address": null,
+ "balance": 0,
+ "created": 1704972543,
+ "currency": null,
+ "default_currency": null,
+ "default_source": null,
+ "delinquent": false,
+ "description": "zulip.testserver cb199a84-eda",
+ "discount": null,
+ "email": "[email protected]",
+ "id": "cus_PM4aUmlJ9zzguj",
+ "invoice_prefix": "D31E4CAA",
+ "invoice_settings": {
+ "custom_fields": null,
+ "default_payment_method": "pm_1OXMRZDEQaroqDjsU307ZStO",
+ "footer": null,
+ "rendering_options": null
+ },
+ "livemode": false,
+ "metadata": {
+ "remote_realm_host": "zulip.testserver",
+ "remote_realm_uuid": "cb199a84-edad-4a44-9dca-70e5478fb9fb"
+ },
+ "name": null,
+ "next_invoice_sequence": 1,
+ "object": "customer",
+ "phone": null,
+ "preferred_locales": [],
+ "shipping": null,
+ "tax_exempt": "none",
+ "test_clock": null
+ },
+ "previous_attributes": {
+ "invoice_settings": {
+ "default_payment_method": null
+ }
+ }
+ },
+ "id": "evt_1OXMRbDEQaroqDjstxezZjcY",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_YOGh5dwpxs9Sc4",
+ "idempotency_key": "3e32f23f-e568-4bb6-9ec6-d395f5725cde"
+ },
+ "type": "customer.updated"
+ }
+ ],
+ "has_more": true,
+ "object": "list",
+ "url": "/v1/events"
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_initial_remote_realm_upgrade--Event.list.2.json b/corporate/tests/stripe_fixtures/invoice_initial_remote_realm_upgrade--Event.list.2.json
new file mode 100644
index 00000000000..ecd3baa43d9
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_initial_remote_realm_upgrade--Event.list.2.json
@@ -0,0 +1,447 @@
+{
+ "data": [
+ {
+ "api_version": "2020-08-27",
+ "created": 1704972551,
+ "data": {
+ "object": {
+ "amount": 1850,
+ "amount_capturable": 0,
+ "amount_details": {
+ "tip": {}
+ },
+ "amount_received": 1850,
+ "application": null,
+ "application_fee_amount": null,
+ "automatic_payment_methods": null,
+ "canceled_at": null,
+ "cancellation_reason": null,
+ "capture_method": "automatic",
+ "charges": {
+ "data": [
+ {
+ "amount": 1850,
+ "amount_captured": 1850,
+ "amount_refunded": 0,
+ "application": null,
+ "application_fee": null,
+ "application_fee_amount": null,
+ "balance_transaction": "txn_3OXMReDEQaroqDjs0Yi5KcWP",
+ "billing_details": {
+ "address": {
+ "city": null,
+ "country": null,
+ "line1": null,
+ "line2": null,
+ "postal_code": null,
+ "state": null
+ },
+ "email": null,
+ "name": null,
+ "phone": null
+ },
+ "calculated_statement_descriptor": "ZULIP BASIC",
+ "captured": true,
+ "created": 1704972551,
+ "currency": "usd",
+ "customer": "cus_PM4aUmlJ9zzguj",
+ "description": "Upgrade to Zulip Basic, $3.5 x 11 - $20.0 x 1",
+ "destination": null,
+ "dispute": null,
+ "disputed": false,
+ "failure_balance_transaction": null,
+ "failure_code": null,
+ "failure_message": null,
+ "fraud_details": {},
+ "id": "ch_3OXMReDEQaroqDjs0kjhfAU2",
+ "invoice": null,
+ "livemode": false,
+ "metadata": {
+ "billing_modality": "charge_automatically",
+ "billing_schedule": "2",
+ "license_management": "automatic",
+ "licenses": "11",
+ "plan_tier": "103",
+ "price_per_license": "350",
+ "remote_realm_host": "zulip.testserver",
+ "remote_realm_user_email": "[email protected]",
+ "remote_realm_user_id": "1",
+ "seat_count": "11",
+ "type": "upgrade"
+ },
+ "object": "charge",
+ "on_behalf_of": null,
+ "order": null,
+ "outcome": {
+ "network_status": "approved_by_network",
+ "reason": null,
+ "risk_level": "normal",
+ "risk_score": 35,
+ "seller_message": "Payment complete.",
+ "type": "authorized"
+ },
+ "paid": true,
+ "payment_intent": "pi_3OXMReDEQaroqDjs0mD8q8KL",
+ "payment_method": "pm_1OXMRZDEQaroqDjsU307ZStO",
+ "payment_method_details": {
+ "card": {
+ "amount_authorized": 1850,
+ "brand": "visa",
+ "checks": {
+ "address_line1_check": null,
+ "address_postal_code_check": null,
+ "cvc_check": "pass"
+ },
+ "country": "US",
+ "exp_month": 1,
+ "exp_year": 2025,
+ "extended_authorization": {
+ "status": "disabled"
+ },
+ "fingerprint": "9XKsMixKBi6kIIzd",
+ "funding": "credit",
+ "incremental_authorization": {
+ "status": "unavailable"
+ },
+ "installments": null,
+ "last4": "4242",
+ "mandate": null,
+ "multicapture": {
+ "status": "unavailable"
+ },
+ "network": "visa",
+ "network_token": {
+ "used": false
+ },
+ "overcapture": {
+ "maximum_amount_capturable": 1850,
+ "status": "unavailable"
+ },
+ "three_d_secure": null,
+ "wallet": null
+ },
+ "type": "card"
+ },
+ "radar_options": {},
+ "receipt_email": "[email protected]",
+ "receipt_number": null,
+ "receipt_url": "https://pay.stripe.com/receipts/payment/CAcaFwoVYWNjdF8xN3ZUa3dERVFhcm9xRGpzKIei_6wGMgbN0jXeNO06LBbOy1nm9ORzjligjAyztBvbHcrJzxJRdyWUNfHUwHdMj4QBGQpaSqpDHIik",
+ "refunded": false,
+ "refunds": {
+ "data": [],
+ "has_more": false,
+ "object": "list",
+ "total_count": 0,
+ "url": "/v1/charges/ch_3OXMReDEQaroqDjs0kjhfAU2/refunds"
+ },
+ "review": null,
+ "shipping": null,
+ "source": null,
+ "source_transfer": null,
+ "statement_descriptor": "Zulip Basic",
+ "statement_descriptor_suffix": null,
+ "status": "succeeded",
+ "transfer_data": null,
+ "transfer_group": null
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 1,
+ "url": "/v1/charges?payment_intent=pi_3OXMReDEQaroqDjs0mD8q8KL"
+ },
+ "client_secret": "pi_3OXMReDEQaroqDjs0mD8q8KL_secret_gCowL5bV7Kc2ofPJ2nQ83d9XK",
+ "confirmation_method": "automatic",
+ "created": 1704972550,
+ "currency": "usd",
+ "customer": "cus_PM4aUmlJ9zzguj",
+ "description": "Upgrade to Zulip Basic, $3.5 x 11 - $20.0 x 1",
+ "id": "pi_3OXMReDEQaroqDjs0mD8q8KL",
+ "invoice": null,
+ "last_payment_error": null,
+ "latest_charge": "ch_3OXMReDEQaroqDjs0kjhfAU2",
+ "livemode": false,
+ "metadata": {
+ "billing_modality": "charge_automatically",
+ "billing_schedule": "2",
+ "license_management": "automatic",
+ "licenses": "11",
+ "plan_tier": "103",
+ "price_per_license": "350",
+ "remote_realm_host": "zulip.testserver",
+ "remote_realm_user_email": "[email protected]",
+ "remote_realm_user_id": "1",
+ "seat_count": "11",
+ "type": "upgrade"
+ },
+ "next_action": null,
+ "object": "payment_intent",
+ "on_behalf_of": null,
+ "payment_method": "pm_1OXMRZDEQaroqDjsU307ZStO",
+ "payment_method_configuration_details": null,
+ "payment_method_options": {
+ "card": {
+ "installments": null,
+ "mandate_options": null,
+ "network": null,
+ "request_three_d_secure": "automatic"
+ }
+ },
+ "payment_method_types": [
+ "card"
+ ],
+ "processing": null,
+ "receipt_email": "[email protected]",
+ "review": null,
+ "setup_future_usage": null,
+ "shipping": null,
+ "source": null,
+ "statement_descriptor": "Zulip Basic",
+ "statement_descriptor_suffix": null,
+ "status": "succeeded",
+ "transfer_data": null,
+ "transfer_group": null
+ }
+ },
+ "id": "evt_3OXMReDEQaroqDjs0eSfJoN5",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_txLgAL89bheY7Q",
+ "idempotency_key": "de7ae7d4-6241-4786-b1c7-a840abded8c8"
+ },
+ "type": "payment_intent.succeeded"
+ },
+ {
+ "api_version": "2020-08-27",
+ "created": 1704972551,
+ "data": {
+ "object": {
+ "amount": 1850,
+ "amount_captured": 1850,
+ "amount_refunded": 0,
+ "application": null,
+ "application_fee": null,
+ "application_fee_amount": null,
+ "balance_transaction": "txn_3OXMReDEQaroqDjs0Yi5KcWP",
+ "billing_details": {
+ "address": {
+ "city": null,
+ "country": null,
+ "line1": null,
+ "line2": null,
+ "postal_code": null,
+ "state": null
+ },
+ "email": null,
+ "name": null,
+ "phone": null
+ },
+ "calculated_statement_descriptor": "ZULIP BASIC",
+ "captured": true,
+ "created": 1704972551,
+ "currency": "usd",
+ "customer": "cus_PM4aUmlJ9zzguj",
+ "description": "Upgrade to Zulip Basic, $3.5 x 11 - $20.0 x 1",
+ "destination": null,
+ "dispute": null,
+ "disputed": false,
+ "failure_balance_transaction": null,
+ "failure_code": null,
+ "failure_message": null,
+ "fraud_details": {},
+ "id": "ch_3OXMReDEQaroqDjs0kjhfAU2",
+ "invoice": null,
+ "livemode": false,
+ "metadata": {
+ "billing_modality": "charge_automatically",
+ "billing_schedule": "2",
+ "license_management": "automatic",
+ "licenses": "11",
+ "plan_tier": "103",
+ "price_per_license": "350",
+ "remote_realm_host": "zulip.testserver",
+ "remote_realm_user_email": "[email protected]",
+ "remote_realm_user_id": "1",
+ "seat_count": "11",
+ "type": "upgrade"
+ },
+ "object": "charge",
+ "on_behalf_of": null,
+ "order": null,
+ "outcome": {
+ "network_status": "approved_by_network",
+ "reason": null,
+ "risk_level": "normal",
+ "risk_score": 35,
+ "seller_message": "Payment complete.",
+ "type": "authorized"
+ },
+ "paid": true,
+ "payment_intent": "pi_3OXMReDEQaroqDjs0mD8q8KL",
+ "payment_method": "pm_1OXMRZDEQaroqDjsU307ZStO",
+ "payment_method_details": {
+ "card": {
+ "amount_authorized": 1850,
+ "brand": "visa",
+ "checks": {
+ "address_line1_check": null,
+ "address_postal_code_check": null,
+ "cvc_check": "pass"
+ },
+ "country": "US",
+ "exp_month": 1,
+ "exp_year": 2025,
+ "extended_authorization": {
+ "status": "disabled"
+ },
+ "fingerprint": "9XKsMixKBi6kIIzd",
+ "funding": "credit",
+ "incremental_authorization": {
+ "status": "unavailable"
+ },
+ "installments": null,
+ "last4": "4242",
+ "mandate": null,
+ "multicapture": {
+ "status": "unavailable"
+ },
+ "network": "visa",
+ "network_token": {
+ "used": false
+ },
+ "overcapture": {
+ "maximum_amount_capturable": 1850,
+ "status": "unavailable"
+ },
+ "three_d_secure": null,
+ "wallet": null
+ },
+ "type": "card"
+ },
+ "radar_options": {},
+ "receipt_email": "[email protected]",
+ "receipt_number": null,
+ "receipt_url": "https://pay.stripe.com/receipts/payment/CAcaFwoVYWNjdF8xN3ZUa3dERVFhcm9xRGpzKIei_6wGMgbZCG6w3Fg6LBZqTi2dyGiONQ1Vv33UcVDz_1NBZzQKhN-sQ_KzHZWaJ_LI9BqV85O1WbNp",
+ "refunded": false,
+ "refunds": {
+ "data": [],
+ "has_more": false,
+ "object": "list",
+ "total_count": 0,
+ "url": "/v1/charges/ch_3OXMReDEQaroqDjs0kjhfAU2/refunds"
+ },
+ "review": null,
+ "shipping": null,
+ "source": null,
+ "source_transfer": null,
+ "statement_descriptor": "Zulip Basic",
+ "statement_descriptor_suffix": null,
+ "status": "succeeded",
+ "transfer_data": null,
+ "transfer_group": null
+ }
+ },
+ "id": "evt_3OXMReDEQaroqDjs02fBDz5A",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_txLgAL89bheY7Q",
+ "idempotency_key": "de7ae7d4-6241-4786-b1c7-a840abded8c8"
+ },
+ "type": "charge.succeeded"
+ },
+ {
+ "api_version": "2020-08-27",
+ "created": 1704972550,
+ "data": {
+ "object": {
+ "amount": 1850,
+ "amount_capturable": 0,
+ "amount_details": {
+ "tip": {}
+ },
+ "amount_received": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "automatic_payment_methods": null,
+ "canceled_at": null,
+ "cancellation_reason": null,
+ "capture_method": "automatic",
+ "charges": {
+ "data": [],
+ "has_more": false,
+ "object": "list",
+ "total_count": 0,
+ "url": "/v1/charges?payment_intent=pi_3OXMReDEQaroqDjs0mD8q8KL"
+ },
+ "client_secret": "pi_3OXMReDEQaroqDjs0mD8q8KL_secret_gCowL5bV7Kc2ofPJ2nQ83d9XK",
+ "confirmation_method": "automatic",
+ "created": 1704972550,
+ "currency": "usd",
+ "customer": "cus_PM4aUmlJ9zzguj",
+ "description": "Upgrade to Zulip Basic, $3.5 x 11 - $20.0 x 1",
+ "id": "pi_3OXMReDEQaroqDjs0mD8q8KL",
+ "invoice": null,
+ "last_payment_error": null,
+ "latest_charge": null,
+ "livemode": false,
+ "metadata": {
+ "billing_modality": "charge_automatically",
+ "billing_schedule": "2",
+ "license_management": "automatic",
+ "licenses": "11",
+ "plan_tier": "103",
+ "price_per_license": "350",
+ "remote_realm_host": "zulip.testserver",
+ "remote_realm_user_email": "[email protected]",
+ "remote_realm_user_id": "1",
+ "seat_count": "11",
+ "type": "upgrade"
+ },
+ "next_action": null,
+ "object": "payment_intent",
+ "on_behalf_of": null,
+ "payment_method": null,
+ "payment_method_configuration_details": null,
+ "payment_method_options": {
+ "card": {
+ "installments": null,
+ "mandate_options": null,
+ "network": null,
+ "request_three_d_secure": "automatic"
+ }
+ },
+ "payment_method_types": [
+ "card"
+ ],
+ "processing": null,
+ "receipt_email": "[email protected]",
+ "review": null,
+ "setup_future_usage": null,
+ "shipping": null,
+ "source": null,
+ "statement_descriptor": "Zulip Basic",
+ "statement_descriptor_suffix": null,
+ "status": "requires_payment_method",
+ "transfer_data": null,
+ "transfer_group": null
+ }
+ },
+ "id": "evt_3OXMReDEQaroqDjs0M7RFPut",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 2,
+ "request": {
+ "id": "req_txLgAL89bheY7Q",
+ "idempotency_key": "de7ae7d4-6241-4786-b1c7-a840abded8c8"
+ },
+ "type": "payment_intent.created"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "url": "/v1/events"
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_initial_remote_realm_upgrade--Event.list.3.json b/corporate/tests/stripe_fixtures/invoice_initial_remote_realm_upgrade--Event.list.3.json
new file mode 100644
index 00000000000..e7fd98e0dfa
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_initial_remote_realm_upgrade--Event.list.3.json
@@ -0,0 +1,1631 @@
+{
+ "data": [
+ {
+ "api_version": "2020-08-27",
+ "created": 1704972555,
+ "data": {
+ "object": {
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 0,
+ "amount_paid": 0,
+ "amount_remaining": 0,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 0,
+ "attempted": true,
+ "auto_advance": false,
+ "automatic_tax": {
+ "enabled": false,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": null,
+ "collection_method": "charge_automatically",
+ "created": 1704972554,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_PM4aUmlJ9zzguj",
+ "customer_address": null,
+ "customer_email": "[email protected]",
+ "customer_name": null,
+ "customer_phone": null,
+ "customer_shipping": null,
+ "customer_tax_exempt": "none",
+ "customer_tax_ids": [],
+ "default_payment_method": null,
+ "default_source": null,
+ "default_tax_rates": [],
+ "description": null,
+ "discount": null,
+ "discounts": [],
+ "due_date": null,
+ "effective_at": 1704972554,
+ "ending_balance": 0,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QTTRhZExmVng2TUJ0akJwSDY2Z05uNXdKbHhNampZLDk1NTEzMzU10200FnIJZ5ei?s=ap",
+ "id": "in_1OXMRiDEQaroqDjs9HAMEnLD",
+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QTTRhZExmVng2TUJ0akJwSDY2Z05uNXdKbHhNampZLDk1NTEzMzU10200FnIJZ5ei/pdf?s=ap",
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": -2000,
+ "amount_excluding_tax": -2000,
+ "currency": "usd",
+ "description": "$20.00/month new customer discount",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1OXMRhDEQaroqDjs5KCmuc1k",
+ "invoice_item": "ii_1OXMRhDEQaroqDjsFi10PcZG",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1704972553,
+ "start": 1704972553
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1704886320,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OX00qDEQaroqDjst0aTUdZR",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PLhPbuhP0lDy6A",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -2000,
+ "unit_amount_decimal": "-2000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-2000"
+ },
+ {
+ "amount": 3850,
+ "amount_excluding_tax": 3850,
+ "currency": "usd",
+ "description": "Zulip Basic",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1OXMRiDEQaroqDjsHVKXB5UA",
+ "invoice_item": "ii_1OXMRhDEQaroqDjsdoaHpCfq",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1328151845,
+ "start": 1325473445
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1702995208,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OP432DEQaroqDjsMeew3eg5",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PDUwJ9ZgTQzjad",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 350,
+ "unit_amount_decimal": "350"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 11,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "350"
+ },
+ {
+ "amount": -1850,
+ "amount_excluding_tax": -1850,
+ "currency": "usd",
+ "description": "Payment (Card ending in 4242)",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1OXMRiDEQaroqDjsVgKdSiXH",
+ "invoice_item": "ii_1OXMRgDEQaroqDjs6MCwGWMg",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1704972552,
+ "start": 1704972552
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1703048044,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OPHnEDEQaroqDjs1OZw5o3G",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_OvY3hKgN66WIeP",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -1850,
+ "unit_amount_decimal": "-1850"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-1850"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 3,
+ "url": "/v1/invoices/in_1OXMRiDEQaroqDjs9HAMEnLD/lines"
+ },
+ "livemode": false,
+ "metadata": {},
+ "next_payment_attempt": null,
+ "number": "D31E4CAA-0001",
+ "object": "invoice",
+ "on_behalf_of": null,
+ "paid": true,
+ "paid_out_of_band": false,
+ "payment_intent": null,
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1704972554,
+ "period_start": 1704972554,
+ "post_payment_credit_notes_amount": 0,
+ "pre_payment_credit_notes_amount": 0,
+ "quote": null,
+ "receipt_number": null,
+ "rendering": {
+ "amount_tax_display": null,
+ "pdf": {
+ "page_size": "letter"
+ }
+ },
+ "rendering_options": null,
+ "shipping_cost": null,
+ "shipping_details": null,
+ "starting_balance": 0,
+ "statement_descriptor": "Zulip Basic",
+ "status": "paid",
+ "status_transitions": {
+ "finalized_at": 1704972554,
+ "marked_uncollectible_at": null,
+ "paid_at": 1704972554,
+ "voided_at": null
+ },
+ "subscription": null,
+ "subscription_details": {
+ "metadata": null
+ },
+ "subtotal": 0,
+ "subtotal_excluding_tax": 0,
+ "tax": null,
+ "test_clock": null,
+ "total": 0,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 0,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": 1704972554
+ }
+ },
+ "id": "evt_1OXMRkDEQaroqDjswTBtID84",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_q3nTbtnQcjRZZF",
+ "idempotency_key": "e1267239-0d9d-4f29-92a2-f4da0e25263d"
+ },
+ "type": "invoice.payment_succeeded"
+ },
+ {
+ "api_version": "2020-08-27",
+ "created": 1704972555,
+ "data": {
+ "object": {
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 0,
+ "amount_paid": 0,
+ "amount_remaining": 0,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 0,
+ "attempted": true,
+ "auto_advance": false,
+ "automatic_tax": {
+ "enabled": false,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": null,
+ "collection_method": "charge_automatically",
+ "created": 1704972554,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_PM4aUmlJ9zzguj",
+ "customer_address": null,
+ "customer_email": "[email protected]",
+ "customer_name": null,
+ "customer_phone": null,
+ "customer_shipping": null,
+ "customer_tax_exempt": "none",
+ "customer_tax_ids": [],
+ "default_payment_method": null,
+ "default_source": null,
+ "default_tax_rates": [],
+ "description": null,
+ "discount": null,
+ "discounts": [],
+ "due_date": null,
+ "effective_at": 1704972554,
+ "ending_balance": 0,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QTTRhZExmVng2TUJ0akJwSDY2Z05uNXdKbHhNampZLDk1NTEzMzU10200FnIJZ5ei?s=ap",
+ "id": "in_1OXMRiDEQaroqDjs9HAMEnLD",
+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QTTRhZExmVng2TUJ0akJwSDY2Z05uNXdKbHhNampZLDk1NTEzMzU10200FnIJZ5ei/pdf?s=ap",
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": -2000,
+ "amount_excluding_tax": -2000,
+ "currency": "usd",
+ "description": "$20.00/month new customer discount",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1OXMRhDEQaroqDjs5KCmuc1k",
+ "invoice_item": "ii_1OXMRhDEQaroqDjsFi10PcZG",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1704972553,
+ "start": 1704972553
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1704886320,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OX00qDEQaroqDjst0aTUdZR",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PLhPbuhP0lDy6A",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -2000,
+ "unit_amount_decimal": "-2000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-2000"
+ },
+ {
+ "amount": 3850,
+ "amount_excluding_tax": 3850,
+ "currency": "usd",
+ "description": "Zulip Basic",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1OXMRiDEQaroqDjsHVKXB5UA",
+ "invoice_item": "ii_1OXMRhDEQaroqDjsdoaHpCfq",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1328151845,
+ "start": 1325473445
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1702995208,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OP432DEQaroqDjsMeew3eg5",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PDUwJ9ZgTQzjad",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 350,
+ "unit_amount_decimal": "350"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 11,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "350"
+ },
+ {
+ "amount": -1850,
+ "amount_excluding_tax": -1850,
+ "currency": "usd",
+ "description": "Payment (Card ending in 4242)",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1OXMRiDEQaroqDjsVgKdSiXH",
+ "invoice_item": "ii_1OXMRgDEQaroqDjs6MCwGWMg",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1704972552,
+ "start": 1704972552
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1703048044,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OPHnEDEQaroqDjs1OZw5o3G",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_OvY3hKgN66WIeP",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -1850,
+ "unit_amount_decimal": "-1850"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-1850"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 3,
+ "url": "/v1/invoices/in_1OXMRiDEQaroqDjs9HAMEnLD/lines"
+ },
+ "livemode": false,
+ "metadata": {},
+ "next_payment_attempt": null,
+ "number": "D31E4CAA-0001",
+ "object": "invoice",
+ "on_behalf_of": null,
+ "paid": true,
+ "paid_out_of_band": false,
+ "payment_intent": null,
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1704972554,
+ "period_start": 1704972554,
+ "post_payment_credit_notes_amount": 0,
+ "pre_payment_credit_notes_amount": 0,
+ "quote": null,
+ "receipt_number": null,
+ "rendering": {
+ "amount_tax_display": null,
+ "pdf": {
+ "page_size": "letter"
+ }
+ },
+ "rendering_options": null,
+ "shipping_cost": null,
+ "shipping_details": null,
+ "starting_balance": 0,
+ "statement_descriptor": "Zulip Basic",
+ "status": "paid",
+ "status_transitions": {
+ "finalized_at": 1704972554,
+ "marked_uncollectible_at": null,
+ "paid_at": 1704972554,
+ "voided_at": null
+ },
+ "subscription": null,
+ "subscription_details": {
+ "metadata": null
+ },
+ "subtotal": 0,
+ "subtotal_excluding_tax": 0,
+ "tax": null,
+ "test_clock": null,
+ "total": 0,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 0,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": 1704972554
+ }
+ },
+ "id": "evt_1OXMRjDEQaroqDjsZnbTM7qu",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_q3nTbtnQcjRZZF",
+ "idempotency_key": "e1267239-0d9d-4f29-92a2-f4da0e25263d"
+ },
+ "type": "invoice.paid"
+ },
+ {
+ "api_version": "2020-08-27",
+ "created": 1704972555,
+ "data": {
+ "object": {
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 0,
+ "amount_paid": 0,
+ "amount_remaining": 0,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 0,
+ "attempted": true,
+ "auto_advance": false,
+ "automatic_tax": {
+ "enabled": false,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": null,
+ "collection_method": "charge_automatically",
+ "created": 1704972554,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_PM4aUmlJ9zzguj",
+ "customer_address": null,
+ "customer_email": "[email protected]",
+ "customer_name": null,
+ "customer_phone": null,
+ "customer_shipping": null,
+ "customer_tax_exempt": "none",
+ "customer_tax_ids": [],
+ "default_payment_method": null,
+ "default_source": null,
+ "default_tax_rates": [],
+ "description": null,
+ "discount": null,
+ "discounts": [],
+ "due_date": null,
+ "effective_at": 1704972554,
+ "ending_balance": 0,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QTTRhZExmVng2TUJ0akJwSDY2Z05uNXdKbHhNampZLDk1NTEzMzU10200FnIJZ5ei?s=ap",
+ "id": "in_1OXMRiDEQaroqDjs9HAMEnLD",
+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QTTRhZExmVng2TUJ0akJwSDY2Z05uNXdKbHhNampZLDk1NTEzMzU10200FnIJZ5ei/pdf?s=ap",
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": -2000,
+ "amount_excluding_tax": -2000,
+ "currency": "usd",
+ "description": "$20.00/month new customer discount",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1OXMRhDEQaroqDjs5KCmuc1k",
+ "invoice_item": "ii_1OXMRhDEQaroqDjsFi10PcZG",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1704972553,
+ "start": 1704972553
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1704886320,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OX00qDEQaroqDjst0aTUdZR",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PLhPbuhP0lDy6A",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -2000,
+ "unit_amount_decimal": "-2000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-2000"
+ },
+ {
+ "amount": 3850,
+ "amount_excluding_tax": 3850,
+ "currency": "usd",
+ "description": "Zulip Basic",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1OXMRiDEQaroqDjsHVKXB5UA",
+ "invoice_item": "ii_1OXMRhDEQaroqDjsdoaHpCfq",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1328151845,
+ "start": 1325473445
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1702995208,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OP432DEQaroqDjsMeew3eg5",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PDUwJ9ZgTQzjad",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 350,
+ "unit_amount_decimal": "350"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 11,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "350"
+ },
+ {
+ "amount": -1850,
+ "amount_excluding_tax": -1850,
+ "currency": "usd",
+ "description": "Payment (Card ending in 4242)",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1OXMRiDEQaroqDjsVgKdSiXH",
+ "invoice_item": "ii_1OXMRgDEQaroqDjs6MCwGWMg",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1704972552,
+ "start": 1704972552
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1703048044,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OPHnEDEQaroqDjs1OZw5o3G",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_OvY3hKgN66WIeP",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -1850,
+ "unit_amount_decimal": "-1850"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-1850"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 3,
+ "url": "/v1/invoices/in_1OXMRiDEQaroqDjs9HAMEnLD/lines"
+ },
+ "livemode": false,
+ "metadata": {},
+ "next_payment_attempt": null,
+ "number": "D31E4CAA-0001",
+ "object": "invoice",
+ "on_behalf_of": null,
+ "paid": true,
+ "paid_out_of_band": false,
+ "payment_intent": null,
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1704972554,
+ "period_start": 1704972554,
+ "post_payment_credit_notes_amount": 0,
+ "pre_payment_credit_notes_amount": 0,
+ "quote": null,
+ "receipt_number": null,
+ "rendering": {
+ "amount_tax_display": null,
+ "pdf": {
+ "page_size": "letter"
+ }
+ },
+ "rendering_options": null,
+ "shipping_cost": null,
+ "shipping_details": null,
+ "starting_balance": 0,
+ "statement_descriptor": "Zulip Basic",
+ "status": "paid",
+ "status_transitions": {
+ "finalized_at": 1704972554,
+ "marked_uncollectible_at": null,
+ "paid_at": 1704972554,
+ "voided_at": null
+ },
+ "subscription": null,
+ "subscription_details": {
+ "metadata": null
+ },
+ "subtotal": 0,
+ "subtotal_excluding_tax": 0,
+ "tax": null,
+ "test_clock": null,
+ "total": 0,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 0,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": 1704972554
+ }
+ },
+ "id": "evt_1OXMRjDEQaroqDjs44LiHLJR",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_q3nTbtnQcjRZZF",
+ "idempotency_key": "e1267239-0d9d-4f29-92a2-f4da0e25263d"
+ },
+ "type": "invoice.finalized"
+ },
+ {
+ "api_version": "2020-08-27",
+ "created": 1704972555,
+ "data": {
+ "object": {
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 0,
+ "amount_paid": 0,
+ "amount_remaining": 0,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 0,
+ "attempted": true,
+ "auto_advance": false,
+ "automatic_tax": {
+ "enabled": false,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": null,
+ "collection_method": "charge_automatically",
+ "created": 1704972554,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_PM4aUmlJ9zzguj",
+ "customer_address": null,
+ "customer_email": "[email protected]",
+ "customer_name": null,
+ "customer_phone": null,
+ "customer_shipping": null,
+ "customer_tax_exempt": "none",
+ "customer_tax_ids": [],
+ "default_payment_method": null,
+ "default_source": null,
+ "default_tax_rates": [],
+ "description": null,
+ "discount": null,
+ "discounts": [],
+ "due_date": null,
+ "effective_at": 1704972554,
+ "ending_balance": 0,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QTTRhZExmVng2TUJ0akJwSDY2Z05uNXdKbHhNampZLDk1NTEzMzU10200FnIJZ5ei?s=ap",
+ "id": "in_1OXMRiDEQaroqDjs9HAMEnLD",
+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QTTRhZExmVng2TUJ0akJwSDY2Z05uNXdKbHhNampZLDk1NTEzMzU10200FnIJZ5ei/pdf?s=ap",
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": -2000,
+ "amount_excluding_tax": -2000,
+ "currency": "usd",
+ "description": "$20.00/month new customer discount",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1OXMRhDEQaroqDjs5KCmuc1k",
+ "invoice_item": "ii_1OXMRhDEQaroqDjsFi10PcZG",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1704972553,
+ "start": 1704972553
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1704886320,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OX00qDEQaroqDjst0aTUdZR",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PLhPbuhP0lDy6A",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -2000,
+ "unit_amount_decimal": "-2000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-2000"
+ },
+ {
+ "amount": 3850,
+ "amount_excluding_tax": 3850,
+ "currency": "usd",
+ "description": "Zulip Basic",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1OXMRiDEQaroqDjsHVKXB5UA",
+ "invoice_item": "ii_1OXMRhDEQaroqDjsdoaHpCfq",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1328151845,
+ "start": 1325473445
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1702995208,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OP432DEQaroqDjsMeew3eg5",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PDUwJ9ZgTQzjad",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 350,
+ "unit_amount_decimal": "350"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 11,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "350"
+ },
+ {
+ "amount": -1850,
+ "amount_excluding_tax": -1850,
+ "currency": "usd",
+ "description": "Payment (Card ending in 4242)",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1OXMRiDEQaroqDjsVgKdSiXH",
+ "invoice_item": "ii_1OXMRgDEQaroqDjs6MCwGWMg",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1704972552,
+ "start": 1704972552
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1703048044,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OPHnEDEQaroqDjs1OZw5o3G",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_OvY3hKgN66WIeP",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -1850,
+ "unit_amount_decimal": "-1850"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-1850"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 3,
+ "url": "/v1/invoices/in_1OXMRiDEQaroqDjs9HAMEnLD/lines"
+ },
+ "livemode": false,
+ "metadata": {},
+ "next_payment_attempt": null,
+ "number": "D31E4CAA-0001",
+ "object": "invoice",
+ "on_behalf_of": null,
+ "paid": true,
+ "paid_out_of_band": false,
+ "payment_intent": null,
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1704972554,
+ "period_start": 1704972554,
+ "post_payment_credit_notes_amount": 0,
+ "pre_payment_credit_notes_amount": 0,
+ "quote": null,
+ "receipt_number": null,
+ "rendering": {
+ "amount_tax_display": null,
+ "pdf": {
+ "page_size": "letter"
+ }
+ },
+ "rendering_options": null,
+ "shipping_cost": null,
+ "shipping_details": null,
+ "starting_balance": 0,
+ "statement_descriptor": "Zulip Basic",
+ "status": "paid",
+ "status_transitions": {
+ "finalized_at": 1704972554,
+ "marked_uncollectible_at": null,
+ "paid_at": 1704972554,
+ "voided_at": null
+ },
+ "subscription": null,
+ "subscription_details": {
+ "metadata": null
+ },
+ "subtotal": 0,
+ "subtotal_excluding_tax": 0,
+ "tax": null,
+ "test_clock": null,
+ "total": 0,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 0,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": 1704972554
+ },
+ "previous_attributes": {
+ "attempted": false,
+ "auto_advance": true,
+ "effective_at": null,
+ "ending_balance": null,
+ "hosted_invoice_url": null,
+ "invoice_pdf": null,
+ "next_payment_attempt": 1704976154,
+ "number": null,
+ "paid": false,
+ "rendering": {
+ "pdf": {
+ "page_size": "auto"
+ }
+ },
+ "status": "draft",
+ "status_transitions": {
+ "finalized_at": null,
+ "paid_at": null
+ }
+ }
+ },
+ "id": "evt_1OXMRjDEQaroqDjsTgqQpEm3",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_q3nTbtnQcjRZZF",
+ "idempotency_key": "e1267239-0d9d-4f29-92a2-f4da0e25263d"
+ },
+ "type": "invoice.updated"
+ },
+ {
+ "api_version": "2020-08-27",
+ "created": 1704972554,
+ "data": {
+ "object": {
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 0,
+ "amount_paid": 0,
+ "amount_remaining": 0,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 0,
+ "attempted": false,
+ "auto_advance": true,
+ "automatic_tax": {
+ "enabled": false,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": null,
+ "collection_method": "charge_automatically",
+ "created": 1704972554,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_PM4aUmlJ9zzguj",
+ "customer_address": null,
+ "customer_email": "[email protected]",
+ "customer_name": null,
+ "customer_phone": null,
+ "customer_shipping": null,
+ "customer_tax_exempt": "none",
+ "customer_tax_ids": [],
+ "default_payment_method": null,
+ "default_source": null,
+ "default_tax_rates": [],
+ "description": null,
+ "discount": null,
+ "discounts": [],
+ "due_date": null,
+ "effective_at": null,
+ "ending_balance": null,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": null,
+ "id": "in_1OXMRiDEQaroqDjs9HAMEnLD",
+ "invoice_pdf": null,
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": -2000,
+ "amount_excluding_tax": -2000,
+ "currency": "usd",
+ "description": "$20.00/month new customer discount",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1OXMRhDEQaroqDjs5KCmuc1k",
+ "invoice_item": "ii_1OXMRhDEQaroqDjsFi10PcZG",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1704972553,
+ "start": 1704972553
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1704886320,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OX00qDEQaroqDjst0aTUdZR",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PLhPbuhP0lDy6A",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -2000,
+ "unit_amount_decimal": "-2000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-2000"
+ },
+ {
+ "amount": 3850,
+ "amount_excluding_tax": 3850,
+ "currency": "usd",
+ "description": "Zulip Basic",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1OXMRiDEQaroqDjsHVKXB5UA",
+ "invoice_item": "ii_1OXMRhDEQaroqDjsdoaHpCfq",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1328151845,
+ "start": 1325473445
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1702995208,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OP432DEQaroqDjsMeew3eg5",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PDUwJ9ZgTQzjad",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 350,
+ "unit_amount_decimal": "350"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 11,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "350"
+ },
+ {
+ "amount": -1850,
+ "amount_excluding_tax": -1850,
+ "currency": "usd",
+ "description": "Payment (Card ending in 4242)",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1OXMRiDEQaroqDjsVgKdSiXH",
+ "invoice_item": "ii_1OXMRgDEQaroqDjs6MCwGWMg",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1704972552,
+ "start": 1704972552
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1703048044,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OPHnEDEQaroqDjs1OZw5o3G",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_OvY3hKgN66WIeP",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -1850,
+ "unit_amount_decimal": "-1850"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-1850"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 3,
+ "url": "/v1/invoices/in_1OXMRiDEQaroqDjs9HAMEnLD/lines"
+ },
+ "livemode": false,
+ "metadata": {},
+ "next_payment_attempt": 1704976154,
+ "number": null,
+ "object": "invoice",
+ "on_behalf_of": null,
+ "paid": false,
+ "paid_out_of_band": false,
+ "payment_intent": null,
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1704972554,
+ "period_start": 1704972554,
+ "post_payment_credit_notes_amount": 0,
+ "pre_payment_credit_notes_amount": 0,
+ "quote": null,
+ "receipt_number": null,
+ "rendering": {
+ "amount_tax_display": null,
+ "pdf": {
+ "page_size": "auto"
+ }
+ },
+ "rendering_options": null,
+ "shipping_cost": null,
+ "shipping_details": null,
+ "starting_balance": 0,
+ "statement_descriptor": "Zulip Basic",
+ "status": "draft",
+ "status_transitions": {
+ "finalized_at": null,
+ "marked_uncollectible_at": null,
+ "paid_at": null,
+ "voided_at": null
+ },
+ "subscription": null,
+ "subscription_details": {
+ "metadata": null
+ },
+ "subtotal": 0,
+ "subtotal_excluding_tax": 0,
+ "tax": null,
+ "test_clock": null,
+ "total": 0,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 0,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": null
+ }
+ },
+ "id": "evt_1OXMRiDEQaroqDjssy2Ij223",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_wpiPBud0oozVaW",
+ "idempotency_key": "951d4db8-1d68-4040-97c9-4579cc382b56"
+ },
+ "type": "invoice.created"
+ },
+ {
+ "api_version": "2020-08-27",
+ "created": 1704972553,
+ "data": {
+ "object": {
+ "amount": -2000,
+ "currency": "usd",
+ "customer": "cus_PM4aUmlJ9zzguj",
+ "date": 1704972553,
+ "description": "$20.00/month new customer discount",
+ "discountable": false,
+ "discounts": [],
+ "id": "ii_1OXMRhDEQaroqDjsFi10PcZG",
+ "invoice": null,
+ "livemode": false,
+ "metadata": {},
+ "object": "invoiceitem",
+ "period": {
+ "end": 1704972553,
+ "start": 1704972553
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1704886320,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OX00qDEQaroqDjst0aTUdZR",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PLhPbuhP0lDy6A",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -2000,
+ "unit_amount_decimal": "-2000"
+ },
+ "proration": false,
+ "quantity": 1,
+ "subscription": null,
+ "tax_rates": [],
+ "test_clock": null,
+ "unit_amount": -2000,
+ "unit_amount_decimal": "-2000"
+ }
+ },
+ "id": "evt_1OXMRhDEQaroqDjsHQAMjP3r",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_Bgh8u2kBRfBAqW",
+ "idempotency_key": "730e0cf8-99f4-4d44-b17d-b45dbb8fbb70"
+ },
+ "type": "invoiceitem.created"
+ },
+ {
+ "api_version": "2020-08-27",
+ "created": 1704972553,
+ "data": {
+ "object": {
+ "amount": 3850,
+ "currency": "usd",
+ "customer": "cus_PM4aUmlJ9zzguj",
+ "date": 1704972553,
+ "description": "Zulip Basic",
+ "discountable": false,
+ "discounts": [],
+ "id": "ii_1OXMRhDEQaroqDjsdoaHpCfq",
+ "invoice": null,
+ "livemode": false,
+ "metadata": {},
+ "object": "invoiceitem",
+ "period": {
+ "end": 1328151845,
+ "start": 1325473445
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1702995208,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OP432DEQaroqDjsMeew3eg5",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PDUwJ9ZgTQzjad",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 350,
+ "unit_amount_decimal": "350"
+ },
+ "proration": false,
+ "quantity": 11,
+ "subscription": null,
+ "tax_rates": [],
+ "test_clock": null,
+ "unit_amount": 350,
+ "unit_amount_decimal": "350"
+ }
+ },
+ "id": "evt_1OXMRhDEQaroqDjsXEcsqKgz",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_NqAyLCgmIAYmWB",
+ "idempotency_key": "4bc89d20-eb43-4fef-a515-19bd9965ee5f"
+ },
+ "type": "invoiceitem.created"
+ },
+ {
+ "api_version": "2020-08-27",
+ "created": 1704972552,
+ "data": {
+ "object": {
+ "amount": -1850,
+ "currency": "usd",
+ "customer": "cus_PM4aUmlJ9zzguj",
+ "date": 1704972552,
+ "description": "Payment (Card ending in 4242)",
+ "discountable": false,
+ "discounts": [],
+ "id": "ii_1OXMRgDEQaroqDjs6MCwGWMg",
+ "invoice": null,
+ "livemode": false,
+ "metadata": {},
+ "object": "invoiceitem",
+ "period": {
+ "end": 1704972552,
+ "start": 1704972552
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1703048044,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OPHnEDEQaroqDjs1OZw5o3G",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_OvY3hKgN66WIeP",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -1850,
+ "unit_amount_decimal": "-1850"
+ },
+ "proration": false,
+ "quantity": 1,
+ "subscription": null,
+ "tax_rates": [],
+ "test_clock": null,
+ "unit_amount": -1850,
+ "unit_amount_decimal": "-1850"
+ }
+ },
+ "id": "evt_1OXMRhDEQaroqDjsyG8ZD2z4",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_nQEug7gQaG9Ac4",
+ "idempotency_key": "3317bfe3-39f0-4243-bce1-a5dee8b361b3"
+ },
+ "type": "invoiceitem.created"
+ },
+ {
+ "api_version": "2020-08-27",
+ "created": 1704972552,
+ "data": {
+ "object": {
+ "address": null,
+ "balance": 0,
+ "created": 1704972543,
+ "currency": "usd",
+ "default_currency": "usd",
+ "default_source": null,
+ "delinquent": false,
+ "description": "zulip.testserver cb199a84-eda",
+ "discount": null,
+ "email": "[email protected]",
+ "id": "cus_PM4aUmlJ9zzguj",
+ "invoice_prefix": "D31E4CAA",
+ "invoice_settings": {
+ "custom_fields": null,
+ "default_payment_method": "pm_1OXMRZDEQaroqDjsU307ZStO",
+ "footer": null,
+ "rendering_options": null
+ },
+ "livemode": false,
+ "metadata": {
+ "remote_realm_host": "zulip.testserver",
+ "remote_realm_uuid": "cb199a84-edad-4a44-9dca-70e5478fb9fb"
+ },
+ "name": null,
+ "next_invoice_sequence": 1,
+ "object": "customer",
+ "phone": null,
+ "preferred_locales": [],
+ "shipping": null,
+ "tax_exempt": "none",
+ "test_clock": null
+ },
+ "previous_attributes": {
+ "currency": null,
+ "default_currency": null
+ }
+ },
+ "id": "evt_1OXMRgDEQaroqDjsq4xwWG8m",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_nQEug7gQaG9Ac4",
+ "idempotency_key": "3317bfe3-39f0-4243-bce1-a5dee8b361b3"
+ },
+ "type": "customer.updated"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "url": "/v1/events"
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_initial_remote_realm_upgrade--Event.list.4.json b/corporate/tests/stripe_fixtures/invoice_initial_remote_realm_upgrade--Event.list.4.json
new file mode 100644
index 00000000000..6d922067afe
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_initial_remote_realm_upgrade--Event.list.4.json
@@ -0,0 +1,6 @@
+{
+ "data": [],
+ "has_more": false,
+ "object": "list",
+ "url": "/v1/events"
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_initial_remote_realm_upgrade--Invoice.create.1.json b/corporate/tests/stripe_fixtures/invoice_initial_remote_realm_upgrade--Invoice.create.1.json
new file mode 100644
index 00000000000..32088ec3772
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_initial_remote_realm_upgrade--Invoice.create.1.json
@@ -0,0 +1,258 @@
+{
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 0,
+ "amount_paid": 0,
+ "amount_remaining": 0,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 0,
+ "attempted": false,
+ "auto_advance": true,
+ "automatic_tax": {
+ "enabled": false,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": null,
+ "collection_method": "charge_automatically",
+ "created": 1704972554,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_PM4aUmlJ9zzguj",
+ "customer_address": null,
+ "customer_email": "[email protected]",
+ "customer_name": null,
+ "customer_phone": null,
+ "customer_shipping": null,
+ "customer_tax_exempt": "none",
+ "customer_tax_ids": [],
+ "default_payment_method": null,
+ "default_source": null,
+ "default_tax_rates": [],
+ "description": null,
+ "discount": null,
+ "discounts": [],
+ "due_date": null,
+ "effective_at": null,
+ "ending_balance": null,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": null,
+ "id": "in_1OXMRiDEQaroqDjs9HAMEnLD",
+ "invoice_pdf": null,
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": -2000,
+ "amount_excluding_tax": -2000,
+ "currency": "usd",
+ "description": "$20.00/month new customer discount",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1OXMRhDEQaroqDjs5KCmuc1k",
+ "invoice_item": "ii_1OXMRhDEQaroqDjsFi10PcZG",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1704972553,
+ "start": 1704972553
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1704886320,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OX00qDEQaroqDjst0aTUdZR",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PLhPbuhP0lDy6A",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -2000,
+ "unit_amount_decimal": "-2000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-2000"
+ },
+ {
+ "amount": 3850,
+ "amount_excluding_tax": 3850,
+ "currency": "usd",
+ "description": "Zulip Basic",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1OXMRiDEQaroqDjsHVKXB5UA",
+ "invoice_item": "ii_1OXMRhDEQaroqDjsdoaHpCfq",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1328151845,
+ "start": 1325473445
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1702995208,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OP432DEQaroqDjsMeew3eg5",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PDUwJ9ZgTQzjad",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 350,
+ "unit_amount_decimal": "350"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 11,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "350"
+ },
+ {
+ "amount": -1850,
+ "amount_excluding_tax": -1850,
+ "currency": "usd",
+ "description": "Payment (Card ending in 4242)",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1OXMRiDEQaroqDjsVgKdSiXH",
+ "invoice_item": "ii_1OXMRgDEQaroqDjs6MCwGWMg",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1704972552,
+ "start": 1704972552
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1703048044,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OPHnEDEQaroqDjs1OZw5o3G",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_OvY3hKgN66WIeP",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -1850,
+ "unit_amount_decimal": "-1850"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-1850"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 3,
+ "url": "/v1/invoices/in_1OXMRiDEQaroqDjs9HAMEnLD/lines"
+ },
+ "livemode": false,
+ "metadata": {},
+ "next_payment_attempt": 1704976154,
+ "number": null,
+ "object": "invoice",
+ "on_behalf_of": null,
+ "paid": false,
+ "paid_out_of_band": false,
+ "payment_intent": null,
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1704972554,
+ "period_start": 1704972554,
+ "post_payment_credit_notes_amount": 0,
+ "pre_payment_credit_notes_amount": 0,
+ "quote": null,
+ "receipt_number": null,
+ "rendering": {
+ "amount_tax_display": null,
+ "pdf": {
+ "page_size": "auto"
+ }
+ },
+ "rendering_options": null,
+ "shipping_cost": null,
+ "shipping_details": null,
+ "starting_balance": 0,
+ "statement_descriptor": "Zulip Basic",
+ "status": "draft",
+ "status_transitions": {
+ "finalized_at": null,
+ "marked_uncollectible_at": null,
+ "paid_at": null,
+ "voided_at": null
+ },
+ "subscription": null,
+ "subscription_details": {
+ "metadata": null
+ },
+ "subtotal": 0,
+ "subtotal_excluding_tax": 0,
+ "tax": null,
+ "test_clock": null,
+ "total": 0,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 0,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": null
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_initial_remote_realm_upgrade--Invoice.finalize_invoice.1.json b/corporate/tests/stripe_fixtures/invoice_initial_remote_realm_upgrade--Invoice.finalize_invoice.1.json
new file mode 100644
index 00000000000..b5c676650e1
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_initial_remote_realm_upgrade--Invoice.finalize_invoice.1.json
@@ -0,0 +1,258 @@
+{
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 0,
+ "amount_paid": 0,
+ "amount_remaining": 0,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 0,
+ "attempted": true,
+ "auto_advance": false,
+ "automatic_tax": {
+ "enabled": false,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": null,
+ "collection_method": "charge_automatically",
+ "created": 1704972554,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_PM4aUmlJ9zzguj",
+ "customer_address": null,
+ "customer_email": "[email protected]",
+ "customer_name": null,
+ "customer_phone": null,
+ "customer_shipping": null,
+ "customer_tax_exempt": "none",
+ "customer_tax_ids": [],
+ "default_payment_method": null,
+ "default_source": null,
+ "default_tax_rates": [],
+ "description": null,
+ "discount": null,
+ "discounts": [],
+ "due_date": null,
+ "effective_at": 1704972554,
+ "ending_balance": 0,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QTTRhZExmVng2TUJ0akJwSDY2Z05uNXdKbHhNampZLDk1NTEzMzU10200FnIJZ5ei?s=ap",
+ "id": "in_1OXMRiDEQaroqDjs9HAMEnLD",
+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QTTRhZExmVng2TUJ0akJwSDY2Z05uNXdKbHhNampZLDk1NTEzMzU10200FnIJZ5ei/pdf?s=ap",
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": -2000,
+ "amount_excluding_tax": -2000,
+ "currency": "usd",
+ "description": "$20.00/month new customer discount",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1OXMRhDEQaroqDjs5KCmuc1k",
+ "invoice_item": "ii_1OXMRhDEQaroqDjsFi10PcZG",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1704972553,
+ "start": 1704972553
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1704886320,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OX00qDEQaroqDjst0aTUdZR",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PLhPbuhP0lDy6A",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -2000,
+ "unit_amount_decimal": "-2000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-2000"
+ },
+ {
+ "amount": 3850,
+ "amount_excluding_tax": 3850,
+ "currency": "usd",
+ "description": "Zulip Basic",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1OXMRiDEQaroqDjsHVKXB5UA",
+ "invoice_item": "ii_1OXMRhDEQaroqDjsdoaHpCfq",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1328151845,
+ "start": 1325473445
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1702995208,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OP432DEQaroqDjsMeew3eg5",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PDUwJ9ZgTQzjad",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 350,
+ "unit_amount_decimal": "350"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 11,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "350"
+ },
+ {
+ "amount": -1850,
+ "amount_excluding_tax": -1850,
+ "currency": "usd",
+ "description": "Payment (Card ending in 4242)",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1OXMRiDEQaroqDjsVgKdSiXH",
+ "invoice_item": "ii_1OXMRgDEQaroqDjs6MCwGWMg",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1704972552,
+ "start": 1704972552
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1703048044,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OPHnEDEQaroqDjs1OZw5o3G",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_OvY3hKgN66WIeP",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -1850,
+ "unit_amount_decimal": "-1850"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-1850"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 3,
+ "url": "/v1/invoices/in_1OXMRiDEQaroqDjs9HAMEnLD/lines"
+ },
+ "livemode": false,
+ "metadata": {},
+ "next_payment_attempt": null,
+ "number": "D31E4CAA-0001",
+ "object": "invoice",
+ "on_behalf_of": null,
+ "paid": true,
+ "paid_out_of_band": false,
+ "payment_intent": null,
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1704972554,
+ "period_start": 1704972554,
+ "post_payment_credit_notes_amount": 0,
+ "pre_payment_credit_notes_amount": 0,
+ "quote": null,
+ "receipt_number": null,
+ "rendering": {
+ "amount_tax_display": null,
+ "pdf": {
+ "page_size": "letter"
+ }
+ },
+ "rendering_options": null,
+ "shipping_cost": null,
+ "shipping_details": null,
+ "starting_balance": 0,
+ "statement_descriptor": "Zulip Basic",
+ "status": "paid",
+ "status_transitions": {
+ "finalized_at": 1704972554,
+ "marked_uncollectible_at": null,
+ "paid_at": 1704972554,
+ "voided_at": null
+ },
+ "subscription": null,
+ "subscription_details": {
+ "metadata": null
+ },
+ "subtotal": 0,
+ "subtotal_excluding_tax": 0,
+ "tax": null,
+ "test_clock": null,
+ "total": 0,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 0,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": 1704972554
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_initial_remote_realm_upgrade--Invoice.list.1.json b/corporate/tests/stripe_fixtures/invoice_initial_remote_realm_upgrade--Invoice.list.1.json
new file mode 100644
index 00000000000..e39960ab725
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_initial_remote_realm_upgrade--Invoice.list.1.json
@@ -0,0 +1,6 @@
+{
+ "data": [],
+ "has_more": false,
+ "object": "list",
+ "url": "/v1/invoices"
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_initial_remote_realm_upgrade--Invoice.list.2.json b/corporate/tests/stripe_fixtures/invoice_initial_remote_realm_upgrade--Invoice.list.2.json
new file mode 100644
index 00000000000..0abe66f45c3
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_initial_remote_realm_upgrade--Invoice.list.2.json
@@ -0,0 +1,265 @@
+{
+ "data": [
+ {
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 0,
+ "amount_paid": 0,
+ "amount_remaining": 0,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 0,
+ "attempted": true,
+ "auto_advance": false,
+ "automatic_tax": {
+ "enabled": false,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": null,
+ "collection_method": "charge_automatically",
+ "created": 1704972554,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_PM4aUmlJ9zzguj",
+ "customer_address": null,
+ "customer_email": "[email protected]",
+ "customer_name": null,
+ "customer_phone": null,
+ "customer_shipping": null,
+ "customer_tax_exempt": "none",
+ "customer_tax_ids": [],
+ "default_payment_method": null,
+ "default_source": null,
+ "default_tax_rates": [],
+ "description": null,
+ "discount": null,
+ "discounts": [],
+ "due_date": null,
+ "effective_at": 1704972554,
+ "ending_balance": 0,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QTTRhZExmVng2TUJ0akJwSDY2Z05uNXdKbHhNampZLDk1NTEzMzU30200umev1N96?s=ap",
+ "id": "in_1OXMRiDEQaroqDjs9HAMEnLD",
+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QTTRhZExmVng2TUJ0akJwSDY2Z05uNXdKbHhNampZLDk1NTEzMzU30200umev1N96/pdf?s=ap",
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": -2000,
+ "amount_excluding_tax": -2000,
+ "currency": "usd",
+ "description": "$20.00/month new customer discount",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1OXMRhDEQaroqDjs5KCmuc1k",
+ "invoice_item": "ii_1OXMRhDEQaroqDjsFi10PcZG",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1704972553,
+ "start": 1704972553
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1704886320,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OX00qDEQaroqDjst0aTUdZR",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PLhPbuhP0lDy6A",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -2000,
+ "unit_amount_decimal": "-2000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-2000"
+ },
+ {
+ "amount": 3850,
+ "amount_excluding_tax": 3850,
+ "currency": "usd",
+ "description": "Zulip Basic",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1OXMRiDEQaroqDjsHVKXB5UA",
+ "invoice_item": "ii_1OXMRhDEQaroqDjsdoaHpCfq",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1328151845,
+ "start": 1325473445
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1702995208,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OP432DEQaroqDjsMeew3eg5",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PDUwJ9ZgTQzjad",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 350,
+ "unit_amount_decimal": "350"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 11,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "350"
+ },
+ {
+ "amount": -1850,
+ "amount_excluding_tax": -1850,
+ "currency": "usd",
+ "description": "Payment (Card ending in 4242)",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1OXMRiDEQaroqDjsVgKdSiXH",
+ "invoice_item": "ii_1OXMRgDEQaroqDjs6MCwGWMg",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1704972552,
+ "start": 1704972552
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1703048044,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OPHnEDEQaroqDjs1OZw5o3G",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_OvY3hKgN66WIeP",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -1850,
+ "unit_amount_decimal": "-1850"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-1850"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 3,
+ "url": "/v1/invoices/in_1OXMRiDEQaroqDjs9HAMEnLD/lines"
+ },
+ "livemode": false,
+ "metadata": {},
+ "next_payment_attempt": null,
+ "number": "D31E4CAA-0001",
+ "object": "invoice",
+ "on_behalf_of": null,
+ "paid": true,
+ "paid_out_of_band": false,
+ "payment_intent": null,
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1704972554,
+ "period_start": 1704972554,
+ "post_payment_credit_notes_amount": 0,
+ "pre_payment_credit_notes_amount": 0,
+ "quote": null,
+ "receipt_number": null,
+ "rendering": {
+ "amount_tax_display": null,
+ "pdf": {
+ "page_size": "letter"
+ }
+ },
+ "rendering_options": null,
+ "shipping_cost": null,
+ "shipping_details": null,
+ "starting_balance": 0,
+ "statement_descriptor": "Zulip Basic",
+ "status": "paid",
+ "status_transitions": {
+ "finalized_at": 1704972554,
+ "marked_uncollectible_at": null,
+ "paid_at": 1704972554,
+ "voided_at": null
+ },
+ "subscription": null,
+ "subscription_details": {
+ "metadata": null
+ },
+ "subtotal": 0,
+ "subtotal_excluding_tax": 0,
+ "tax": null,
+ "test_clock": null,
+ "total": 0,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 0,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": 1704972554
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "url": "/v1/invoices"
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_initial_remote_realm_upgrade--InvoiceItem.create.1.json b/corporate/tests/stripe_fixtures/invoice_initial_remote_realm_upgrade--InvoiceItem.create.1.json
new file mode 100644
index 00000000000..02afb0c5bfb
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_initial_remote_realm_upgrade--InvoiceItem.create.1.json
@@ -0,0 +1,47 @@
+{
+ "amount": -1850,
+ "currency": "usd",
+ "customer": "cus_PM4aUmlJ9zzguj",
+ "date": 1704972552,
+ "description": "Payment (Card ending in 4242)",
+ "discountable": false,
+ "discounts": [],
+ "id": "ii_1OXMRgDEQaroqDjs6MCwGWMg",
+ "invoice": null,
+ "livemode": false,
+ "metadata": {},
+ "object": "invoiceitem",
+ "period": {
+ "end": 1704972552,
+ "start": 1704972552
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1703048044,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OPHnEDEQaroqDjs1OZw5o3G",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_OvY3hKgN66WIeP",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -1850,
+ "unit_amount_decimal": "-1850"
+ },
+ "proration": false,
+ "quantity": 1,
+ "subscription": null,
+ "tax_rates": [],
+ "test_clock": null,
+ "unit_amount": -1850,
+ "unit_amount_decimal": "-1850"
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_initial_remote_realm_upgrade--InvoiceItem.create.2.json b/corporate/tests/stripe_fixtures/invoice_initial_remote_realm_upgrade--InvoiceItem.create.2.json
new file mode 100644
index 00000000000..2b9b2e31b6a
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_initial_remote_realm_upgrade--InvoiceItem.create.2.json
@@ -0,0 +1,47 @@
+{
+ "amount": 3850,
+ "currency": "usd",
+ "customer": "cus_PM4aUmlJ9zzguj",
+ "date": 1704972553,
+ "description": "Zulip Basic",
+ "discountable": false,
+ "discounts": [],
+ "id": "ii_1OXMRhDEQaroqDjsdoaHpCfq",
+ "invoice": null,
+ "livemode": false,
+ "metadata": {},
+ "object": "invoiceitem",
+ "period": {
+ "end": 1328151845,
+ "start": 1325473445
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1702995208,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OP432DEQaroqDjsMeew3eg5",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PDUwJ9ZgTQzjad",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 350,
+ "unit_amount_decimal": "350"
+ },
+ "proration": false,
+ "quantity": 11,
+ "subscription": null,
+ "tax_rates": [],
+ "test_clock": null,
+ "unit_amount": 350,
+ "unit_amount_decimal": "350"
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_initial_remote_realm_upgrade--InvoiceItem.create.3.json b/corporate/tests/stripe_fixtures/invoice_initial_remote_realm_upgrade--InvoiceItem.create.3.json
new file mode 100644
index 00000000000..6dd0b9bba78
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_initial_remote_realm_upgrade--InvoiceItem.create.3.json
@@ -0,0 +1,47 @@
+{
+ "amount": -2000,
+ "currency": "usd",
+ "customer": "cus_PM4aUmlJ9zzguj",
+ "date": 1704972553,
+ "description": "$20.00/month new customer discount",
+ "discountable": false,
+ "discounts": [],
+ "id": "ii_1OXMRhDEQaroqDjsFi10PcZG",
+ "invoice": null,
+ "livemode": false,
+ "metadata": {},
+ "object": "invoiceitem",
+ "period": {
+ "end": 1704972553,
+ "start": 1704972553
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1704886320,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OX00qDEQaroqDjst0aTUdZR",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PLhPbuhP0lDy6A",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -2000,
+ "unit_amount_decimal": "-2000"
+ },
+ "proration": false,
+ "quantity": 1,
+ "subscription": null,
+ "tax_rates": [],
+ "test_clock": null,
+ "unit_amount": -2000,
+ "unit_amount_decimal": "-2000"
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_initial_remote_realm_upgrade--PaymentIntent.create.1.json b/corporate/tests/stripe_fixtures/invoice_initial_remote_realm_upgrade--PaymentIntent.create.1.json
new file mode 100644
index 00000000000..99adf8661c6
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_initial_remote_realm_upgrade--PaymentIntent.create.1.json
@@ -0,0 +1,198 @@
+{
+ "amount": 1850,
+ "amount_capturable": 0,
+ "amount_details": {
+ "tip": {}
+ },
+ "amount_received": 1850,
+ "application": null,
+ "application_fee_amount": null,
+ "automatic_payment_methods": null,
+ "canceled_at": null,
+ "cancellation_reason": null,
+ "capture_method": "automatic",
+ "charges": {
+ "data": [
+ {
+ "amount": 1850,
+ "amount_captured": 1850,
+ "amount_refunded": 0,
+ "application": null,
+ "application_fee": null,
+ "application_fee_amount": null,
+ "balance_transaction": "txn_3OXMReDEQaroqDjs0Yi5KcWP",
+ "billing_details": {
+ "address": {
+ "city": null,
+ "country": null,
+ "line1": null,
+ "line2": null,
+ "postal_code": null,
+ "state": null
+ },
+ "email": null,
+ "name": null,
+ "phone": null
+ },
+ "calculated_statement_descriptor": "ZULIP BASIC",
+ "captured": true,
+ "created": 1704972551,
+ "currency": "usd",
+ "customer": "cus_PM4aUmlJ9zzguj",
+ "description": "Upgrade to Zulip Basic, $3.5 x 11 - $20.0 x 1",
+ "destination": null,
+ "dispute": null,
+ "disputed": false,
+ "failure_balance_transaction": null,
+ "failure_code": null,
+ "failure_message": null,
+ "fraud_details": {},
+ "id": "ch_3OXMReDEQaroqDjs0kjhfAU2",
+ "invoice": null,
+ "livemode": false,
+ "metadata": {
+ "billing_modality": "charge_automatically",
+ "billing_schedule": "2",
+ "license_management": "automatic",
+ "licenses": "11",
+ "plan_tier": "103",
+ "price_per_license": "350",
+ "remote_realm_host": "zulip.testserver",
+ "remote_realm_user_email": "[email protected]",
+ "remote_realm_user_id": "1",
+ "seat_count": "11",
+ "type": "upgrade"
+ },
+ "object": "charge",
+ "on_behalf_of": null,
+ "order": null,
+ "outcome": {
+ "network_status": "approved_by_network",
+ "reason": null,
+ "risk_level": "normal",
+ "risk_score": 35,
+ "seller_message": "Payment complete.",
+ "type": "authorized"
+ },
+ "paid": true,
+ "payment_intent": "pi_3OXMReDEQaroqDjs0mD8q8KL",
+ "payment_method": "pm_1OXMRZDEQaroqDjsU307ZStO",
+ "payment_method_details": {
+ "card": {
+ "amount_authorized": 1850,
+ "brand": "visa",
+ "checks": {
+ "address_line1_check": null,
+ "address_postal_code_check": null,
+ "cvc_check": "pass"
+ },
+ "country": "US",
+ "exp_month": 1,
+ "exp_year": 2025,
+ "extended_authorization": {
+ "status": "disabled"
+ },
+ "fingerprint": "9XKsMixKBi6kIIzd",
+ "funding": "credit",
+ "incremental_authorization": {
+ "status": "unavailable"
+ },
+ "installments": null,
+ "last4": "4242",
+ "mandate": null,
+ "multicapture": {
+ "status": "unavailable"
+ },
+ "network": "visa",
+ "network_token": {
+ "used": false
+ },
+ "overcapture": {
+ "maximum_amount_capturable": 1850,
+ "status": "unavailable"
+ },
+ "three_d_secure": null,
+ "wallet": null
+ },
+ "type": "card"
+ },
+ "radar_options": {},
+ "receipt_email": "[email protected]",
+ "receipt_number": null,
+ "receipt_url": "https://pay.stripe.com/receipts/payment/CAcaFwoVYWNjdF8xN3ZUa3dERVFhcm9xRGpzKIei_6wGMgbRnUZg2cA6LBaXgAzjk0570gsWMlwRsk-PjY4INxubp68xatPCZLRkdOdppKg2jpGwk_xE",
+ "refunded": false,
+ "refunds": {
+ "data": [],
+ "has_more": false,
+ "object": "list",
+ "total_count": 0,
+ "url": "/v1/charges/ch_3OXMReDEQaroqDjs0kjhfAU2/refunds"
+ },
+ "review": null,
+ "shipping": null,
+ "source": null,
+ "source_transfer": null,
+ "statement_descriptor": "Zulip Basic",
+ "statement_descriptor_suffix": null,
+ "status": "succeeded",
+ "transfer_data": null,
+ "transfer_group": null
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 1,
+ "url": "/v1/charges?payment_intent=pi_3OXMReDEQaroqDjs0mD8q8KL"
+ },
+ "client_secret": "pi_3OXMReDEQaroqDjs0mD8q8KL_secret_gCowL5bV7Kc2ofPJ2nQ83d9XK",
+ "confirmation_method": "automatic",
+ "created": 1704972550,
+ "currency": "usd",
+ "customer": "cus_PM4aUmlJ9zzguj",
+ "description": "Upgrade to Zulip Basic, $3.5 x 11 - $20.0 x 1",
+ "id": "pi_3OXMReDEQaroqDjs0mD8q8KL",
+ "invoice": null,
+ "last_payment_error": null,
+ "latest_charge": "ch_3OXMReDEQaroqDjs0kjhfAU2",
+ "livemode": false,
+ "metadata": {
+ "billing_modality": "charge_automatically",
+ "billing_schedule": "2",
+ "license_management": "automatic",
+ "licenses": "11",
+ "plan_tier": "103",
+ "price_per_license": "350",
+ "remote_realm_host": "zulip.testserver",
+ "remote_realm_user_email": "[email protected]",
+ "remote_realm_user_id": "1",
+ "seat_count": "11",
+ "type": "upgrade"
+ },
+ "next_action": null,
+ "object": "payment_intent",
+ "on_behalf_of": null,
+ "payment_method": "pm_1OXMRZDEQaroqDjsU307ZStO",
+ "payment_method_configuration_details": null,
+ "payment_method_options": {
+ "card": {
+ "installments": null,
+ "mandate_options": null,
+ "network": null,
+ "request_three_d_secure": "automatic"
+ }
+ },
+ "payment_method_types": [
+ "card"
+ ],
+ "processing": null,
+ "receipt_email": "[email protected]",
+ "review": null,
+ "setup_future_usage": null,
+ "shipping": null,
+ "source": null,
+ "statement_descriptor": "Zulip Basic",
+ "statement_descriptor_suffix": null,
+ "status": "succeeded",
+ "transfer_data": null,
+ "transfer_group": null
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_initial_remote_realm_upgrade--SetupIntent.create.1.json b/corporate/tests/stripe_fixtures/invoice_initial_remote_realm_upgrade--SetupIntent.create.1.json
new file mode 100644
index 00000000000..0c778c2321d
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_initial_remote_realm_upgrade--SetupIntent.create.1.json
@@ -0,0 +1,34 @@
+{
+ "application": null,
+ "automatic_payment_methods": null,
+ "cancellation_reason": null,
+ "client_secret": "seti_1OXMRZDEQaroqDjsPmqqxPFJ_secret_PM4aohOp9yyj7BrpUlffpjlQdIjY3RL",
+ "created": 1704972545,
+ "customer": "cus_PM4aUmlJ9zzguj",
+ "description": null,
+ "flow_directions": null,
+ "id": "seti_1OXMRZDEQaroqDjsPmqqxPFJ",
+ "last_setup_error": null,
+ "latest_attempt": "setatt_1OXMRZDEQaroqDjsH1vhXlkn",
+ "livemode": false,
+ "mandate": null,
+ "metadata": {},
+ "next_action": null,
+ "object": "setup_intent",
+ "on_behalf_of": null,
+ "payment_method": "pm_1OXMRZDEQaroqDjsU307ZStO",
+ "payment_method_configuration_details": null,
+ "payment_method_options": {
+ "card": {
+ "mandate_options": null,
+ "network": null,
+ "request_three_d_secure": "automatic"
+ }
+ },
+ "payment_method_types": [
+ "card"
+ ],
+ "single_use_mandate": null,
+ "status": "succeeded",
+ "usage": "off_session"
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_initial_remote_realm_upgrade--SetupIntent.list.1.json b/corporate/tests/stripe_fixtures/invoice_initial_remote_realm_upgrade--SetupIntent.list.1.json
new file mode 100644
index 00000000000..bc1fed01ab6
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_initial_remote_realm_upgrade--SetupIntent.list.1.json
@@ -0,0 +1,41 @@
+{
+ "data": [
+ {
+ "application": null,
+ "automatic_payment_methods": null,
+ "cancellation_reason": null,
+ "client_secret": "seti_1OXMRYDEQaroqDjshduP94av_secret_PM4abkmsTqimpBHvaRmINZIQ0O6AO2L",
+ "created": 1704972544,
+ "customer": "cus_PM4aUmlJ9zzguj",
+ "description": null,
+ "flow_directions": null,
+ "id": "seti_1OXMRYDEQaroqDjshduP94av",
+ "last_setup_error": null,
+ "latest_attempt": null,
+ "livemode": false,
+ "mandate": null,
+ "metadata": {},
+ "next_action": null,
+ "object": "setup_intent",
+ "on_behalf_of": null,
+ "payment_method": null,
+ "payment_method_configuration_details": null,
+ "payment_method_options": {
+ "card": {
+ "mandate_options": null,
+ "network": null,
+ "request_three_d_secure": "automatic"
+ }
+ },
+ "payment_method_types": [
+ "card"
+ ],
+ "single_use_mandate": null,
+ "status": "requires_payment_method",
+ "usage": "off_session"
+ }
+ ],
+ "has_more": true,
+ "object": "list",
+ "url": "/v1/setup_intents"
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_initial_remote_realm_upgrade--SetupIntent.retrieve.1.json b/corporate/tests/stripe_fixtures/invoice_initial_remote_realm_upgrade--SetupIntent.retrieve.1.json
new file mode 100644
index 00000000000..0c778c2321d
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_initial_remote_realm_upgrade--SetupIntent.retrieve.1.json
@@ -0,0 +1,34 @@
+{
+ "application": null,
+ "automatic_payment_methods": null,
+ "cancellation_reason": null,
+ "client_secret": "seti_1OXMRZDEQaroqDjsPmqqxPFJ_secret_PM4aohOp9yyj7BrpUlffpjlQdIjY3RL",
+ "created": 1704972545,
+ "customer": "cus_PM4aUmlJ9zzguj",
+ "description": null,
+ "flow_directions": null,
+ "id": "seti_1OXMRZDEQaroqDjsPmqqxPFJ",
+ "last_setup_error": null,
+ "latest_attempt": "setatt_1OXMRZDEQaroqDjsH1vhXlkn",
+ "livemode": false,
+ "mandate": null,
+ "metadata": {},
+ "next_action": null,
+ "object": "setup_intent",
+ "on_behalf_of": null,
+ "payment_method": "pm_1OXMRZDEQaroqDjsU307ZStO",
+ "payment_method_configuration_details": null,
+ "payment_method_options": {
+ "card": {
+ "mandate_options": null,
+ "network": null,
+ "request_three_d_secure": "automatic"
+ }
+ },
+ "payment_method_types": [
+ "card"
+ ],
+ "single_use_mandate": null,
+ "status": "succeeded",
+ "usage": "off_session"
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_initial_remote_realm_upgrade--checkout.Session.create.1.json b/corporate/tests/stripe_fixtures/invoice_initial_remote_realm_upgrade--checkout.Session.create.1.json
new file mode 100644
index 00000000000..c2c6b2aa314
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_initial_remote_realm_upgrade--checkout.Session.create.1.json
@@ -0,0 +1,74 @@
+{
+ "after_expiration": null,
+ "allow_promotion_codes": null,
+ "amount_subtotal": null,
+ "amount_total": null,
+ "automatic_tax": {
+ "enabled": false,
+ "status": null
+ },
+ "billing_address_collection": null,
+ "cancel_url": "http://selfhosting.testserver/realm/cb199a84-edad-4a44-9dca-70e5478fb9fb/upgrade/?manual_license_management=false&tier=1",
+ "client_reference_id": null,
+ "client_secret": null,
+ "consent": null,
+ "consent_collection": null,
+ "created": 1704972544,
+ "currency": null,
+ "currency_conversion": null,
+ "custom_fields": [],
+ "custom_text": {
+ "after_submit": null,
+ "shipping_address": null,
+ "submit": null,
+ "terms_of_service_acceptance": null
+ },
+ "customer": "cus_PM4aUmlJ9zzguj",
+ "customer_creation": null,
+ "customer_details": {
+ "address": null,
+ "email": "[email protected]",
+ "name": null,
+ "phone": null,
+ "tax_exempt": null,
+ "tax_ids": null
+ },
+ "customer_email": null,
+ "expires_at": 1705058944,
+ "id": "cs_test_c1zsTAZvt7pK2k2uyQtfpNnfqfCzqZFNDA0sSQjvRHqS07VluVML5u01ih",
+ "invoice": null,
+ "invoice_creation": null,
+ "livemode": false,
+ "locale": null,
+ "metadata": {
+ "remote_realm_user_id": "1",
+ "type": "card_update"
+ },
+ "mode": "setup",
+ "object": "checkout.session",
+ "payment_intent": null,
+ "payment_link": null,
+ "payment_method_collection": "always",
+ "payment_method_configuration_details": null,
+ "payment_method_options": {},
+ "payment_method_types": [
+ "card"
+ ],
+ "payment_status": "no_payment_required",
+ "phone_number_collection": {
+ "enabled": false
+ },
+ "recovered_from": null,
+ "setup_intent": "seti_1OXMRYDEQaroqDjshduP94av",
+ "shipping": null,
+ "shipping_address_collection": null,
+ "shipping_options": [],
+ "shipping_rate": null,
+ "status": "open",
+ "submit_type": null,
+ "subscription": null,
+ "success_url": "http://selfhosting.testserver/realm/cb199a84-edad-4a44-9dca-70e5478fb9fb/billing/event_status?stripe_session_id={CHECKOUT_SESSION_ID}",
+ "total_details": null,
+ "ui_mode": "hosted",
+ "url": "https://checkout.stripe.com/c/pay/cs_test_c1zsTAZvt7pK2k2uyQtfpNnfqfCzqZFNDA0sSQjvRHqS07VluVML5u01ih#fid1d2BpamRhQ2prcSc%2FJ1ZqcHdmYCVWZGt2JVV3aicpJ2R1bE5gfCc%2FJ3VuWnFgdnFaXVRmMU5zNkldQTY9SnNRY09XZml2UXNQJyknY3dqaFZgd3Ngdyc%2FcXdwYCknaWR8anBxUXx1YCc%2FJ3Zsa2JpYFpmamlwaGsnKSdga2RnaWBVaWRmYG1qaWFgd3YnP3F3cGB4JSUl"
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_initial_remote_realm_upgrade--checkout.Session.list.1.json b/corporate/tests/stripe_fixtures/invoice_initial_remote_realm_upgrade--checkout.Session.list.1.json
new file mode 100644
index 00000000000..acd035d7d85
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_initial_remote_realm_upgrade--checkout.Session.list.1.json
@@ -0,0 +1,81 @@
+{
+ "data": [
+ {
+ "after_expiration": null,
+ "allow_promotion_codes": null,
+ "amount_subtotal": null,
+ "amount_total": null,
+ "automatic_tax": {
+ "enabled": false,
+ "status": null
+ },
+ "billing_address_collection": null,
+ "cancel_url": "http://selfhosting.testserver/realm/cb199a84-edad-4a44-9dca-70e5478fb9fb/upgrade/?manual_license_management=false&tier=1",
+ "client_reference_id": null,
+ "client_secret": null,
+ "consent": null,
+ "consent_collection": null,
+ "created": 1704972544,
+ "currency": null,
+ "currency_conversion": null,
+ "custom_fields": [],
+ "custom_text": {
+ "after_submit": null,
+ "shipping_address": null,
+ "submit": null,
+ "terms_of_service_acceptance": null
+ },
+ "customer": "cus_PM4aUmlJ9zzguj",
+ "customer_creation": null,
+ "customer_details": {
+ "address": null,
+ "email": "[email protected]",
+ "name": null,
+ "phone": null,
+ "tax_exempt": null,
+ "tax_ids": null
+ },
+ "customer_email": null,
+ "expires_at": 1705058944,
+ "id": "cs_test_c1zsTAZvt7pK2k2uyQtfpNnfqfCzqZFNDA0sSQjvRHqS07VluVML5u01ih",
+ "invoice": null,
+ "invoice_creation": null,
+ "livemode": false,
+ "locale": null,
+ "metadata": {
+ "remote_realm_user_id": "1",
+ "type": "card_update"
+ },
+ "mode": "setup",
+ "object": "checkout.session",
+ "payment_intent": null,
+ "payment_link": null,
+ "payment_method_collection": "always",
+ "payment_method_configuration_details": null,
+ "payment_method_options": {},
+ "payment_method_types": [
+ "card"
+ ],
+ "payment_status": "no_payment_required",
+ "phone_number_collection": {
+ "enabled": false
+ },
+ "recovered_from": null,
+ "setup_intent": "seti_1OXMRYDEQaroqDjshduP94av",
+ "shipping": null,
+ "shipping_address_collection": null,
+ "shipping_options": [],
+ "shipping_rate": null,
+ "status": "open",
+ "submit_type": null,
+ "subscription": null,
+ "success_url": "http://selfhosting.testserver/realm/cb199a84-edad-4a44-9dca-70e5478fb9fb/billing/event_status?stripe_session_id={CHECKOUT_SESSION_ID}",
+ "total_details": null,
+ "ui_mode": "hosted",
+ "url": "https://checkout.stripe.com/c/pay/cs_test_c1zsTAZvt7pK2k2uyQtfpNnfqfCzqZFNDA0sSQjvRHqS07VluVML5u01ih#fid1d2BpamRhQ2prcSc%2FJ1ZqcHdmYCVWZGt2JVV3aicpJ2R1bE5gfCc%2FJ3VuWnFgdnFaXVRmMU5zNkldQTY9SnNRY09XZml2UXNQJyknY3dqaFZgd3Ngdyc%2FcXdwYCknaWR8anBxUXx1YCc%2FJ3Zsa2JpYFpmamlwaGsnKSdga2RnaWBVaWRmYG1qaWFgd3YnP3F3cGB4JSUl"
+ }
+ ],
+ "has_more": true,
+ "object": "list",
+ "url": "/v1/checkout/sessions"
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--Customer.create.1.json b/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--Customer.create.1.json
new file mode 100644
index 00000000000..05b326f8db8
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--Customer.create.1.json
@@ -0,0 +1,33 @@
+{
+ "address": null,
+ "balance": 0,
+ "created": 1704972529,
+ "currency": null,
+ "default_currency": null,
+ "default_source": null,
+ "delinquent": false,
+ "description": "demo.example.com 6cde5f7a-1f7",
+ "discount": null,
+ "email": "[email protected]",
+ "id": "cus_PM4axrAbUxZIzJ",
+ "invoice_prefix": "5A968AD5",
+ "invoice_settings": {
+ "custom_fields": null,
+ "default_payment_method": null,
+ "footer": null,
+ "rendering_options": null
+ },
+ "livemode": false,
+ "metadata": {
+ "remote_server_str": "demo.example.com 6cde5f7a-1f7",
+ "remote_server_uuid": "6cde5f7a-1f7e-4978-9716-49f69ebfc9fe"
+ },
+ "name": null,
+ "next_invoice_sequence": 1,
+ "object": "customer",
+ "phone": null,
+ "preferred_locales": [],
+ "shipping": null,
+ "tax_exempt": "none",
+ "test_clock": null
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--Customer.modify.1.json b/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--Customer.modify.1.json
new file mode 100644
index 00000000000..fc54f8f8014
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--Customer.modify.1.json
@@ -0,0 +1,33 @@
+{
+ "address": null,
+ "balance": 0,
+ "created": 1704972529,
+ "currency": null,
+ "default_currency": null,
+ "default_source": null,
+ "delinquent": false,
+ "description": "demo.example.com 6cde5f7a-1f7",
+ "discount": null,
+ "email": "[email protected]",
+ "id": "cus_PM4axrAbUxZIzJ",
+ "invoice_prefix": "5A968AD5",
+ "invoice_settings": {
+ "custom_fields": null,
+ "default_payment_method": "pm_1OXMRKDEQaroqDjsjvn2UVaa",
+ "footer": null,
+ "rendering_options": null
+ },
+ "livemode": false,
+ "metadata": {
+ "remote_server_str": "demo.example.com 6cde5f7a-1f7",
+ "remote_server_uuid": "6cde5f7a-1f7e-4978-9716-49f69ebfc9fe"
+ },
+ "name": null,
+ "next_invoice_sequence": 1,
+ "object": "customer",
+ "phone": null,
+ "preferred_locales": [],
+ "shipping": null,
+ "tax_exempt": "none",
+ "test_clock": null
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--Customer.retrieve.1.json b/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--Customer.retrieve.1.json
new file mode 100644
index 00000000000..ad7b096a0f1
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--Customer.retrieve.1.json
@@ -0,0 +1,79 @@
+{
+ "address": null,
+ "balance": 0,
+ "created": 1704972529,
+ "currency": null,
+ "default_currency": null,
+ "default_source": null,
+ "delinquent": false,
+ "description": "demo.example.com 6cde5f7a-1f7",
+ "discount": null,
+ "email": "[email protected]",
+ "id": "cus_PM4axrAbUxZIzJ",
+ "invoice_prefix": "5A968AD5",
+ "invoice_settings": {
+ "custom_fields": null,
+ "default_payment_method": {
+ "billing_details": {
+ "address": {
+ "city": null,
+ "country": null,
+ "line1": null,
+ "line2": null,
+ "postal_code": null,
+ "state": null
+ },
+ "email": null,
+ "name": null,
+ "phone": null
+ },
+ "card": {
+ "brand": "visa",
+ "checks": {
+ "address_line1_check": null,
+ "address_postal_code_check": null,
+ "cvc_check": "pass"
+ },
+ "country": "US",
+ "exp_month": 1,
+ "exp_year": 2025,
+ "fingerprint": "9XKsMixKBi6kIIzd",
+ "funding": "credit",
+ "generated_from": null,
+ "last4": "4242",
+ "networks": {
+ "available": [
+ "visa"
+ ],
+ "preferred": null
+ },
+ "three_d_secure_usage": {
+ "supported": true
+ },
+ "wallet": null
+ },
+ "created": 1704972530,
+ "customer": "cus_PM4axrAbUxZIzJ",
+ "id": "pm_1OXMRKDEQaroqDjsjvn2UVaa",
+ "livemode": false,
+ "metadata": {},
+ "object": "payment_method",
+ "type": "card"
+ },
+ "footer": null,
+ "rendering_options": null
+ },
+ "livemode": false,
+ "metadata": {
+ "remote_server_str": "demo.example.com 6cde5f7a-1f7",
+ "remote_server_uuid": "6cde5f7a-1f7e-4978-9716-49f69ebfc9fe"
+ },
+ "name": null,
+ "next_invoice_sequence": 1,
+ "object": "customer",
+ "phone": null,
+ "preferred_locales": [],
+ "shipping": null,
+ "tax_exempt": "none",
+ "test_clock": null
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--Customer.retrieve.2.json b/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--Customer.retrieve.2.json
new file mode 100644
index 00000000000..ad7b096a0f1
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--Customer.retrieve.2.json
@@ -0,0 +1,79 @@
+{
+ "address": null,
+ "balance": 0,
+ "created": 1704972529,
+ "currency": null,
+ "default_currency": null,
+ "default_source": null,
+ "delinquent": false,
+ "description": "demo.example.com 6cde5f7a-1f7",
+ "discount": null,
+ "email": "[email protected]",
+ "id": "cus_PM4axrAbUxZIzJ",
+ "invoice_prefix": "5A968AD5",
+ "invoice_settings": {
+ "custom_fields": null,
+ "default_payment_method": {
+ "billing_details": {
+ "address": {
+ "city": null,
+ "country": null,
+ "line1": null,
+ "line2": null,
+ "postal_code": null,
+ "state": null
+ },
+ "email": null,
+ "name": null,
+ "phone": null
+ },
+ "card": {
+ "brand": "visa",
+ "checks": {
+ "address_line1_check": null,
+ "address_postal_code_check": null,
+ "cvc_check": "pass"
+ },
+ "country": "US",
+ "exp_month": 1,
+ "exp_year": 2025,
+ "fingerprint": "9XKsMixKBi6kIIzd",
+ "funding": "credit",
+ "generated_from": null,
+ "last4": "4242",
+ "networks": {
+ "available": [
+ "visa"
+ ],
+ "preferred": null
+ },
+ "three_d_secure_usage": {
+ "supported": true
+ },
+ "wallet": null
+ },
+ "created": 1704972530,
+ "customer": "cus_PM4axrAbUxZIzJ",
+ "id": "pm_1OXMRKDEQaroqDjsjvn2UVaa",
+ "livemode": false,
+ "metadata": {},
+ "object": "payment_method",
+ "type": "card"
+ },
+ "footer": null,
+ "rendering_options": null
+ },
+ "livemode": false,
+ "metadata": {
+ "remote_server_str": "demo.example.com 6cde5f7a-1f7",
+ "remote_server_uuid": "6cde5f7a-1f7e-4978-9716-49f69ebfc9fe"
+ },
+ "name": null,
+ "next_invoice_sequence": 1,
+ "object": "customer",
+ "phone": null,
+ "preferred_locales": [],
+ "shipping": null,
+ "tax_exempt": "none",
+ "test_clock": null
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--Customer.retrieve.3.json b/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--Customer.retrieve.3.json
new file mode 100644
index 00000000000..ad7b096a0f1
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--Customer.retrieve.3.json
@@ -0,0 +1,79 @@
+{
+ "address": null,
+ "balance": 0,
+ "created": 1704972529,
+ "currency": null,
+ "default_currency": null,
+ "default_source": null,
+ "delinquent": false,
+ "description": "demo.example.com 6cde5f7a-1f7",
+ "discount": null,
+ "email": "[email protected]",
+ "id": "cus_PM4axrAbUxZIzJ",
+ "invoice_prefix": "5A968AD5",
+ "invoice_settings": {
+ "custom_fields": null,
+ "default_payment_method": {
+ "billing_details": {
+ "address": {
+ "city": null,
+ "country": null,
+ "line1": null,
+ "line2": null,
+ "postal_code": null,
+ "state": null
+ },
+ "email": null,
+ "name": null,
+ "phone": null
+ },
+ "card": {
+ "brand": "visa",
+ "checks": {
+ "address_line1_check": null,
+ "address_postal_code_check": null,
+ "cvc_check": "pass"
+ },
+ "country": "US",
+ "exp_month": 1,
+ "exp_year": 2025,
+ "fingerprint": "9XKsMixKBi6kIIzd",
+ "funding": "credit",
+ "generated_from": null,
+ "last4": "4242",
+ "networks": {
+ "available": [
+ "visa"
+ ],
+ "preferred": null
+ },
+ "three_d_secure_usage": {
+ "supported": true
+ },
+ "wallet": null
+ },
+ "created": 1704972530,
+ "customer": "cus_PM4axrAbUxZIzJ",
+ "id": "pm_1OXMRKDEQaroqDjsjvn2UVaa",
+ "livemode": false,
+ "metadata": {},
+ "object": "payment_method",
+ "type": "card"
+ },
+ "footer": null,
+ "rendering_options": null
+ },
+ "livemode": false,
+ "metadata": {
+ "remote_server_str": "demo.example.com 6cde5f7a-1f7",
+ "remote_server_uuid": "6cde5f7a-1f7e-4978-9716-49f69ebfc9fe"
+ },
+ "name": null,
+ "next_invoice_sequence": 1,
+ "object": "customer",
+ "phone": null,
+ "preferred_locales": [],
+ "shipping": null,
+ "tax_exempt": "none",
+ "test_clock": null
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--Customer.retrieve.4.json b/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--Customer.retrieve.4.json
new file mode 100644
index 00000000000..ad7b096a0f1
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--Customer.retrieve.4.json
@@ -0,0 +1,79 @@
+{
+ "address": null,
+ "balance": 0,
+ "created": 1704972529,
+ "currency": null,
+ "default_currency": null,
+ "default_source": null,
+ "delinquent": false,
+ "description": "demo.example.com 6cde5f7a-1f7",
+ "discount": null,
+ "email": "[email protected]",
+ "id": "cus_PM4axrAbUxZIzJ",
+ "invoice_prefix": "5A968AD5",
+ "invoice_settings": {
+ "custom_fields": null,
+ "default_payment_method": {
+ "billing_details": {
+ "address": {
+ "city": null,
+ "country": null,
+ "line1": null,
+ "line2": null,
+ "postal_code": null,
+ "state": null
+ },
+ "email": null,
+ "name": null,
+ "phone": null
+ },
+ "card": {
+ "brand": "visa",
+ "checks": {
+ "address_line1_check": null,
+ "address_postal_code_check": null,
+ "cvc_check": "pass"
+ },
+ "country": "US",
+ "exp_month": 1,
+ "exp_year": 2025,
+ "fingerprint": "9XKsMixKBi6kIIzd",
+ "funding": "credit",
+ "generated_from": null,
+ "last4": "4242",
+ "networks": {
+ "available": [
+ "visa"
+ ],
+ "preferred": null
+ },
+ "three_d_secure_usage": {
+ "supported": true
+ },
+ "wallet": null
+ },
+ "created": 1704972530,
+ "customer": "cus_PM4axrAbUxZIzJ",
+ "id": "pm_1OXMRKDEQaroqDjsjvn2UVaa",
+ "livemode": false,
+ "metadata": {},
+ "object": "payment_method",
+ "type": "card"
+ },
+ "footer": null,
+ "rendering_options": null
+ },
+ "livemode": false,
+ "metadata": {
+ "remote_server_str": "demo.example.com 6cde5f7a-1f7",
+ "remote_server_uuid": "6cde5f7a-1f7e-4978-9716-49f69ebfc9fe"
+ },
+ "name": null,
+ "next_invoice_sequence": 1,
+ "object": "customer",
+ "phone": null,
+ "preferred_locales": [],
+ "shipping": null,
+ "tax_exempt": "none",
+ "test_clock": null
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--Event.list.1.json b/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--Event.list.1.json
new file mode 100644
index 00000000000..9e933033df9
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--Event.list.1.json
@@ -0,0 +1,60 @@
+{
+ "data": [
+ {
+ "api_version": "2020-08-27",
+ "created": 1704972533,
+ "data": {
+ "object": {
+ "address": null,
+ "balance": 0,
+ "created": 1704972529,
+ "currency": null,
+ "default_currency": null,
+ "default_source": null,
+ "delinquent": false,
+ "description": "demo.example.com 6cde5f7a-1f7",
+ "discount": null,
+ "email": "[email protected]",
+ "id": "cus_PM4axrAbUxZIzJ",
+ "invoice_prefix": "5A968AD5",
+ "invoice_settings": {
+ "custom_fields": null,
+ "default_payment_method": "pm_1OXMRKDEQaroqDjsjvn2UVaa",
+ "footer": null,
+ "rendering_options": null
+ },
+ "livemode": false,
+ "metadata": {
+ "remote_server_str": "demo.example.com 6cde5f7a-1f7",
+ "remote_server_uuid": "6cde5f7a-1f7e-4978-9716-49f69ebfc9fe"
+ },
+ "name": null,
+ "next_invoice_sequence": 1,
+ "object": "customer",
+ "phone": null,
+ "preferred_locales": [],
+ "shipping": null,
+ "tax_exempt": "none",
+ "test_clock": null
+ },
+ "previous_attributes": {
+ "invoice_settings": {
+ "default_payment_method": null
+ }
+ }
+ },
+ "id": "evt_1OXMRNDEQaroqDjspS7tadlp",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_0Gytbn9jcS60AC",
+ "idempotency_key": "f54efee0-fd34-410d-92c8-4bb77e63aa06"
+ },
+ "type": "customer.updated"
+ }
+ ],
+ "has_more": true,
+ "object": "list",
+ "url": "/v1/events"
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--Event.list.2.json b/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--Event.list.2.json
new file mode 100644
index 00000000000..a30985a4fe4
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--Event.list.2.json
@@ -0,0 +1,447 @@
+{
+ "data": [
+ {
+ "api_version": "2020-08-27",
+ "created": 1704972537,
+ "data": {
+ "object": {
+ "amount": 4300,
+ "amount_capturable": 0,
+ "amount_details": {
+ "tip": {}
+ },
+ "amount_received": 4300,
+ "application": null,
+ "application_fee_amount": null,
+ "automatic_payment_methods": null,
+ "canceled_at": null,
+ "cancellation_reason": null,
+ "capture_method": "automatic",
+ "charges": {
+ "data": [
+ {
+ "amount": 4300,
+ "amount_captured": 4300,
+ "amount_refunded": 0,
+ "application": null,
+ "application_fee": null,
+ "application_fee_amount": null,
+ "balance_transaction": "txn_3OXMRQDEQaroqDjs0UUHVK0U",
+ "billing_details": {
+ "address": {
+ "city": null,
+ "country": null,
+ "line1": null,
+ "line2": null,
+ "postal_code": null,
+ "state": null
+ },
+ "email": null,
+ "name": null,
+ "phone": null
+ },
+ "calculated_statement_descriptor": "ZULIP BASIC",
+ "captured": true,
+ "created": 1704972536,
+ "currency": "usd",
+ "customer": "cus_PM4axrAbUxZIzJ",
+ "description": "Upgrade to Zulip Basic, $3.5 x 18 - $20.0 x 1",
+ "destination": null,
+ "dispute": null,
+ "disputed": false,
+ "failure_balance_transaction": null,
+ "failure_code": null,
+ "failure_message": null,
+ "fraud_details": {},
+ "id": "ch_3OXMRQDEQaroqDjs0YOObWqj",
+ "invoice": null,
+ "livemode": false,
+ "metadata": {
+ "billing_modality": "charge_automatically",
+ "billing_schedule": "2",
+ "license_management": "automatic",
+ "licenses": "18",
+ "plan_tier": "103",
+ "price_per_license": "350",
+ "remote_server_host": "demo.example.com",
+ "remote_server_user_email": "[email protected]",
+ "remote_server_user_id": "1",
+ "seat_count": "18",
+ "type": "upgrade"
+ },
+ "object": "charge",
+ "on_behalf_of": null,
+ "order": null,
+ "outcome": {
+ "network_status": "approved_by_network",
+ "reason": null,
+ "risk_level": "normal",
+ "risk_score": 12,
+ "seller_message": "Payment complete.",
+ "type": "authorized"
+ },
+ "paid": true,
+ "payment_intent": "pi_3OXMRQDEQaroqDjs0j02erxK",
+ "payment_method": "pm_1OXMRKDEQaroqDjsjvn2UVaa",
+ "payment_method_details": {
+ "card": {
+ "amount_authorized": 4300,
+ "brand": "visa",
+ "checks": {
+ "address_line1_check": null,
+ "address_postal_code_check": null,
+ "cvc_check": "pass"
+ },
+ "country": "US",
+ "exp_month": 1,
+ "exp_year": 2025,
+ "extended_authorization": {
+ "status": "disabled"
+ },
+ "fingerprint": "9XKsMixKBi6kIIzd",
+ "funding": "credit",
+ "incremental_authorization": {
+ "status": "unavailable"
+ },
+ "installments": null,
+ "last4": "4242",
+ "mandate": null,
+ "multicapture": {
+ "status": "unavailable"
+ },
+ "network": "visa",
+ "network_token": {
+ "used": false
+ },
+ "overcapture": {
+ "maximum_amount_capturable": 4300,
+ "status": "unavailable"
+ },
+ "three_d_secure": null,
+ "wallet": null
+ },
+ "type": "card"
+ },
+ "radar_options": {},
+ "receipt_email": "[email protected]",
+ "receipt_number": null,
+ "receipt_url": "https://pay.stripe.com/receipts/payment/CAcaFwoVYWNjdF8xN3ZUa3dERVFhcm9xRGpzKPmh_6wGMgZAzTNsuRM6LBYToG62rkp_hIjfztkxvtVfSdu31a_9FEOpyrds8u2dfweay8ezepZXg3nw",
+ "refunded": false,
+ "refunds": {
+ "data": [],
+ "has_more": false,
+ "object": "list",
+ "total_count": 0,
+ "url": "/v1/charges/ch_3OXMRQDEQaroqDjs0YOObWqj/refunds"
+ },
+ "review": null,
+ "shipping": null,
+ "source": null,
+ "source_transfer": null,
+ "statement_descriptor": "Zulip Basic",
+ "statement_descriptor_suffix": null,
+ "status": "succeeded",
+ "transfer_data": null,
+ "transfer_group": null
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 1,
+ "url": "/v1/charges?payment_intent=pi_3OXMRQDEQaroqDjs0j02erxK"
+ },
+ "client_secret": "pi_3OXMRQDEQaroqDjs0j02erxK_secret_bHmEex79mvWuoQNIcMMmZPgm7",
+ "confirmation_method": "automatic",
+ "created": 1704972536,
+ "currency": "usd",
+ "customer": "cus_PM4axrAbUxZIzJ",
+ "description": "Upgrade to Zulip Basic, $3.5 x 18 - $20.0 x 1",
+ "id": "pi_3OXMRQDEQaroqDjs0j02erxK",
+ "invoice": null,
+ "last_payment_error": null,
+ "latest_charge": "ch_3OXMRQDEQaroqDjs0YOObWqj",
+ "livemode": false,
+ "metadata": {
+ "billing_modality": "charge_automatically",
+ "billing_schedule": "2",
+ "license_management": "automatic",
+ "licenses": "18",
+ "plan_tier": "103",
+ "price_per_license": "350",
+ "remote_server_host": "demo.example.com",
+ "remote_server_user_email": "[email protected]",
+ "remote_server_user_id": "1",
+ "seat_count": "18",
+ "type": "upgrade"
+ },
+ "next_action": null,
+ "object": "payment_intent",
+ "on_behalf_of": null,
+ "payment_method": "pm_1OXMRKDEQaroqDjsjvn2UVaa",
+ "payment_method_configuration_details": null,
+ "payment_method_options": {
+ "card": {
+ "installments": null,
+ "mandate_options": null,
+ "network": null,
+ "request_three_d_secure": "automatic"
+ }
+ },
+ "payment_method_types": [
+ "card"
+ ],
+ "processing": null,
+ "receipt_email": "[email protected]",
+ "review": null,
+ "setup_future_usage": null,
+ "shipping": null,
+ "source": null,
+ "statement_descriptor": "Zulip Basic",
+ "statement_descriptor_suffix": null,
+ "status": "succeeded",
+ "transfer_data": null,
+ "transfer_group": null
+ }
+ },
+ "id": "evt_3OXMRQDEQaroqDjs0fcs2yHm",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 2,
+ "request": {
+ "id": "req_cQOe0NmY30kvMv",
+ "idempotency_key": "0d8953a0-6b3c-4946-8951-6cf9e7589f9f"
+ },
+ "type": "payment_intent.succeeded"
+ },
+ {
+ "api_version": "2020-08-27",
+ "created": 1704972536,
+ "data": {
+ "object": {
+ "amount": 4300,
+ "amount_captured": 4300,
+ "amount_refunded": 0,
+ "application": null,
+ "application_fee": null,
+ "application_fee_amount": null,
+ "balance_transaction": "txn_3OXMRQDEQaroqDjs0UUHVK0U",
+ "billing_details": {
+ "address": {
+ "city": null,
+ "country": null,
+ "line1": null,
+ "line2": null,
+ "postal_code": null,
+ "state": null
+ },
+ "email": null,
+ "name": null,
+ "phone": null
+ },
+ "calculated_statement_descriptor": "ZULIP BASIC",
+ "captured": true,
+ "created": 1704972536,
+ "currency": "usd",
+ "customer": "cus_PM4axrAbUxZIzJ",
+ "description": "Upgrade to Zulip Basic, $3.5 x 18 - $20.0 x 1",
+ "destination": null,
+ "dispute": null,
+ "disputed": false,
+ "failure_balance_transaction": null,
+ "failure_code": null,
+ "failure_message": null,
+ "fraud_details": {},
+ "id": "ch_3OXMRQDEQaroqDjs0YOObWqj",
+ "invoice": null,
+ "livemode": false,
+ "metadata": {
+ "billing_modality": "charge_automatically",
+ "billing_schedule": "2",
+ "license_management": "automatic",
+ "licenses": "18",
+ "plan_tier": "103",
+ "price_per_license": "350",
+ "remote_server_host": "demo.example.com",
+ "remote_server_user_email": "[email protected]",
+ "remote_server_user_id": "1",
+ "seat_count": "18",
+ "type": "upgrade"
+ },
+ "object": "charge",
+ "on_behalf_of": null,
+ "order": null,
+ "outcome": {
+ "network_status": "approved_by_network",
+ "reason": null,
+ "risk_level": "normal",
+ "risk_score": 12,
+ "seller_message": "Payment complete.",
+ "type": "authorized"
+ },
+ "paid": true,
+ "payment_intent": "pi_3OXMRQDEQaroqDjs0j02erxK",
+ "payment_method": "pm_1OXMRKDEQaroqDjsjvn2UVaa",
+ "payment_method_details": {
+ "card": {
+ "amount_authorized": 4300,
+ "brand": "visa",
+ "checks": {
+ "address_line1_check": null,
+ "address_postal_code_check": null,
+ "cvc_check": "pass"
+ },
+ "country": "US",
+ "exp_month": 1,
+ "exp_year": 2025,
+ "extended_authorization": {
+ "status": "disabled"
+ },
+ "fingerprint": "9XKsMixKBi6kIIzd",
+ "funding": "credit",
+ "incremental_authorization": {
+ "status": "unavailable"
+ },
+ "installments": null,
+ "last4": "4242",
+ "mandate": null,
+ "multicapture": {
+ "status": "unavailable"
+ },
+ "network": "visa",
+ "network_token": {
+ "used": false
+ },
+ "overcapture": {
+ "maximum_amount_capturable": 4300,
+ "status": "unavailable"
+ },
+ "three_d_secure": null,
+ "wallet": null
+ },
+ "type": "card"
+ },
+ "radar_options": {},
+ "receipt_email": "[email protected]",
+ "receipt_number": null,
+ "receipt_url": "https://pay.stripe.com/receipts/payment/CAcaFwoVYWNjdF8xN3ZUa3dERVFhcm9xRGpzKPmh_6wGMgawXHoLgP86LBaxSoGjHuuia9i1nk-PaNBECICLdjcnH8T2U9DW6F3ppK6UK1kR7v4npwpu",
+ "refunded": false,
+ "refunds": {
+ "data": [],
+ "has_more": false,
+ "object": "list",
+ "total_count": 0,
+ "url": "/v1/charges/ch_3OXMRQDEQaroqDjs0YOObWqj/refunds"
+ },
+ "review": null,
+ "shipping": null,
+ "source": null,
+ "source_transfer": null,
+ "statement_descriptor": "Zulip Basic",
+ "statement_descriptor_suffix": null,
+ "status": "succeeded",
+ "transfer_data": null,
+ "transfer_group": null
+ }
+ },
+ "id": "evt_3OXMRQDEQaroqDjs0Op7vXYn",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_cQOe0NmY30kvMv",
+ "idempotency_key": "0d8953a0-6b3c-4946-8951-6cf9e7589f9f"
+ },
+ "type": "charge.succeeded"
+ },
+ {
+ "api_version": "2020-08-27",
+ "created": 1704972536,
+ "data": {
+ "object": {
+ "amount": 4300,
+ "amount_capturable": 0,
+ "amount_details": {
+ "tip": {}
+ },
+ "amount_received": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "automatic_payment_methods": null,
+ "canceled_at": null,
+ "cancellation_reason": null,
+ "capture_method": "automatic",
+ "charges": {
+ "data": [],
+ "has_more": false,
+ "object": "list",
+ "total_count": 0,
+ "url": "/v1/charges?payment_intent=pi_3OXMRQDEQaroqDjs0j02erxK"
+ },
+ "client_secret": "pi_3OXMRQDEQaroqDjs0j02erxK_secret_bHmEex79mvWuoQNIcMMmZPgm7",
+ "confirmation_method": "automatic",
+ "created": 1704972536,
+ "currency": "usd",
+ "customer": "cus_PM4axrAbUxZIzJ",
+ "description": "Upgrade to Zulip Basic, $3.5 x 18 - $20.0 x 1",
+ "id": "pi_3OXMRQDEQaroqDjs0j02erxK",
+ "invoice": null,
+ "last_payment_error": null,
+ "latest_charge": null,
+ "livemode": false,
+ "metadata": {
+ "billing_modality": "charge_automatically",
+ "billing_schedule": "2",
+ "license_management": "automatic",
+ "licenses": "18",
+ "plan_tier": "103",
+ "price_per_license": "350",
+ "remote_server_host": "demo.example.com",
+ "remote_server_user_email": "[email protected]",
+ "remote_server_user_id": "1",
+ "seat_count": "18",
+ "type": "upgrade"
+ },
+ "next_action": null,
+ "object": "payment_intent",
+ "on_behalf_of": null,
+ "payment_method": null,
+ "payment_method_configuration_details": null,
+ "payment_method_options": {
+ "card": {
+ "installments": null,
+ "mandate_options": null,
+ "network": null,
+ "request_three_d_secure": "automatic"
+ }
+ },
+ "payment_method_types": [
+ "card"
+ ],
+ "processing": null,
+ "receipt_email": "[email protected]",
+ "review": null,
+ "setup_future_usage": null,
+ "shipping": null,
+ "source": null,
+ "statement_descriptor": "Zulip Basic",
+ "statement_descriptor_suffix": null,
+ "status": "requires_payment_method",
+ "transfer_data": null,
+ "transfer_group": null
+ }
+ },
+ "id": "evt_3OXMRQDEQaroqDjs0kGfVVIz",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 2,
+ "request": {
+ "id": "req_cQOe0NmY30kvMv",
+ "idempotency_key": "0d8953a0-6b3c-4946-8951-6cf9e7589f9f"
+ },
+ "type": "payment_intent.created"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "url": "/v1/events"
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--Event.list.3.json b/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--Event.list.3.json
new file mode 100644
index 00000000000..9477f1675fa
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--Event.list.3.json
@@ -0,0 +1,812 @@
+{
+ "data": [
+ {
+ "api_version": "2020-08-27",
+ "created": 1704972540,
+ "data": {
+ "object": {
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 0,
+ "amount_paid": 0,
+ "amount_remaining": 0,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 0,
+ "attempted": true,
+ "auto_advance": false,
+ "automatic_tax": {
+ "enabled": false,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": null,
+ "collection_method": "charge_automatically",
+ "created": 1704972539,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_PM4axrAbUxZIzJ",
+ "customer_address": null,
+ "customer_email": "[email protected]",
+ "customer_name": null,
+ "customer_phone": null,
+ "customer_shipping": null,
+ "customer_tax_exempt": "none",
+ "customer_tax_ids": [],
+ "default_payment_method": null,
+ "default_source": null,
+ "default_tax_rates": [],
+ "description": null,
+ "discount": null,
+ "discounts": [],
+ "due_date": null,
+ "effective_at": 1704972539,
+ "ending_balance": 0,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QTTRhVXZXNHVNYVVadTRHOW91RmxpTWl5bXhxa2ZyLDk1NTEzMzQw0200A30lrhuK?s=ap",
+ "id": "in_1OXMRTDEQaroqDjsGB5Pozqg",
+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QTTRhVXZXNHVNYVVadTRHOW91RmxpTWl5bXhxa2ZyLDk1NTEzMzQw0200A30lrhuK/pdf?s=ap",
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": -2000,
+ "amount_excluding_tax": -2000,
+ "currency": "usd",
+ "description": "$20.00/month new customer discount",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1OXMRSDEQaroqDjsug3jsZ86",
+ "invoice_item": "ii_1OXMRSDEQaroqDjsiXyUzMLH",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1704972538,
+ "start": 1704972538
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1704886320,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OX00qDEQaroqDjst0aTUdZR",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PLhPbuhP0lDy6A",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -2000,
+ "unit_amount_decimal": "-2000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-2000"
+ },
+ {
+ "amount": 6300,
+ "amount_excluding_tax": 6300,
+ "currency": "usd",
+ "description": "Zulip Basic",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1OXMRTDEQaroqDjstiHtmtz0",
+ "invoice_item": "ii_1OXMRSDEQaroqDjscum9ewHk",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1328151845,
+ "start": 1325473445
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1702995208,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OP432DEQaroqDjsMeew3eg5",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PDUwJ9ZgTQzjad",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 350,
+ "unit_amount_decimal": "350"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 18,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "350"
+ },
+ {
+ "amount": -4300,
+ "amount_excluding_tax": -4300,
+ "currency": "usd",
+ "description": "Payment (Card ending in 4242)",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1OXMRUDEQaroqDjsze12Eai9",
+ "invoice_item": "ii_1OXMRSDEQaroqDjsmt1N1lQK",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1704972538,
+ "start": 1704972538
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1703050283,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OPINLDEQaroqDjs4mroUNpu",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_OvY3hKgN66WIeP",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -4300,
+ "unit_amount_decimal": "-4300"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-4300"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 3,
+ "url": "/v1/invoices/in_1OXMRTDEQaroqDjsGB5Pozqg/lines"
+ },
+ "livemode": false,
+ "metadata": {},
+ "next_payment_attempt": null,
+ "number": "5A968AD5-0001",
+ "object": "invoice",
+ "on_behalf_of": null,
+ "paid": true,
+ "paid_out_of_band": false,
+ "payment_intent": null,
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1704972539,
+ "period_start": 1704972539,
+ "post_payment_credit_notes_amount": 0,
+ "pre_payment_credit_notes_amount": 0,
+ "quote": null,
+ "receipt_number": null,
+ "rendering": {
+ "amount_tax_display": null,
+ "pdf": {
+ "page_size": "letter"
+ }
+ },
+ "rendering_options": null,
+ "shipping_cost": null,
+ "shipping_details": null,
+ "starting_balance": 0,
+ "statement_descriptor": "Zulip Basic",
+ "status": "paid",
+ "status_transitions": {
+ "finalized_at": 1704972539,
+ "marked_uncollectible_at": null,
+ "paid_at": 1704972539,
+ "voided_at": null
+ },
+ "subscription": null,
+ "subscription_details": {
+ "metadata": null
+ },
+ "subtotal": 0,
+ "subtotal_excluding_tax": 0,
+ "tax": null,
+ "test_clock": null,
+ "total": 0,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 0,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": 1704972539
+ },
+ "previous_attributes": {
+ "attempted": false,
+ "auto_advance": true,
+ "effective_at": null,
+ "ending_balance": null,
+ "hosted_invoice_url": null,
+ "invoice_pdf": null,
+ "next_payment_attempt": 1704976139,
+ "number": null,
+ "paid": false,
+ "rendering": {
+ "pdf": {
+ "page_size": "auto"
+ }
+ },
+ "status": "draft",
+ "status_transitions": {
+ "finalized_at": null,
+ "paid_at": null
+ }
+ }
+ },
+ "id": "evt_1OXMRUDEQaroqDjsaiZuNTon",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 2,
+ "request": {
+ "id": "req_FJ140Bl3jrVUAG",
+ "idempotency_key": "898247be-6c62-48fa-8e9a-b78333e15c91"
+ },
+ "type": "invoice.updated"
+ },
+ {
+ "api_version": "2020-08-27",
+ "created": 1704972539,
+ "data": {
+ "object": {
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 0,
+ "amount_paid": 0,
+ "amount_remaining": 0,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 0,
+ "attempted": false,
+ "auto_advance": true,
+ "automatic_tax": {
+ "enabled": false,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": null,
+ "collection_method": "charge_automatically",
+ "created": 1704972539,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_PM4axrAbUxZIzJ",
+ "customer_address": null,
+ "customer_email": "[email protected]",
+ "customer_name": null,
+ "customer_phone": null,
+ "customer_shipping": null,
+ "customer_tax_exempt": "none",
+ "customer_tax_ids": [],
+ "default_payment_method": null,
+ "default_source": null,
+ "default_tax_rates": [],
+ "description": null,
+ "discount": null,
+ "discounts": [],
+ "due_date": null,
+ "effective_at": null,
+ "ending_balance": null,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": null,
+ "id": "in_1OXMRTDEQaroqDjsGB5Pozqg",
+ "invoice_pdf": null,
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": -2000,
+ "amount_excluding_tax": -2000,
+ "currency": "usd",
+ "description": "$20.00/month new customer discount",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1OXMRSDEQaroqDjsug3jsZ86",
+ "invoice_item": "ii_1OXMRSDEQaroqDjsiXyUzMLH",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1704972538,
+ "start": 1704972538
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1704886320,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OX00qDEQaroqDjst0aTUdZR",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PLhPbuhP0lDy6A",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -2000,
+ "unit_amount_decimal": "-2000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-2000"
+ },
+ {
+ "amount": 6300,
+ "amount_excluding_tax": 6300,
+ "currency": "usd",
+ "description": "Zulip Basic",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1OXMRTDEQaroqDjstiHtmtz0",
+ "invoice_item": "ii_1OXMRSDEQaroqDjscum9ewHk",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1328151845,
+ "start": 1325473445
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1702995208,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OP432DEQaroqDjsMeew3eg5",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PDUwJ9ZgTQzjad",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 350,
+ "unit_amount_decimal": "350"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 18,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "350"
+ },
+ {
+ "amount": -4300,
+ "amount_excluding_tax": -4300,
+ "currency": "usd",
+ "description": "Payment (Card ending in 4242)",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1OXMRUDEQaroqDjsze12Eai9",
+ "invoice_item": "ii_1OXMRSDEQaroqDjsmt1N1lQK",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1704972538,
+ "start": 1704972538
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1703050283,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OPINLDEQaroqDjs4mroUNpu",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_OvY3hKgN66WIeP",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -4300,
+ "unit_amount_decimal": "-4300"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-4300"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 3,
+ "url": "/v1/invoices/in_1OXMRTDEQaroqDjsGB5Pozqg/lines"
+ },
+ "livemode": false,
+ "metadata": {},
+ "next_payment_attempt": 1704976139,
+ "number": null,
+ "object": "invoice",
+ "on_behalf_of": null,
+ "paid": false,
+ "paid_out_of_band": false,
+ "payment_intent": null,
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1704972539,
+ "period_start": 1704972539,
+ "post_payment_credit_notes_amount": 0,
+ "pre_payment_credit_notes_amount": 0,
+ "quote": null,
+ "receipt_number": null,
+ "rendering": {
+ "amount_tax_display": null,
+ "pdf": {
+ "page_size": "auto"
+ }
+ },
+ "rendering_options": null,
+ "shipping_cost": null,
+ "shipping_details": null,
+ "starting_balance": 0,
+ "statement_descriptor": "Zulip Basic",
+ "status": "draft",
+ "status_transitions": {
+ "finalized_at": null,
+ "marked_uncollectible_at": null,
+ "paid_at": null,
+ "voided_at": null
+ },
+ "subscription": null,
+ "subscription_details": {
+ "metadata": null
+ },
+ "subtotal": 0,
+ "subtotal_excluding_tax": 0,
+ "tax": null,
+ "test_clock": null,
+ "total": 0,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 0,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": null
+ }
+ },
+ "id": "evt_1OXMRTDEQaroqDjsvscc0BCl",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_XsDXB1b8XPfCoV",
+ "idempotency_key": "024fe642-2fbe-4e36-ac50-3c2bb648a2cf"
+ },
+ "type": "invoice.created"
+ },
+ {
+ "api_version": "2020-08-27",
+ "created": 1704972538,
+ "data": {
+ "object": {
+ "amount": -2000,
+ "currency": "usd",
+ "customer": "cus_PM4axrAbUxZIzJ",
+ "date": 1704972538,
+ "description": "$20.00/month new customer discount",
+ "discountable": false,
+ "discounts": [],
+ "id": "ii_1OXMRSDEQaroqDjsiXyUzMLH",
+ "invoice": null,
+ "livemode": false,
+ "metadata": {},
+ "object": "invoiceitem",
+ "period": {
+ "end": 1704972538,
+ "start": 1704972538
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1704886320,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OX00qDEQaroqDjst0aTUdZR",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PLhPbuhP0lDy6A",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -2000,
+ "unit_amount_decimal": "-2000"
+ },
+ "proration": false,
+ "quantity": 1,
+ "subscription": null,
+ "tax_rates": [],
+ "test_clock": null,
+ "unit_amount": -2000,
+ "unit_amount_decimal": "-2000"
+ }
+ },
+ "id": "evt_1OXMRTDEQaroqDjsZIOakOw3",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_Lbt24d6S5mF1tW",
+ "idempotency_key": "07e9d243-6c6a-4867-a981-135ca4d0fa3d"
+ },
+ "type": "invoiceitem.created"
+ },
+ {
+ "api_version": "2020-08-27",
+ "created": 1704972538,
+ "data": {
+ "object": {
+ "amount": 6300,
+ "currency": "usd",
+ "customer": "cus_PM4axrAbUxZIzJ",
+ "date": 1704972538,
+ "description": "Zulip Basic",
+ "discountable": false,
+ "discounts": [],
+ "id": "ii_1OXMRSDEQaroqDjscum9ewHk",
+ "invoice": null,
+ "livemode": false,
+ "metadata": {},
+ "object": "invoiceitem",
+ "period": {
+ "end": 1328151845,
+ "start": 1325473445
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1702995208,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OP432DEQaroqDjsMeew3eg5",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PDUwJ9ZgTQzjad",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 350,
+ "unit_amount_decimal": "350"
+ },
+ "proration": false,
+ "quantity": 18,
+ "subscription": null,
+ "tax_rates": [],
+ "test_clock": null,
+ "unit_amount": 350,
+ "unit_amount_decimal": "350"
+ }
+ },
+ "id": "evt_1OXMRSDEQaroqDjsofv05fdi",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_5JS5ffInjq1Tao",
+ "idempotency_key": "1e499588-c0bf-4afd-92b2-9ef3cb0ab214"
+ },
+ "type": "invoiceitem.created"
+ },
+ {
+ "api_version": "2020-08-27",
+ "created": 1704972538,
+ "data": {
+ "object": {
+ "amount": -4300,
+ "currency": "usd",
+ "customer": "cus_PM4axrAbUxZIzJ",
+ "date": 1704972538,
+ "description": "Payment (Card ending in 4242)",
+ "discountable": false,
+ "discounts": [],
+ "id": "ii_1OXMRSDEQaroqDjsmt1N1lQK",
+ "invoice": null,
+ "livemode": false,
+ "metadata": {},
+ "object": "invoiceitem",
+ "period": {
+ "end": 1704972538,
+ "start": 1704972538
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1703050283,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OPINLDEQaroqDjs4mroUNpu",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_OvY3hKgN66WIeP",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -4300,
+ "unit_amount_decimal": "-4300"
+ },
+ "proration": false,
+ "quantity": 1,
+ "subscription": null,
+ "tax_rates": [],
+ "test_clock": null,
+ "unit_amount": -4300,
+ "unit_amount_decimal": "-4300"
+ }
+ },
+ "id": "evt_1OXMRSDEQaroqDjslw0rcXZ9",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_gchOOYmHb5koPD",
+ "idempotency_key": "39fcdd50-feb3-4f35-b425-2fbe14acbd76"
+ },
+ "type": "invoiceitem.created"
+ },
+ {
+ "api_version": "2020-08-27",
+ "created": 1704972538,
+ "data": {
+ "object": {
+ "address": null,
+ "balance": 0,
+ "created": 1704972529,
+ "currency": "usd",
+ "default_currency": "usd",
+ "default_source": null,
+ "delinquent": false,
+ "description": "demo.example.com 6cde5f7a-1f7",
+ "discount": null,
+ "email": "[email protected]",
+ "id": "cus_PM4axrAbUxZIzJ",
+ "invoice_prefix": "5A968AD5",
+ "invoice_settings": {
+ "custom_fields": null,
+ "default_payment_method": "pm_1OXMRKDEQaroqDjsjvn2UVaa",
+ "footer": null,
+ "rendering_options": null
+ },
+ "livemode": false,
+ "metadata": {
+ "remote_server_str": "demo.example.com 6cde5f7a-1f7",
+ "remote_server_uuid": "6cde5f7a-1f7e-4978-9716-49f69ebfc9fe"
+ },
+ "name": null,
+ "next_invoice_sequence": 1,
+ "object": "customer",
+ "phone": null,
+ "preferred_locales": [],
+ "shipping": null,
+ "tax_exempt": "none",
+ "test_clock": null
+ },
+ "previous_attributes": {
+ "currency": null,
+ "default_currency": null
+ }
+ },
+ "id": "evt_1OXMRSDEQaroqDjsDR0vnWUA",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_gchOOYmHb5koPD",
+ "idempotency_key": "39fcdd50-feb3-4f35-b425-2fbe14acbd76"
+ },
+ "type": "customer.updated"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "url": "/v1/events"
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--Event.list.4.json b/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--Event.list.4.json
new file mode 100644
index 00000000000..3d46e7c9e08
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--Event.list.4.json
@@ -0,0 +1,553 @@
+{
+ "data": [
+ {
+ "api_version": "2020-08-27",
+ "created": 1704972540,
+ "data": {
+ "object": {
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 0,
+ "amount_paid": 0,
+ "amount_remaining": 0,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 0,
+ "attempted": true,
+ "auto_advance": false,
+ "automatic_tax": {
+ "enabled": false,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": null,
+ "collection_method": "charge_automatically",
+ "created": 1704972539,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_PM4axrAbUxZIzJ",
+ "customer_address": null,
+ "customer_email": "[email protected]",
+ "customer_name": null,
+ "customer_phone": null,
+ "customer_shipping": null,
+ "customer_tax_exempt": "none",
+ "customer_tax_ids": [],
+ "default_payment_method": null,
+ "default_source": null,
+ "default_tax_rates": [],
+ "description": null,
+ "discount": null,
+ "discounts": [],
+ "due_date": null,
+ "effective_at": 1704972539,
+ "ending_balance": 0,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QTTRhVXZXNHVNYVVadTRHOW91RmxpTWl5bXhxa2ZyLDk1NTEzMzQx0200VYcJ4ELz?s=ap",
+ "id": "in_1OXMRTDEQaroqDjsGB5Pozqg",
+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QTTRhVXZXNHVNYVVadTRHOW91RmxpTWl5bXhxa2ZyLDk1NTEzMzQx0200VYcJ4ELz/pdf?s=ap",
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": -2000,
+ "amount_excluding_tax": -2000,
+ "currency": "usd",
+ "description": "$20.00/month new customer discount",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1OXMRSDEQaroqDjsug3jsZ86",
+ "invoice_item": "ii_1OXMRSDEQaroqDjsiXyUzMLH",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1704972538,
+ "start": 1704972538
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1704886320,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OX00qDEQaroqDjst0aTUdZR",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PLhPbuhP0lDy6A",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -2000,
+ "unit_amount_decimal": "-2000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-2000"
+ },
+ {
+ "amount": 6300,
+ "amount_excluding_tax": 6300,
+ "currency": "usd",
+ "description": "Zulip Basic",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1OXMRTDEQaroqDjstiHtmtz0",
+ "invoice_item": "ii_1OXMRSDEQaroqDjscum9ewHk",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1328151845,
+ "start": 1325473445
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1702995208,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OP432DEQaroqDjsMeew3eg5",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PDUwJ9ZgTQzjad",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 350,
+ "unit_amount_decimal": "350"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 18,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "350"
+ },
+ {
+ "amount": -4300,
+ "amount_excluding_tax": -4300,
+ "currency": "usd",
+ "description": "Payment (Card ending in 4242)",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1OXMRUDEQaroqDjsze12Eai9",
+ "invoice_item": "ii_1OXMRSDEQaroqDjsmt1N1lQK",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1704972538,
+ "start": 1704972538
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1703050283,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OPINLDEQaroqDjs4mroUNpu",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_OvY3hKgN66WIeP",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -4300,
+ "unit_amount_decimal": "-4300"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-4300"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 3,
+ "url": "/v1/invoices/in_1OXMRTDEQaroqDjsGB5Pozqg/lines"
+ },
+ "livemode": false,
+ "metadata": {},
+ "next_payment_attempt": null,
+ "number": "5A968AD5-0001",
+ "object": "invoice",
+ "on_behalf_of": null,
+ "paid": true,
+ "paid_out_of_band": false,
+ "payment_intent": null,
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1704972539,
+ "period_start": 1704972539,
+ "post_payment_credit_notes_amount": 0,
+ "pre_payment_credit_notes_amount": 0,
+ "quote": null,
+ "receipt_number": null,
+ "rendering": {
+ "amount_tax_display": null,
+ "pdf": {
+ "page_size": "letter"
+ }
+ },
+ "rendering_options": null,
+ "shipping_cost": null,
+ "shipping_details": null,
+ "starting_balance": 0,
+ "statement_descriptor": "Zulip Basic",
+ "status": "paid",
+ "status_transitions": {
+ "finalized_at": 1704972539,
+ "marked_uncollectible_at": null,
+ "paid_at": 1704972539,
+ "voided_at": null
+ },
+ "subscription": null,
+ "subscription_details": {
+ "metadata": null
+ },
+ "subtotal": 0,
+ "subtotal_excluding_tax": 0,
+ "tax": null,
+ "test_clock": null,
+ "total": 0,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 0,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": 1704972539
+ }
+ },
+ "id": "evt_1OXMRVDEQaroqDjsFvXDhbLL",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 2,
+ "request": {
+ "id": "req_FJ140Bl3jrVUAG",
+ "idempotency_key": "898247be-6c62-48fa-8e9a-b78333e15c91"
+ },
+ "type": "invoice.paid"
+ },
+ {
+ "api_version": "2020-08-27",
+ "created": 1704972540,
+ "data": {
+ "object": {
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 0,
+ "amount_paid": 0,
+ "amount_remaining": 0,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 0,
+ "attempted": true,
+ "auto_advance": false,
+ "automatic_tax": {
+ "enabled": false,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": null,
+ "collection_method": "charge_automatically",
+ "created": 1704972539,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_PM4axrAbUxZIzJ",
+ "customer_address": null,
+ "customer_email": "[email protected]",
+ "customer_name": null,
+ "customer_phone": null,
+ "customer_shipping": null,
+ "customer_tax_exempt": "none",
+ "customer_tax_ids": [],
+ "default_payment_method": null,
+ "default_source": null,
+ "default_tax_rates": [],
+ "description": null,
+ "discount": null,
+ "discounts": [],
+ "due_date": null,
+ "effective_at": 1704972539,
+ "ending_balance": 0,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QTTRhVXZXNHVNYVVadTRHOW91RmxpTWl5bXhxa2ZyLDk1NTEzMzQw0200A30lrhuK?s=ap",
+ "id": "in_1OXMRTDEQaroqDjsGB5Pozqg",
+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QTTRhVXZXNHVNYVVadTRHOW91RmxpTWl5bXhxa2ZyLDk1NTEzMzQw0200A30lrhuK/pdf?s=ap",
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": -2000,
+ "amount_excluding_tax": -2000,
+ "currency": "usd",
+ "description": "$20.00/month new customer discount",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1OXMRSDEQaroqDjsug3jsZ86",
+ "invoice_item": "ii_1OXMRSDEQaroqDjsiXyUzMLH",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1704972538,
+ "start": 1704972538
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1704886320,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OX00qDEQaroqDjst0aTUdZR",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PLhPbuhP0lDy6A",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -2000,
+ "unit_amount_decimal": "-2000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-2000"
+ },
+ {
+ "amount": 6300,
+ "amount_excluding_tax": 6300,
+ "currency": "usd",
+ "description": "Zulip Basic",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1OXMRTDEQaroqDjstiHtmtz0",
+ "invoice_item": "ii_1OXMRSDEQaroqDjscum9ewHk",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1328151845,
+ "start": 1325473445
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1702995208,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OP432DEQaroqDjsMeew3eg5",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PDUwJ9ZgTQzjad",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 350,
+ "unit_amount_decimal": "350"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 18,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "350"
+ },
+ {
+ "amount": -4300,
+ "amount_excluding_tax": -4300,
+ "currency": "usd",
+ "description": "Payment (Card ending in 4242)",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1OXMRUDEQaroqDjsze12Eai9",
+ "invoice_item": "ii_1OXMRSDEQaroqDjsmt1N1lQK",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1704972538,
+ "start": 1704972538
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1703050283,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OPINLDEQaroqDjs4mroUNpu",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_OvY3hKgN66WIeP",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -4300,
+ "unit_amount_decimal": "-4300"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-4300"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 3,
+ "url": "/v1/invoices/in_1OXMRTDEQaroqDjsGB5Pozqg/lines"
+ },
+ "livemode": false,
+ "metadata": {},
+ "next_payment_attempt": null,
+ "number": "5A968AD5-0001",
+ "object": "invoice",
+ "on_behalf_of": null,
+ "paid": true,
+ "paid_out_of_band": false,
+ "payment_intent": null,
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1704972539,
+ "period_start": 1704972539,
+ "post_payment_credit_notes_amount": 0,
+ "pre_payment_credit_notes_amount": 0,
+ "quote": null,
+ "receipt_number": null,
+ "rendering": {
+ "amount_tax_display": null,
+ "pdf": {
+ "page_size": "letter"
+ }
+ },
+ "rendering_options": null,
+ "shipping_cost": null,
+ "shipping_details": null,
+ "starting_balance": 0,
+ "statement_descriptor": "Zulip Basic",
+ "status": "paid",
+ "status_transitions": {
+ "finalized_at": 1704972539,
+ "marked_uncollectible_at": null,
+ "paid_at": 1704972539,
+ "voided_at": null
+ },
+ "subscription": null,
+ "subscription_details": {
+ "metadata": null
+ },
+ "subtotal": 0,
+ "subtotal_excluding_tax": 0,
+ "tax": null,
+ "test_clock": null,
+ "total": 0,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 0,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": 1704972539
+ }
+ },
+ "id": "evt_1OXMRUDEQaroqDjsIBSbwwK9",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_FJ140Bl3jrVUAG",
+ "idempotency_key": "898247be-6c62-48fa-8e9a-b78333e15c91"
+ },
+ "type": "invoice.finalized"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "url": "/v1/events"
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--Event.list.5.json b/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--Event.list.5.json
new file mode 100644
index 00000000000..36cc19d60e6
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--Event.list.5.json
@@ -0,0 +1,280 @@
+{
+ "data": [
+ {
+ "api_version": "2020-08-27",
+ "created": 1704972540,
+ "data": {
+ "object": {
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 0,
+ "amount_paid": 0,
+ "amount_remaining": 0,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 0,
+ "attempted": true,
+ "auto_advance": false,
+ "automatic_tax": {
+ "enabled": false,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": null,
+ "collection_method": "charge_automatically",
+ "created": 1704972539,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_PM4axrAbUxZIzJ",
+ "customer_address": null,
+ "customer_email": "[email protected]",
+ "customer_name": null,
+ "customer_phone": null,
+ "customer_shipping": null,
+ "customer_tax_exempt": "none",
+ "customer_tax_ids": [],
+ "default_payment_method": null,
+ "default_source": null,
+ "default_tax_rates": [],
+ "description": null,
+ "discount": null,
+ "discounts": [],
+ "due_date": null,
+ "effective_at": 1704972539,
+ "ending_balance": 0,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QTTRhVXZXNHVNYVVadTRHOW91RmxpTWl5bXhxa2ZyLDk1NTEzMzQx0200VYcJ4ELz?s=ap",
+ "id": "in_1OXMRTDEQaroqDjsGB5Pozqg",
+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QTTRhVXZXNHVNYVVadTRHOW91RmxpTWl5bXhxa2ZyLDk1NTEzMzQx0200VYcJ4ELz/pdf?s=ap",
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": -2000,
+ "amount_excluding_tax": -2000,
+ "currency": "usd",
+ "description": "$20.00/month new customer discount",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1OXMRSDEQaroqDjsug3jsZ86",
+ "invoice_item": "ii_1OXMRSDEQaroqDjsiXyUzMLH",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1704972538,
+ "start": 1704972538
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1704886320,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OX00qDEQaroqDjst0aTUdZR",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PLhPbuhP0lDy6A",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -2000,
+ "unit_amount_decimal": "-2000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-2000"
+ },
+ {
+ "amount": 6300,
+ "amount_excluding_tax": 6300,
+ "currency": "usd",
+ "description": "Zulip Basic",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1OXMRTDEQaroqDjstiHtmtz0",
+ "invoice_item": "ii_1OXMRSDEQaroqDjscum9ewHk",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1328151845,
+ "start": 1325473445
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1702995208,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OP432DEQaroqDjsMeew3eg5",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PDUwJ9ZgTQzjad",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 350,
+ "unit_amount_decimal": "350"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 18,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "350"
+ },
+ {
+ "amount": -4300,
+ "amount_excluding_tax": -4300,
+ "currency": "usd",
+ "description": "Payment (Card ending in 4242)",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1OXMRUDEQaroqDjsze12Eai9",
+ "invoice_item": "ii_1OXMRSDEQaroqDjsmt1N1lQK",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1704972538,
+ "start": 1704972538
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1703050283,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OPINLDEQaroqDjs4mroUNpu",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_OvY3hKgN66WIeP",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -4300,
+ "unit_amount_decimal": "-4300"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-4300"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 3,
+ "url": "/v1/invoices/in_1OXMRTDEQaroqDjsGB5Pozqg/lines"
+ },
+ "livemode": false,
+ "metadata": {},
+ "next_payment_attempt": null,
+ "number": "5A968AD5-0001",
+ "object": "invoice",
+ "on_behalf_of": null,
+ "paid": true,
+ "paid_out_of_band": false,
+ "payment_intent": null,
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1704972539,
+ "period_start": 1704972539,
+ "post_payment_credit_notes_amount": 0,
+ "pre_payment_credit_notes_amount": 0,
+ "quote": null,
+ "receipt_number": null,
+ "rendering": {
+ "amount_tax_display": null,
+ "pdf": {
+ "page_size": "letter"
+ }
+ },
+ "rendering_options": null,
+ "shipping_cost": null,
+ "shipping_details": null,
+ "starting_balance": 0,
+ "statement_descriptor": "Zulip Basic",
+ "status": "paid",
+ "status_transitions": {
+ "finalized_at": 1704972539,
+ "marked_uncollectible_at": null,
+ "paid_at": 1704972539,
+ "voided_at": null
+ },
+ "subscription": null,
+ "subscription_details": {
+ "metadata": null
+ },
+ "subtotal": 0,
+ "subtotal_excluding_tax": 0,
+ "tax": null,
+ "test_clock": null,
+ "total": 0,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 0,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": 1704972539
+ }
+ },
+ "id": "evt_1OXMRVDEQaroqDjs4qF7oBdq",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_FJ140Bl3jrVUAG",
+ "idempotency_key": "898247be-6c62-48fa-8e9a-b78333e15c91"
+ },
+ "type": "invoice.payment_succeeded"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "url": "/v1/events"
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--Event.list.6.json b/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--Event.list.6.json
new file mode 100644
index 00000000000..6d922067afe
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--Event.list.6.json
@@ -0,0 +1,6 @@
+{
+ "data": [],
+ "has_more": false,
+ "object": "list",
+ "url": "/v1/events"
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--Invoice.create.1.json b/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--Invoice.create.1.json
new file mode 100644
index 00000000000..de730d68ca7
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--Invoice.create.1.json
@@ -0,0 +1,258 @@
+{
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 0,
+ "amount_paid": 0,
+ "amount_remaining": 0,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 0,
+ "attempted": false,
+ "auto_advance": true,
+ "automatic_tax": {
+ "enabled": false,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": null,
+ "collection_method": "charge_automatically",
+ "created": 1704972539,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_PM4axrAbUxZIzJ",
+ "customer_address": null,
+ "customer_email": "[email protected]",
+ "customer_name": null,
+ "customer_phone": null,
+ "customer_shipping": null,
+ "customer_tax_exempt": "none",
+ "customer_tax_ids": [],
+ "default_payment_method": null,
+ "default_source": null,
+ "default_tax_rates": [],
+ "description": null,
+ "discount": null,
+ "discounts": [],
+ "due_date": null,
+ "effective_at": null,
+ "ending_balance": null,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": null,
+ "id": "in_1OXMRTDEQaroqDjsGB5Pozqg",
+ "invoice_pdf": null,
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": -2000,
+ "amount_excluding_tax": -2000,
+ "currency": "usd",
+ "description": "$20.00/month new customer discount",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1OXMRSDEQaroqDjsug3jsZ86",
+ "invoice_item": "ii_1OXMRSDEQaroqDjsiXyUzMLH",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1704972538,
+ "start": 1704972538
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1704886320,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OX00qDEQaroqDjst0aTUdZR",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PLhPbuhP0lDy6A",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -2000,
+ "unit_amount_decimal": "-2000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-2000"
+ },
+ {
+ "amount": 6300,
+ "amount_excluding_tax": 6300,
+ "currency": "usd",
+ "description": "Zulip Basic",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1OXMRTDEQaroqDjstiHtmtz0",
+ "invoice_item": "ii_1OXMRSDEQaroqDjscum9ewHk",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1328151845,
+ "start": 1325473445
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1702995208,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OP432DEQaroqDjsMeew3eg5",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PDUwJ9ZgTQzjad",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 350,
+ "unit_amount_decimal": "350"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 18,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "350"
+ },
+ {
+ "amount": -4300,
+ "amount_excluding_tax": -4300,
+ "currency": "usd",
+ "description": "Payment (Card ending in 4242)",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1OXMRUDEQaroqDjsze12Eai9",
+ "invoice_item": "ii_1OXMRSDEQaroqDjsmt1N1lQK",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1704972538,
+ "start": 1704972538
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1703050283,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OPINLDEQaroqDjs4mroUNpu",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_OvY3hKgN66WIeP",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -4300,
+ "unit_amount_decimal": "-4300"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-4300"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 3,
+ "url": "/v1/invoices/in_1OXMRTDEQaroqDjsGB5Pozqg/lines"
+ },
+ "livemode": false,
+ "metadata": {},
+ "next_payment_attempt": 1704976139,
+ "number": null,
+ "object": "invoice",
+ "on_behalf_of": null,
+ "paid": false,
+ "paid_out_of_band": false,
+ "payment_intent": null,
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1704972539,
+ "period_start": 1704972539,
+ "post_payment_credit_notes_amount": 0,
+ "pre_payment_credit_notes_amount": 0,
+ "quote": null,
+ "receipt_number": null,
+ "rendering": {
+ "amount_tax_display": null,
+ "pdf": {
+ "page_size": "auto"
+ }
+ },
+ "rendering_options": null,
+ "shipping_cost": null,
+ "shipping_details": null,
+ "starting_balance": 0,
+ "statement_descriptor": "Zulip Basic",
+ "status": "draft",
+ "status_transitions": {
+ "finalized_at": null,
+ "marked_uncollectible_at": null,
+ "paid_at": null,
+ "voided_at": null
+ },
+ "subscription": null,
+ "subscription_details": {
+ "metadata": null
+ },
+ "subtotal": 0,
+ "subtotal_excluding_tax": 0,
+ "tax": null,
+ "test_clock": null,
+ "total": 0,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 0,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": null
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--Invoice.finalize_invoice.1.json b/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--Invoice.finalize_invoice.1.json
new file mode 100644
index 00000000000..cf782642ed7
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--Invoice.finalize_invoice.1.json
@@ -0,0 +1,258 @@
+{
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 0,
+ "amount_paid": 0,
+ "amount_remaining": 0,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 0,
+ "attempted": true,
+ "auto_advance": false,
+ "automatic_tax": {
+ "enabled": false,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": null,
+ "collection_method": "charge_automatically",
+ "created": 1704972539,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_PM4axrAbUxZIzJ",
+ "customer_address": null,
+ "customer_email": "[email protected]",
+ "customer_name": null,
+ "customer_phone": null,
+ "customer_shipping": null,
+ "customer_tax_exempt": "none",
+ "customer_tax_ids": [],
+ "default_payment_method": null,
+ "default_source": null,
+ "default_tax_rates": [],
+ "description": null,
+ "discount": null,
+ "discounts": [],
+ "due_date": null,
+ "effective_at": 1704972539,
+ "ending_balance": 0,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QTTRhVXZXNHVNYVVadTRHOW91RmxpTWl5bXhxa2ZyLDk1NTEzMzQw0200A30lrhuK?s=ap",
+ "id": "in_1OXMRTDEQaroqDjsGB5Pozqg",
+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QTTRhVXZXNHVNYVVadTRHOW91RmxpTWl5bXhxa2ZyLDk1NTEzMzQw0200A30lrhuK/pdf?s=ap",
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": -2000,
+ "amount_excluding_tax": -2000,
+ "currency": "usd",
+ "description": "$20.00/month new customer discount",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1OXMRSDEQaroqDjsug3jsZ86",
+ "invoice_item": "ii_1OXMRSDEQaroqDjsiXyUzMLH",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1704972538,
+ "start": 1704972538
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1704886320,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OX00qDEQaroqDjst0aTUdZR",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PLhPbuhP0lDy6A",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -2000,
+ "unit_amount_decimal": "-2000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-2000"
+ },
+ {
+ "amount": 6300,
+ "amount_excluding_tax": 6300,
+ "currency": "usd",
+ "description": "Zulip Basic",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1OXMRTDEQaroqDjstiHtmtz0",
+ "invoice_item": "ii_1OXMRSDEQaroqDjscum9ewHk",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1328151845,
+ "start": 1325473445
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1702995208,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OP432DEQaroqDjsMeew3eg5",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PDUwJ9ZgTQzjad",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 350,
+ "unit_amount_decimal": "350"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 18,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "350"
+ },
+ {
+ "amount": -4300,
+ "amount_excluding_tax": -4300,
+ "currency": "usd",
+ "description": "Payment (Card ending in 4242)",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1OXMRUDEQaroqDjsze12Eai9",
+ "invoice_item": "ii_1OXMRSDEQaroqDjsmt1N1lQK",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1704972538,
+ "start": 1704972538
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1703050283,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OPINLDEQaroqDjs4mroUNpu",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_OvY3hKgN66WIeP",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -4300,
+ "unit_amount_decimal": "-4300"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-4300"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 3,
+ "url": "/v1/invoices/in_1OXMRTDEQaroqDjsGB5Pozqg/lines"
+ },
+ "livemode": false,
+ "metadata": {},
+ "next_payment_attempt": null,
+ "number": "5A968AD5-0001",
+ "object": "invoice",
+ "on_behalf_of": null,
+ "paid": true,
+ "paid_out_of_band": false,
+ "payment_intent": null,
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1704972539,
+ "period_start": 1704972539,
+ "post_payment_credit_notes_amount": 0,
+ "pre_payment_credit_notes_amount": 0,
+ "quote": null,
+ "receipt_number": null,
+ "rendering": {
+ "amount_tax_display": null,
+ "pdf": {
+ "page_size": "letter"
+ }
+ },
+ "rendering_options": null,
+ "shipping_cost": null,
+ "shipping_details": null,
+ "starting_balance": 0,
+ "statement_descriptor": "Zulip Basic",
+ "status": "paid",
+ "status_transitions": {
+ "finalized_at": 1704972539,
+ "marked_uncollectible_at": null,
+ "paid_at": 1704972539,
+ "voided_at": null
+ },
+ "subscription": null,
+ "subscription_details": {
+ "metadata": null
+ },
+ "subtotal": 0,
+ "subtotal_excluding_tax": 0,
+ "tax": null,
+ "test_clock": null,
+ "total": 0,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 0,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": 1704972539
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--Invoice.list.1.json b/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--Invoice.list.1.json
new file mode 100644
index 00000000000..e39960ab725
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--Invoice.list.1.json
@@ -0,0 +1,6 @@
+{
+ "data": [],
+ "has_more": false,
+ "object": "list",
+ "url": "/v1/invoices"
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--Invoice.list.2.json b/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--Invoice.list.2.json
new file mode 100644
index 00000000000..eeaeda09b8b
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--Invoice.list.2.json
@@ -0,0 +1,265 @@
+{
+ "data": [
+ {
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 0,
+ "amount_paid": 0,
+ "amount_remaining": 0,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 0,
+ "attempted": true,
+ "auto_advance": false,
+ "automatic_tax": {
+ "enabled": false,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": null,
+ "collection_method": "charge_automatically",
+ "created": 1704972539,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_PM4axrAbUxZIzJ",
+ "customer_address": null,
+ "customer_email": "[email protected]",
+ "customer_name": null,
+ "customer_phone": null,
+ "customer_shipping": null,
+ "customer_tax_exempt": "none",
+ "customer_tax_ids": [],
+ "default_payment_method": null,
+ "default_source": null,
+ "default_tax_rates": [],
+ "description": null,
+ "discount": null,
+ "discounts": [],
+ "due_date": null,
+ "effective_at": 1704972539,
+ "ending_balance": 0,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QTTRhVXZXNHVNYVVadTRHOW91RmxpTWl5bXhxa2ZyLDk1NTEzMzQy0200Tc8MHB6M?s=ap",
+ "id": "in_1OXMRTDEQaroqDjsGB5Pozqg",
+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QTTRhVXZXNHVNYVVadTRHOW91RmxpTWl5bXhxa2ZyLDk1NTEzMzQy0200Tc8MHB6M/pdf?s=ap",
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": -2000,
+ "amount_excluding_tax": -2000,
+ "currency": "usd",
+ "description": "$20.00/month new customer discount",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1OXMRSDEQaroqDjsug3jsZ86",
+ "invoice_item": "ii_1OXMRSDEQaroqDjsiXyUzMLH",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1704972538,
+ "start": 1704972538
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1704886320,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OX00qDEQaroqDjst0aTUdZR",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PLhPbuhP0lDy6A",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -2000,
+ "unit_amount_decimal": "-2000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-2000"
+ },
+ {
+ "amount": 6300,
+ "amount_excluding_tax": 6300,
+ "currency": "usd",
+ "description": "Zulip Basic",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1OXMRTDEQaroqDjstiHtmtz0",
+ "invoice_item": "ii_1OXMRSDEQaroqDjscum9ewHk",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1328151845,
+ "start": 1325473445
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1702995208,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OP432DEQaroqDjsMeew3eg5",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PDUwJ9ZgTQzjad",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 350,
+ "unit_amount_decimal": "350"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 18,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "350"
+ },
+ {
+ "amount": -4300,
+ "amount_excluding_tax": -4300,
+ "currency": "usd",
+ "description": "Payment (Card ending in 4242)",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1OXMRUDEQaroqDjsze12Eai9",
+ "invoice_item": "ii_1OXMRSDEQaroqDjsmt1N1lQK",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1704972538,
+ "start": 1704972538
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1703050283,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OPINLDEQaroqDjs4mroUNpu",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_OvY3hKgN66WIeP",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -4300,
+ "unit_amount_decimal": "-4300"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-4300"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 3,
+ "url": "/v1/invoices/in_1OXMRTDEQaroqDjsGB5Pozqg/lines"
+ },
+ "livemode": false,
+ "metadata": {},
+ "next_payment_attempt": null,
+ "number": "5A968AD5-0001",
+ "object": "invoice",
+ "on_behalf_of": null,
+ "paid": true,
+ "paid_out_of_band": false,
+ "payment_intent": null,
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1704972539,
+ "period_start": 1704972539,
+ "post_payment_credit_notes_amount": 0,
+ "pre_payment_credit_notes_amount": 0,
+ "quote": null,
+ "receipt_number": null,
+ "rendering": {
+ "amount_tax_display": null,
+ "pdf": {
+ "page_size": "letter"
+ }
+ },
+ "rendering_options": null,
+ "shipping_cost": null,
+ "shipping_details": null,
+ "starting_balance": 0,
+ "statement_descriptor": "Zulip Basic",
+ "status": "paid",
+ "status_transitions": {
+ "finalized_at": 1704972539,
+ "marked_uncollectible_at": null,
+ "paid_at": 1704972539,
+ "voided_at": null
+ },
+ "subscription": null,
+ "subscription_details": {
+ "metadata": null
+ },
+ "subtotal": 0,
+ "subtotal_excluding_tax": 0,
+ "tax": null,
+ "test_clock": null,
+ "total": 0,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 0,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": 1704972539
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "url": "/v1/invoices"
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--InvoiceItem.create.1.json b/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--InvoiceItem.create.1.json
new file mode 100644
index 00000000000..d92f7dd1cee
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--InvoiceItem.create.1.json
@@ -0,0 +1,47 @@
+{
+ "amount": -4300,
+ "currency": "usd",
+ "customer": "cus_PM4axrAbUxZIzJ",
+ "date": 1704972538,
+ "description": "Payment (Card ending in 4242)",
+ "discountable": false,
+ "discounts": [],
+ "id": "ii_1OXMRSDEQaroqDjsmt1N1lQK",
+ "invoice": null,
+ "livemode": false,
+ "metadata": {},
+ "object": "invoiceitem",
+ "period": {
+ "end": 1704972538,
+ "start": 1704972538
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1703050283,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OPINLDEQaroqDjs4mroUNpu",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_OvY3hKgN66WIeP",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -4300,
+ "unit_amount_decimal": "-4300"
+ },
+ "proration": false,
+ "quantity": 1,
+ "subscription": null,
+ "tax_rates": [],
+ "test_clock": null,
+ "unit_amount": -4300,
+ "unit_amount_decimal": "-4300"
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--InvoiceItem.create.2.json b/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--InvoiceItem.create.2.json
new file mode 100644
index 00000000000..fc528ef8a59
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--InvoiceItem.create.2.json
@@ -0,0 +1,47 @@
+{
+ "amount": 6300,
+ "currency": "usd",
+ "customer": "cus_PM4axrAbUxZIzJ",
+ "date": 1704972538,
+ "description": "Zulip Basic",
+ "discountable": false,
+ "discounts": [],
+ "id": "ii_1OXMRSDEQaroqDjscum9ewHk",
+ "invoice": null,
+ "livemode": false,
+ "metadata": {},
+ "object": "invoiceitem",
+ "period": {
+ "end": 1328151845,
+ "start": 1325473445
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1702995208,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OP432DEQaroqDjsMeew3eg5",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PDUwJ9ZgTQzjad",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 350,
+ "unit_amount_decimal": "350"
+ },
+ "proration": false,
+ "quantity": 18,
+ "subscription": null,
+ "tax_rates": [],
+ "test_clock": null,
+ "unit_amount": 350,
+ "unit_amount_decimal": "350"
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--InvoiceItem.create.3.json b/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--InvoiceItem.create.3.json
new file mode 100644
index 00000000000..575b3110457
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--InvoiceItem.create.3.json
@@ -0,0 +1,47 @@
+{
+ "amount": -2000,
+ "currency": "usd",
+ "customer": "cus_PM4axrAbUxZIzJ",
+ "date": 1704972538,
+ "description": "$20.00/month new customer discount",
+ "discountable": false,
+ "discounts": [],
+ "id": "ii_1OXMRSDEQaroqDjsiXyUzMLH",
+ "invoice": null,
+ "livemode": false,
+ "metadata": {},
+ "object": "invoiceitem",
+ "period": {
+ "end": 1704972538,
+ "start": 1704972538
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1704886320,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OX00qDEQaroqDjst0aTUdZR",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PLhPbuhP0lDy6A",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -2000,
+ "unit_amount_decimal": "-2000"
+ },
+ "proration": false,
+ "quantity": 1,
+ "subscription": null,
+ "tax_rates": [],
+ "test_clock": null,
+ "unit_amount": -2000,
+ "unit_amount_decimal": "-2000"
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--PaymentIntent.create.1.json b/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--PaymentIntent.create.1.json
new file mode 100644
index 00000000000..49edb78f387
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--PaymentIntent.create.1.json
@@ -0,0 +1,198 @@
+{
+ "amount": 4300,
+ "amount_capturable": 0,
+ "amount_details": {
+ "tip": {}
+ },
+ "amount_received": 4300,
+ "application": null,
+ "application_fee_amount": null,
+ "automatic_payment_methods": null,
+ "canceled_at": null,
+ "cancellation_reason": null,
+ "capture_method": "automatic",
+ "charges": {
+ "data": [
+ {
+ "amount": 4300,
+ "amount_captured": 4300,
+ "amount_refunded": 0,
+ "application": null,
+ "application_fee": null,
+ "application_fee_amount": null,
+ "balance_transaction": "txn_3OXMRQDEQaroqDjs0UUHVK0U",
+ "billing_details": {
+ "address": {
+ "city": null,
+ "country": null,
+ "line1": null,
+ "line2": null,
+ "postal_code": null,
+ "state": null
+ },
+ "email": null,
+ "name": null,
+ "phone": null
+ },
+ "calculated_statement_descriptor": "ZULIP BASIC",
+ "captured": true,
+ "created": 1704972536,
+ "currency": "usd",
+ "customer": "cus_PM4axrAbUxZIzJ",
+ "description": "Upgrade to Zulip Basic, $3.5 x 18 - $20.0 x 1",
+ "destination": null,
+ "dispute": null,
+ "disputed": false,
+ "failure_balance_transaction": null,
+ "failure_code": null,
+ "failure_message": null,
+ "fraud_details": {},
+ "id": "ch_3OXMRQDEQaroqDjs0YOObWqj",
+ "invoice": null,
+ "livemode": false,
+ "metadata": {
+ "billing_modality": "charge_automatically",
+ "billing_schedule": "2",
+ "license_management": "automatic",
+ "licenses": "18",
+ "plan_tier": "103",
+ "price_per_license": "350",
+ "remote_server_host": "demo.example.com",
+ "remote_server_user_email": "[email protected]",
+ "remote_server_user_id": "1",
+ "seat_count": "18",
+ "type": "upgrade"
+ },
+ "object": "charge",
+ "on_behalf_of": null,
+ "order": null,
+ "outcome": {
+ "network_status": "approved_by_network",
+ "reason": null,
+ "risk_level": "normal",
+ "risk_score": 12,
+ "seller_message": "Payment complete.",
+ "type": "authorized"
+ },
+ "paid": true,
+ "payment_intent": "pi_3OXMRQDEQaroqDjs0j02erxK",
+ "payment_method": "pm_1OXMRKDEQaroqDjsjvn2UVaa",
+ "payment_method_details": {
+ "card": {
+ "amount_authorized": 4300,
+ "brand": "visa",
+ "checks": {
+ "address_line1_check": null,
+ "address_postal_code_check": null,
+ "cvc_check": "pass"
+ },
+ "country": "US",
+ "exp_month": 1,
+ "exp_year": 2025,
+ "extended_authorization": {
+ "status": "disabled"
+ },
+ "fingerprint": "9XKsMixKBi6kIIzd",
+ "funding": "credit",
+ "incremental_authorization": {
+ "status": "unavailable"
+ },
+ "installments": null,
+ "last4": "4242",
+ "mandate": null,
+ "multicapture": {
+ "status": "unavailable"
+ },
+ "network": "visa",
+ "network_token": {
+ "used": false
+ },
+ "overcapture": {
+ "maximum_amount_capturable": 4300,
+ "status": "unavailable"
+ },
+ "three_d_secure": null,
+ "wallet": null
+ },
+ "type": "card"
+ },
+ "radar_options": {},
+ "receipt_email": "[email protected]",
+ "receipt_number": null,
+ "receipt_url": "https://pay.stripe.com/receipts/payment/CAcaFwoVYWNjdF8xN3ZUa3dERVFhcm9xRGpzKPmh_6wGMgY-djjCdWc6LBYFqaeOshzS8cUPu2wmGUlai18_giXwtgKxsSO2llg6bGILkTveJQ0xaS6r",
+ "refunded": false,
+ "refunds": {
+ "data": [],
+ "has_more": false,
+ "object": "list",
+ "total_count": 0,
+ "url": "/v1/charges/ch_3OXMRQDEQaroqDjs0YOObWqj/refunds"
+ },
+ "review": null,
+ "shipping": null,
+ "source": null,
+ "source_transfer": null,
+ "statement_descriptor": "Zulip Basic",
+ "statement_descriptor_suffix": null,
+ "status": "succeeded",
+ "transfer_data": null,
+ "transfer_group": null
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 1,
+ "url": "/v1/charges?payment_intent=pi_3OXMRQDEQaroqDjs0j02erxK"
+ },
+ "client_secret": "pi_3OXMRQDEQaroqDjs0j02erxK_secret_bHmEex79mvWuoQNIcMMmZPgm7",
+ "confirmation_method": "automatic",
+ "created": 1704972536,
+ "currency": "usd",
+ "customer": "cus_PM4axrAbUxZIzJ",
+ "description": "Upgrade to Zulip Basic, $3.5 x 18 - $20.0 x 1",
+ "id": "pi_3OXMRQDEQaroqDjs0j02erxK",
+ "invoice": null,
+ "last_payment_error": null,
+ "latest_charge": "ch_3OXMRQDEQaroqDjs0YOObWqj",
+ "livemode": false,
+ "metadata": {
+ "billing_modality": "charge_automatically",
+ "billing_schedule": "2",
+ "license_management": "automatic",
+ "licenses": "18",
+ "plan_tier": "103",
+ "price_per_license": "350",
+ "remote_server_host": "demo.example.com",
+ "remote_server_user_email": "[email protected]",
+ "remote_server_user_id": "1",
+ "seat_count": "18",
+ "type": "upgrade"
+ },
+ "next_action": null,
+ "object": "payment_intent",
+ "on_behalf_of": null,
+ "payment_method": "pm_1OXMRKDEQaroqDjsjvn2UVaa",
+ "payment_method_configuration_details": null,
+ "payment_method_options": {
+ "card": {
+ "installments": null,
+ "mandate_options": null,
+ "network": null,
+ "request_three_d_secure": "automatic"
+ }
+ },
+ "payment_method_types": [
+ "card"
+ ],
+ "processing": null,
+ "receipt_email": "[email protected]",
+ "review": null,
+ "setup_future_usage": null,
+ "shipping": null,
+ "source": null,
+ "statement_descriptor": "Zulip Basic",
+ "statement_descriptor_suffix": null,
+ "status": "succeeded",
+ "transfer_data": null,
+ "transfer_group": null
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--SetupIntent.create.1.json b/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--SetupIntent.create.1.json
new file mode 100644
index 00000000000..ef19a1cf9f5
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--SetupIntent.create.1.json
@@ -0,0 +1,34 @@
+{
+ "application": null,
+ "automatic_payment_methods": null,
+ "cancellation_reason": null,
+ "client_secret": "seti_1OXMRKDEQaroqDjsg8ZLnazR_secret_PM4aVUWuhSfm16CD7bwUQd5iPMQsnR4",
+ "created": 1704972530,
+ "customer": "cus_PM4axrAbUxZIzJ",
+ "description": null,
+ "flow_directions": null,
+ "id": "seti_1OXMRKDEQaroqDjsg8ZLnazR",
+ "last_setup_error": null,
+ "latest_attempt": "setatt_1OXMRKDEQaroqDjsv7R8WAxM",
+ "livemode": false,
+ "mandate": null,
+ "metadata": {},
+ "next_action": null,
+ "object": "setup_intent",
+ "on_behalf_of": null,
+ "payment_method": "pm_1OXMRKDEQaroqDjsjvn2UVaa",
+ "payment_method_configuration_details": null,
+ "payment_method_options": {
+ "card": {
+ "mandate_options": null,
+ "network": null,
+ "request_three_d_secure": "automatic"
+ }
+ },
+ "payment_method_types": [
+ "card"
+ ],
+ "single_use_mandate": null,
+ "status": "succeeded",
+ "usage": "off_session"
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--SetupIntent.list.1.json b/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--SetupIntent.list.1.json
new file mode 100644
index 00000000000..d7ca834a50c
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--SetupIntent.list.1.json
@@ -0,0 +1,41 @@
+{
+ "data": [
+ {
+ "application": null,
+ "automatic_payment_methods": null,
+ "cancellation_reason": null,
+ "client_secret": "seti_1OXMRKDEQaroqDjsZ3uxOOu7_secret_PM4ajuVYGPf4nIdFFddBjbAG97jWF8D",
+ "created": 1704972530,
+ "customer": "cus_PM4axrAbUxZIzJ",
+ "description": null,
+ "flow_directions": null,
+ "id": "seti_1OXMRKDEQaroqDjsZ3uxOOu7",
+ "last_setup_error": null,
+ "latest_attempt": null,
+ "livemode": false,
+ "mandate": null,
+ "metadata": {},
+ "next_action": null,
+ "object": "setup_intent",
+ "on_behalf_of": null,
+ "payment_method": null,
+ "payment_method_configuration_details": null,
+ "payment_method_options": {
+ "card": {
+ "mandate_options": null,
+ "network": null,
+ "request_three_d_secure": "automatic"
+ }
+ },
+ "payment_method_types": [
+ "card"
+ ],
+ "single_use_mandate": null,
+ "status": "requires_payment_method",
+ "usage": "off_session"
+ }
+ ],
+ "has_more": true,
+ "object": "list",
+ "url": "/v1/setup_intents"
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--SetupIntent.retrieve.1.json b/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--SetupIntent.retrieve.1.json
new file mode 100644
index 00000000000..ef19a1cf9f5
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--SetupIntent.retrieve.1.json
@@ -0,0 +1,34 @@
+{
+ "application": null,
+ "automatic_payment_methods": null,
+ "cancellation_reason": null,
+ "client_secret": "seti_1OXMRKDEQaroqDjsg8ZLnazR_secret_PM4aVUWuhSfm16CD7bwUQd5iPMQsnR4",
+ "created": 1704972530,
+ "customer": "cus_PM4axrAbUxZIzJ",
+ "description": null,
+ "flow_directions": null,
+ "id": "seti_1OXMRKDEQaroqDjsg8ZLnazR",
+ "last_setup_error": null,
+ "latest_attempt": "setatt_1OXMRKDEQaroqDjsv7R8WAxM",
+ "livemode": false,
+ "mandate": null,
+ "metadata": {},
+ "next_action": null,
+ "object": "setup_intent",
+ "on_behalf_of": null,
+ "payment_method": "pm_1OXMRKDEQaroqDjsjvn2UVaa",
+ "payment_method_configuration_details": null,
+ "payment_method_options": {
+ "card": {
+ "mandate_options": null,
+ "network": null,
+ "request_three_d_secure": "automatic"
+ }
+ },
+ "payment_method_types": [
+ "card"
+ ],
+ "single_use_mandate": null,
+ "status": "succeeded",
+ "usage": "off_session"
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--checkout.Session.create.1.json b/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--checkout.Session.create.1.json
new file mode 100644
index 00000000000..f4caa1f07c8
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--checkout.Session.create.1.json
@@ -0,0 +1,74 @@
+{
+ "after_expiration": null,
+ "allow_promotion_codes": null,
+ "amount_subtotal": null,
+ "amount_total": null,
+ "automatic_tax": {
+ "enabled": false,
+ "status": null
+ },
+ "billing_address_collection": null,
+ "cancel_url": "http://selfhosting.testserver/server/6cde5f7a-1f7e-4978-9716-49f69ebfc9fe/upgrade/?manual_license_management=false&tier=1",
+ "client_reference_id": null,
+ "client_secret": null,
+ "consent": null,
+ "consent_collection": null,
+ "created": 1704972530,
+ "currency": null,
+ "currency_conversion": null,
+ "custom_fields": [],
+ "custom_text": {
+ "after_submit": null,
+ "shipping_address": null,
+ "submit": null,
+ "terms_of_service_acceptance": null
+ },
+ "customer": "cus_PM4axrAbUxZIzJ",
+ "customer_creation": null,
+ "customer_details": {
+ "address": null,
+ "email": "[email protected]",
+ "name": null,
+ "phone": null,
+ "tax_exempt": null,
+ "tax_ids": null
+ },
+ "customer_email": null,
+ "expires_at": 1705058929,
+ "id": "cs_test_c1vBY946DQBGvqRotkBMd5KMC8ZvQ9Jfp43LcaYh4deU4e6r4035dgnupH",
+ "invoice": null,
+ "invoice_creation": null,
+ "livemode": false,
+ "locale": null,
+ "metadata": {
+ "remote_server_user_id": "1",
+ "type": "card_update"
+ },
+ "mode": "setup",
+ "object": "checkout.session",
+ "payment_intent": null,
+ "payment_link": null,
+ "payment_method_collection": "always",
+ "payment_method_configuration_details": null,
+ "payment_method_options": {},
+ "payment_method_types": [
+ "card"
+ ],
+ "payment_status": "no_payment_required",
+ "phone_number_collection": {
+ "enabled": false
+ },
+ "recovered_from": null,
+ "setup_intent": "seti_1OXMRKDEQaroqDjsZ3uxOOu7",
+ "shipping": null,
+ "shipping_address_collection": null,
+ "shipping_options": [],
+ "shipping_rate": null,
+ "status": "open",
+ "submit_type": null,
+ "subscription": null,
+ "success_url": "http://selfhosting.testserver/server/6cde5f7a-1f7e-4978-9716-49f69ebfc9fe/billing/event_status?stripe_session_id={CHECKOUT_SESSION_ID}",
+ "total_details": null,
+ "ui_mode": "hosted",
+ "url": "https://checkout.stripe.com/c/pay/cs_test_c1vBY946DQBGvqRotkBMd5KMC8ZvQ9Jfp43LcaYh4deU4e6r4035dgnupH#fid1d2BpamRhQ2prcSc%2FJ1ZqcHdmYCVWZGt2JVV3aicpJ2R1bE5gfCc%2FJ3VuWnFgdnFaXVRmMU5zNkldQTY9SnNRY09XZml2UXNQJyknY3dqaFZgd3Ngdyc%2FcXdwYCknaWR8anBxUXx1YCc%2FJ3Zsa2JpYFpmamlwaGsnKSdga2RnaWBVaWRmYG1qaWFgd3YnP3F3cGB4JSUl"
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--checkout.Session.list.1.json b/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--checkout.Session.list.1.json
new file mode 100644
index 00000000000..843a558b2e9
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_initial_remote_server_upgrade--checkout.Session.list.1.json
@@ -0,0 +1,81 @@
+{
+ "data": [
+ {
+ "after_expiration": null,
+ "allow_promotion_codes": null,
+ "amount_subtotal": null,
+ "amount_total": null,
+ "automatic_tax": {
+ "enabled": false,
+ "status": null
+ },
+ "billing_address_collection": null,
+ "cancel_url": "http://selfhosting.testserver/server/6cde5f7a-1f7e-4978-9716-49f69ebfc9fe/upgrade/?manual_license_management=false&tier=1",
+ "client_reference_id": null,
+ "client_secret": null,
+ "consent": null,
+ "consent_collection": null,
+ "created": 1704972530,
+ "currency": null,
+ "currency_conversion": null,
+ "custom_fields": [],
+ "custom_text": {
+ "after_submit": null,
+ "shipping_address": null,
+ "submit": null,
+ "terms_of_service_acceptance": null
+ },
+ "customer": "cus_PM4axrAbUxZIzJ",
+ "customer_creation": null,
+ "customer_details": {
+ "address": null,
+ "email": "[email protected]",
+ "name": null,
+ "phone": null,
+ "tax_exempt": null,
+ "tax_ids": null
+ },
+ "customer_email": null,
+ "expires_at": 1705058929,
+ "id": "cs_test_c1vBY946DQBGvqRotkBMd5KMC8ZvQ9Jfp43LcaYh4deU4e6r4035dgnupH",
+ "invoice": null,
+ "invoice_creation": null,
+ "livemode": false,
+ "locale": null,
+ "metadata": {
+ "remote_server_user_id": "1",
+ "type": "card_update"
+ },
+ "mode": "setup",
+ "object": "checkout.session",
+ "payment_intent": null,
+ "payment_link": null,
+ "payment_method_collection": "always",
+ "payment_method_configuration_details": null,
+ "payment_method_options": {},
+ "payment_method_types": [
+ "card"
+ ],
+ "payment_status": "no_payment_required",
+ "phone_number_collection": {
+ "enabled": false
+ },
+ "recovered_from": null,
+ "setup_intent": "seti_1OXMRKDEQaroqDjsZ3uxOOu7",
+ "shipping": null,
+ "shipping_address_collection": null,
+ "shipping_options": [],
+ "shipping_rate": null,
+ "status": "open",
+ "submit_type": null,
+ "subscription": null,
+ "success_url": "http://selfhosting.testserver/server/6cde5f7a-1f7e-4978-9716-49f69ebfc9fe/billing/event_status?stripe_session_id={CHECKOUT_SESSION_ID}",
+ "total_details": null,
+ "ui_mode": "hosted",
+ "url": "https://checkout.stripe.com/c/pay/cs_test_c1vBY946DQBGvqRotkBMd5KMC8ZvQ9Jfp43LcaYh4deU4e6r4035dgnupH#fid1d2BpamRhQ2prcSc%2FJ1ZqcHdmYCVWZGt2JVV3aicpJ2R1bE5gfCc%2FJ3VuWnFgdnFaXVRmMU5zNkldQTY9SnNRY09XZml2UXNQJyknY3dqaFZgd3Ngdyc%2FcXdwYCknaWR8anBxUXx1YCc%2FJ3Zsa2JpYFpmamlwaGsnKSdga2RnaWBVaWRmYG1qaWFgd3YnP3F3cGB4JSUl"
+ }
+ ],
+ "has_more": true,
+ "object": "list",
+ "url": "/v1/checkout/sessions"
+}
diff --git a/corporate/tests/test_stripe.py b/corporate/tests/test_stripe.py
index bb4faab0a38..223f624a187 100644
--- a/corporate/tests/test_stripe.py
+++ b/corporate/tests/test_stripe.py
@@ -6163,6 +6163,53 @@ class TestRemoteRealmBillingFlow(StripeTestCase, RemoteRealmBillingTestCase):
zulip_realm_plan.refresh_from_db()
self.assertEqual(zulip_realm_plan.licenses_at_next_renewal(), None)
+ @responses.activate
+ @mock_stripe()
+ def test_invoice_initial_remote_realm_upgrade(self, *mocks: Mock) -> None:
+ self.login("hamlet")
+ hamlet = self.example_user("hamlet")
+
+ realm_user_count = UserProfile.objects.filter(
+ realm=hamlet.realm, is_bot=False, is_active=True
+ ).count()
+
+ self.add_mock_response()
+ with time_machine.travel(self.now, tick=False):
+ send_server_data_to_push_bouncer(consider_usage_statistics=False)
+
+ self.execute_remote_billing_authentication_flow(hamlet)
+ with time_machine.travel(self.now, tick=False):
+ stripe_customer = self.add_card_and_upgrade(
+ tier=CustomerPlan.TIER_SELF_HOSTED_BASIC, schedule="monthly"
+ )
+
+ [invoice0] = iter(stripe.Invoice.list(customer=stripe_customer.id))
+
+ [invoice_item0, invoice_item1, invoice_item2] = iter(invoice0.lines)
+ invoice_item_params = {
+ "amount": -2000,
+ "description": "$20.00/month new customer discount",
+ "quantity": 1,
+ }
+ for key, value in invoice_item_params.items():
+ self.assertEqual(invoice_item0[key], value)
+
+ invoice_item_params = {
+ "amount": realm_user_count * 3.5 * 100,
+ "description": "Zulip Basic",
+ "quantity": realm_user_count,
+ }
+ for key, value in invoice_item_params.items():
+ self.assertEqual(invoice_item1[key], value)
+
+ invoice_item_params = {
+ "amount": -1 * (realm_user_count * 3.5 * 100 - 2000),
+ "description": "Payment (Card ending in 4242)",
+ "quantity": 1,
+ }
+ for key, value in invoice_item_params.items():
+ self.assertEqual(invoice_item2[key], value)
+
@override_settings(PUSH_NOTIFICATION_BOUNCER_URL="https://push.zulip.org.example.com")
class TestRemoteServerBillingFlow(StripeTestCase, RemoteServerTestCase):
@@ -6673,3 +6720,48 @@ class TestRemoteServerBillingFlow(StripeTestCase, RemoteServerTestCase):
result = self.client_post("/serverlogin/", payload, subdomain="selfhosting")
self.assertEqual(result.status_code, 200)
self.assert_in_success_response(["Your server registration has been deactivated."], result)
+
+ @responses.activate
+ @mock_stripe()
+ def test_invoice_initial_remote_server_upgrade(self, *mocks: Mock) -> None:
+ self.login("hamlet")
+ hamlet = self.example_user("hamlet")
+
+ server_user_count = UserProfile.objects.filter(is_bot=False, is_active=True).count()
+
+ self.add_mock_response()
+ with time_machine.travel(self.now, tick=False):
+ send_server_data_to_push_bouncer(consider_usage_statistics=False)
+
+ self.execute_remote_billing_authentication_flow(hamlet.delivery_email, hamlet.full_name)
+ with time_machine.travel(self.now, tick=False):
+ stripe_customer = self.add_card_and_upgrade(
+ tier=CustomerPlan.TIER_SELF_HOSTED_BASIC, schedule="monthly"
+ )
+
+ [invoice0] = iter(stripe.Invoice.list(customer=stripe_customer.id))
+
+ [invoice_item0, invoice_item1, invoice_item2] = iter(invoice0.lines)
+ invoice_item_params = {
+ "amount": -2000,
+ "description": "$20.00/month new customer discount",
+ "quantity": 1,
+ }
+ for key, value in invoice_item_params.items():
+ self.assertEqual(invoice_item0[key], value)
+
+ invoice_item_params = {
+ "amount": server_user_count * 3.5 * 100,
+ "description": "Zulip Basic",
+ "quantity": server_user_count,
+ }
+ for key, value in invoice_item_params.items():
+ self.assertEqual(invoice_item1[key], value)
+
+ invoice_item_params = {
+ "amount": -1 * (server_user_count * 3.5 * 100 - 2000),
+ "description": "Payment (Card ending in 4242)",
+ "quantity": 1,
+ }
+ for key, value in invoice_item_params.items():
+ self.assertEqual(invoice_item2[key], value)