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.

corporate: Add end_date to fixed-price plans.

Prakhar Pratyush06e48fd553df
diff --git a/corporate/lib/stripe.py b/corporate/lib/stripe.py
index 36793227090..eb6e774877c 100644
--- a/corporate/lib/stripe.py
+++ b/corporate/lib/stripe.py
@@ -1349,7 +1349,17 @@ class BillingSession(ABC):
raise SupportRequestError(
f"Configure {self.billing_entity_display_name} current plan end-date, before scheduling a new plan."
)
+ # Handles the case when the current_plan is a fixed-price plan with
+ # a monthly billing schedule. We can't schedule a new plan until the
+ # invoice for the 12th month is processed.
+ if current_plan.end_date != self.get_next_billing_cycle(current_plan):
+ raise SupportRequestError(
+ f"New plan for {self.billing_entity_display_name} can not be scheduled until all the invoices of the current plan are processed."
+ )
fixed_price_plan_params["billing_cycle_anchor"] = current_plan.end_date
+ fixed_price_plan_params["end_date"] = add_months(
+ current_plan.end_date, CustomerPlan.FIXED_PRICE_PLAN_DURATION_MONTHS
+ )
fixed_price_plan_params["status"] = CustomerPlan.NEVER_STARTED
fixed_price_plan_params["next_invoice_date"] = current_plan.end_date
fixed_price_plan_params["invoicing_status"] = (
@@ -1699,6 +1709,9 @@ class BillingSession(ABC):
# Manual license management is not available for fixed price plan.
assert automanage_licenses is True
plan_params["fixed_price"] = fixed_price_plan_offer.fixed_price
+ plan_params["end_date"] = add_months(
+ billing_cycle_anchor, CustomerPlan.FIXED_PRICE_PLAN_DURATION_MONTHS
+ )
fixed_price_plan_offer.status = CustomerPlanOffer.PROCESSED
fixed_price_plan_offer.save(update_fields=["status"])
@@ -1952,11 +1965,7 @@ class BillingSession(ABC):
licenses_at_next_renewal = last_ledger_entry.licenses_at_next_renewal
assert licenses_at_next_renewal is not None
- if (
- plan.tier == CustomerPlan.TIER_SELF_HOSTED_LEGACY
- and plan.end_date == next_billing_cycle
- and plan.status == CustomerPlan.ACTIVE
- ):
+ if plan.end_date == next_billing_cycle and plan.status == CustomerPlan.ACTIVE:
self.process_downgrade(plan, True)
return None, None
diff --git a/corporate/migrations/0039_backfill_end_date_for_fixed_price_plans.py b/corporate/migrations/0039_backfill_end_date_for_fixed_price_plans.py
new file mode 100644
index 00000000000..db42420dad0
--- /dev/null
+++ b/corporate/migrations/0039_backfill_end_date_for_fixed_price_plans.py
@@ -0,0 +1,63 @@
+# Generated by Django 4.2.9 on 2024-02-21 11:53
+
+from datetime import datetime
+
+from django.db import migrations
+from django.db.backends.base.schema import BaseDatabaseSchemaEditor
+from django.db.migrations.state import StateApps
+
+
+def add_months(dt: datetime, months: int) -> datetime:
+ assert months >= 0
+ # It's fine that the max day in Feb is 28 for leap years.
+ MAX_DAY_FOR_MONTH = {
+ 1: 31,
+ 2: 28,
+ 3: 31,
+ 4: 30,
+ 5: 31,
+ 6: 30,
+ 7: 31,
+ 8: 31,
+ 9: 30,
+ 10: 31,
+ 11: 30,
+ 12: 31,
+ }
+ year = dt.year
+ month = dt.month + months
+ while month > 12:
+ year += 1
+ month -= 12
+ day = min(dt.day, MAX_DAY_FOR_MONTH[month])
+ # datetimes don't support leap seconds, so don't need to worry about those
+ return dt.replace(year=year, month=month, day=day)
+
+
+def backfill_end_date_for_fixed_price_plans(
+ apps: StateApps, schema_editor: BaseDatabaseSchemaEditor
+) -> None:
+ CustomerPlan = apps.get_model("corporate", "CustomerPlan")
+ CustomerPlan.ACTIVE = 1
+
+ fixed_price_plans = CustomerPlan.objects.filter(
+ status=CustomerPlan.ACTIVE, fixed_price__isnull=False
+ )
+ for plan in fixed_price_plans:
+ assert plan.end_date is None
+ assert plan.billing_cycle_anchor is not None
+ plan.end_date = add_months(plan.billing_cycle_anchor, 12)
+ plan.save(update_fields=["end_date"])
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ("corporate", "0038_customerplanoffer_sent_invoice_id_invoice"),
+ ]
+
+ operations = [
+ migrations.RunPython(
+ backfill_end_date_for_fixed_price_plans,
+ ),
+ ]
diff --git a/corporate/models.py b/corporate/models.py
index a4405e2910f..69b25b96716 100644
--- a/corporate/models.py
+++ b/corporate/models.py
@@ -400,6 +400,10 @@ class CustomerPlan(AbstractCustomerPlan):
NEVER_STARTED = 12
status = models.SmallIntegerField(default=ACTIVE)
+ # Currently, all the fixed-price plans are configured for one year.
+ # In future, we might change this to a field.
+ FIXED_PRICE_PLAN_DURATION_MONTHS = 12
+
# TODO maybe override setattr to ensure billing_cycle_anchor, etc
# are immutable.
diff --git a/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Customer.create.1.json b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Customer.create.1.json
new file mode 100644
index 00000000000..69a59a96f6a
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Customer.create.1.json
@@ -0,0 +1,33 @@
+{
+ "address": null,
+ "balance": 0,
+ "created": 1708008524,
+ "currency": null,
+ "default_currency": null,
+ "default_source": null,
+ "delinquent": false,
+ "description": "zulip.testserver f267ada0-3e8",
+ "discount": null,
+ "email": "[email protected]",
+ "id": "cus_PZEia820z9Zo16",
+ "invoice_prefix": "4B9E7A40",
+ "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": "f267ada0-3e8e-4c92-991d-5715db017e75"
+ },
+ "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/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Customer.modify.1.json b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Customer.modify.1.json
new file mode 100644
index 00000000000..81056872857
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Customer.modify.1.json
@@ -0,0 +1,33 @@
+{
+ "address": null,
+ "balance": 0,
+ "created": 1708008524,
+ "currency": null,
+ "default_currency": null,
+ "default_source": null,
+ "delinquent": false,
+ "description": "zulip.testserver f267ada0-3e8",
+ "discount": null,
+ "email": "[email protected]",
+ "id": "cus_PZEia820z9Zo16",
+ "invoice_prefix": "4B9E7A40",
+ "invoice_settings": {
+ "custom_fields": null,
+ "default_payment_method": "pm_1Ok6F2DEQaroqDjsaS0caoc1",
+ "footer": null,
+ "rendering_options": null
+ },
+ "livemode": false,
+ "metadata": {
+ "remote_realm_host": "zulip.testserver",
+ "remote_realm_uuid": "f267ada0-3e8e-4c92-991d-5715db017e75"
+ },
+ "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/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Customer.retrieve.1.json b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Customer.retrieve.1.json
new file mode 100644
index 00000000000..26d88ba7d9a
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Customer.retrieve.1.json
@@ -0,0 +1,80 @@
+{
+ "address": null,
+ "balance": 0,
+ "created": 1708008524,
+ "currency": null,
+ "default_currency": null,
+ "default_source": null,
+ "delinquent": false,
+ "description": "zulip.testserver f267ada0-3e8",
+ "discount": null,
+ "email": "[email protected]",
+ "id": "cus_PZEia820z9Zo16",
+ "invoice_prefix": "4B9E7A40",
+ "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",
+ "display_brand": "visa",
+ "exp_month": 2,
+ "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": 1708008528,
+ "customer": "cus_PZEia820z9Zo16",
+ "id": "pm_1Ok6F2DEQaroqDjsaS0caoc1",
+ "livemode": false,
+ "metadata": {},
+ "object": "payment_method",
+ "type": "card"
+ },
+ "footer": null,
+ "rendering_options": null
+ },
+ "livemode": false,
+ "metadata": {
+ "remote_realm_host": "zulip.testserver",
+ "remote_realm_uuid": "f267ada0-3e8e-4c92-991d-5715db017e75"
+ },
+ "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/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Customer.retrieve.2.json b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Customer.retrieve.2.json
new file mode 100644
index 00000000000..26d88ba7d9a
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Customer.retrieve.2.json
@@ -0,0 +1,80 @@
+{
+ "address": null,
+ "balance": 0,
+ "created": 1708008524,
+ "currency": null,
+ "default_currency": null,
+ "default_source": null,
+ "delinquent": false,
+ "description": "zulip.testserver f267ada0-3e8",
+ "discount": null,
+ "email": "[email protected]",
+ "id": "cus_PZEia820z9Zo16",
+ "invoice_prefix": "4B9E7A40",
+ "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",
+ "display_brand": "visa",
+ "exp_month": 2,
+ "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": 1708008528,
+ "customer": "cus_PZEia820z9Zo16",
+ "id": "pm_1Ok6F2DEQaroqDjsaS0caoc1",
+ "livemode": false,
+ "metadata": {},
+ "object": "payment_method",
+ "type": "card"
+ },
+ "footer": null,
+ "rendering_options": null
+ },
+ "livemode": false,
+ "metadata": {
+ "remote_realm_host": "zulip.testserver",
+ "remote_realm_uuid": "f267ada0-3e8e-4c92-991d-5715db017e75"
+ },
+ "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/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Customer.retrieve.3.json b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Customer.retrieve.3.json
new file mode 100644
index 00000000000..26d88ba7d9a
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Customer.retrieve.3.json
@@ -0,0 +1,80 @@
+{
+ "address": null,
+ "balance": 0,
+ "created": 1708008524,
+ "currency": null,
+ "default_currency": null,
+ "default_source": null,
+ "delinquent": false,
+ "description": "zulip.testserver f267ada0-3e8",
+ "discount": null,
+ "email": "[email protected]",
+ "id": "cus_PZEia820z9Zo16",
+ "invoice_prefix": "4B9E7A40",
+ "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",
+ "display_brand": "visa",
+ "exp_month": 2,
+ "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": 1708008528,
+ "customer": "cus_PZEia820z9Zo16",
+ "id": "pm_1Ok6F2DEQaroqDjsaS0caoc1",
+ "livemode": false,
+ "metadata": {},
+ "object": "payment_method",
+ "type": "card"
+ },
+ "footer": null,
+ "rendering_options": null
+ },
+ "livemode": false,
+ "metadata": {
+ "remote_realm_host": "zulip.testserver",
+ "remote_realm_uuid": "f267ada0-3e8e-4c92-991d-5715db017e75"
+ },
+ "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/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Customer.retrieve.4.json b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Customer.retrieve.4.json
new file mode 100644
index 00000000000..26d88ba7d9a
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Customer.retrieve.4.json
@@ -0,0 +1,80 @@
+{
+ "address": null,
+ "balance": 0,
+ "created": 1708008524,
+ "currency": null,
+ "default_currency": null,
+ "default_source": null,
+ "delinquent": false,
+ "description": "zulip.testserver f267ada0-3e8",
+ "discount": null,
+ "email": "[email protected]",
+ "id": "cus_PZEia820z9Zo16",
+ "invoice_prefix": "4B9E7A40",
+ "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",
+ "display_brand": "visa",
+ "exp_month": 2,
+ "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": 1708008528,
+ "customer": "cus_PZEia820z9Zo16",
+ "id": "pm_1Ok6F2DEQaroqDjsaS0caoc1",
+ "livemode": false,
+ "metadata": {},
+ "object": "payment_method",
+ "type": "card"
+ },
+ "footer": null,
+ "rendering_options": null
+ },
+ "livemode": false,
+ "metadata": {
+ "remote_realm_host": "zulip.testserver",
+ "remote_realm_uuid": "f267ada0-3e8e-4c92-991d-5715db017e75"
+ },
+ "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/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Event.list.1.json b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Event.list.1.json
new file mode 100644
index 00000000000..e1a91b358ec
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Event.list.1.json
@@ -0,0 +1,60 @@
+{
+ "data": [
+ {
+ "api_version": "2020-08-27",
+ "created": 1708008530,
+ "data": {
+ "object": {
+ "address": null,
+ "balance": 0,
+ "created": 1708008524,
+ "currency": null,
+ "default_currency": null,
+ "default_source": null,
+ "delinquent": false,
+ "description": "zulip.testserver f267ada0-3e8",
+ "discount": null,
+ "email": "[email protected]",
+ "id": "cus_PZEia820z9Zo16",
+ "invoice_prefix": "4B9E7A40",
+ "invoice_settings": {
+ "custom_fields": null,
+ "default_payment_method": "pm_1Ok6F2DEQaroqDjsaS0caoc1",
+ "footer": null,
+ "rendering_options": null
+ },
+ "livemode": false,
+ "metadata": {
+ "remote_realm_host": "zulip.testserver",
+ "remote_realm_uuid": "f267ada0-3e8e-4c92-991d-5715db017e75"
+ },
+ "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_1Ok6F4DEQaroqDjsJu5X6t4Y",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_8NjCZNZ5aDC1O9",
+ "idempotency_key": "38b06a5f-0d53-4a42-a7a5-82ed4a3fad9f"
+ },
+ "type": "customer.updated"
+ }
+ ],
+ "has_more": true,
+ "object": "list",
+ "url": "/v1/events"
+}
diff --git a/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Event.list.2.json b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Event.list.2.json
new file mode 100644
index 00000000000..5f8d172cc38
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Event.list.2.json
@@ -0,0 +1,1083 @@
+{
+ "data": [
+ {
+ "api_version": "2020-08-27",
+ "created": 1708008536,
+ "data": {
+ "object": {
+ "amount": 10000,
+ "amount_capturable": 0,
+ "amount_details": {
+ "tip": {}
+ },
+ "amount_received": 10000,
+ "application": null,
+ "application_fee_amount": null,
+ "automatic_payment_methods": null,
+ "canceled_at": null,
+ "cancellation_reason": null,
+ "capture_method": "automatic",
+ "charges": {
+ "data": [
+ {
+ "amount": 10000,
+ "amount_captured": 10000,
+ "amount_refunded": 0,
+ "application": null,
+ "application_fee": null,
+ "application_fee_amount": null,
+ "balance_transaction": "txn_3Ok6F8DEQaroqDjs1CHa9XYm",
+ "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": 1708008535,
+ "currency": "usd",
+ "customer": "cus_PZEia820z9Zo16",
+ "description": "Payment for Invoice",
+ "destination": null,
+ "dispute": null,
+ "disputed": false,
+ "failure_balance_transaction": null,
+ "failure_code": null,
+ "failure_message": null,
+ "fraud_details": {},
+ "id": "ch_3Ok6F8DEQaroqDjs177d5Sdi",
+ "invoice": "in_1Ok6F7DEQaroqDjslOe91xON",
+ "livemode": false,
+ "metadata": {},
+ "object": "charge",
+ "on_behalf_of": null,
+ "order": null,
+ "outcome": {
+ "network_status": "approved_by_network",
+ "reason": null,
+ "risk_level": "normal",
+ "risk_score": 10,
+ "seller_message": "Payment complete.",
+ "type": "authorized"
+ },
+ "paid": true,
+ "payment_intent": "pi_3Ok6F8DEQaroqDjs1alKvD7i",
+ "payment_method": "pm_1Ok6F2DEQaroqDjsaS0caoc1",
+ "payment_method_details": {
+ "card": {
+ "amount_authorized": 10000,
+ "brand": "visa",
+ "checks": {
+ "address_line1_check": null,
+ "address_postal_code_check": null,
+ "cvc_check": "pass"
+ },
+ "country": "US",
+ "exp_month": 2,
+ "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": 10000,
+ "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/invoices/CAcaFwoVYWNjdF8xN3ZUa3dERVFhcm9xRGpzKNjIuK4GMgbBolM-Izg6LBYDMQVCrWx64-7eGjfrGkE4poE6EXqpdTF4kibskZU5nldiNtNcbF0an9UO?s=ap",
+ "refunded": false,
+ "refunds": {
+ "data": [],
+ "has_more": false,
+ "object": "list",
+ "total_count": 0,
+ "url": "/v1/charges/ch_3Ok6F8DEQaroqDjs177d5Sdi/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_3Ok6F8DEQaroqDjs1alKvD7i"
+ },
+ "client_secret": "pi_3Ok6F8DEQaroqDjs1alKvD7i_secret_FZ8ygIrElKjBNSpvPDw0ha4CZ",
+ "confirmation_method": "automatic",
+ "created": 1708008534,
+ "currency": "usd",
+ "customer": "cus_PZEia820z9Zo16",
+ "description": "Payment for Invoice",
+ "id": "pi_3Ok6F8DEQaroqDjs1alKvD7i",
+ "invoice": "in_1Ok6F7DEQaroqDjslOe91xON",
+ "last_payment_error": null,
+ "latest_charge": "ch_3Ok6F8DEQaroqDjs177d5Sdi",
+ "livemode": false,
+ "metadata": {},
+ "next_action": null,
+ "object": "payment_intent",
+ "on_behalf_of": null,
+ "payment_method": "pm_1Ok6F2DEQaroqDjsaS0caoc1",
+ "payment_method_configuration_details": null,
+ "payment_method_options": {
+ "card": {
+ "installments": null,
+ "mandate_options": null,
+ "network": null,
+ "request_three_d_secure": "automatic"
+ },
+ "cashapp": {}
+ },
+ "payment_method_types": [
+ "card",
+ "cashapp"
+ ],
+ "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_3Ok6F8DEQaroqDjs1CRZmkvk",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_5NAIOMLpXXEH9L",
+ "idempotency_key": "6368f02d-e32c-4037-9d6b-d9fb092f5ee5"
+ },
+ "type": "payment_intent.succeeded"
+ },
+ {
+ "api_version": "2020-08-27",
+ "created": 1708008536,
+ "data": {
+ "object": {
+ "amount": 10000,
+ "amount_captured": 10000,
+ "amount_refunded": 0,
+ "application": null,
+ "application_fee": null,
+ "application_fee_amount": null,
+ "balance_transaction": "txn_3Ok6F8DEQaroqDjs1CHa9XYm",
+ "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": 1708008535,
+ "currency": "usd",
+ "customer": "cus_PZEia820z9Zo16",
+ "description": "Payment for Invoice",
+ "destination": null,
+ "dispute": null,
+ "disputed": false,
+ "failure_balance_transaction": null,
+ "failure_code": null,
+ "failure_message": null,
+ "fraud_details": {},
+ "id": "ch_3Ok6F8DEQaroqDjs177d5Sdi",
+ "invoice": "in_1Ok6F7DEQaroqDjslOe91xON",
+ "livemode": false,
+ "metadata": {},
+ "object": "charge",
+ "on_behalf_of": null,
+ "order": null,
+ "outcome": {
+ "network_status": "approved_by_network",
+ "reason": null,
+ "risk_level": "normal",
+ "risk_score": 10,
+ "seller_message": "Payment complete.",
+ "type": "authorized"
+ },
+ "paid": true,
+ "payment_intent": "pi_3Ok6F8DEQaroqDjs1alKvD7i",
+ "payment_method": "pm_1Ok6F2DEQaroqDjsaS0caoc1",
+ "payment_method_details": {
+ "card": {
+ "amount_authorized": 10000,
+ "brand": "visa",
+ "checks": {
+ "address_line1_check": null,
+ "address_postal_code_check": null,
+ "cvc_check": "pass"
+ },
+ "country": "US",
+ "exp_month": 2,
+ "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": 10000,
+ "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/invoices/CAcaFwoVYWNjdF8xN3ZUa3dERVFhcm9xRGpzKNnIuK4GMgZzKyUassg6LBa4SAPFrNtOPZwVqgtyTjdwxvulBWDa43c96J7nKX7u2dQpCZgqupOm4fdJ?s=ap",
+ "refunded": false,
+ "refunds": {
+ "data": [],
+ "has_more": false,
+ "object": "list",
+ "total_count": 0,
+ "url": "/v1/charges/ch_3Ok6F8DEQaroqDjs177d5Sdi/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_3Ok6F8DEQaroqDjs1ZhWyINC",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_5NAIOMLpXXEH9L",
+ "idempotency_key": "6368f02d-e32c-4037-9d6b-d9fb092f5ee5"
+ },
+ "type": "charge.succeeded"
+ },
+ {
+ "api_version": "2020-08-27",
+ "created": 1708008534,
+ "data": {
+ "object": {
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 10000,
+ "amount_paid": 0,
+ "amount_remaining": 10000,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 0,
+ "attempted": false,
+ "auto_advance": false,
+ "automatic_tax": {
+ "enabled": false,
+ "liability": null,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": null,
+ "collection_method": "charge_automatically",
+ "created": 1708008533,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_PZEia820z9Zo16",
+ "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": 1708008534,
+ "ending_balance": 0,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QWkVpRm5DMWQxaEhrZnV6Rnl6OWFLcXFJem5IbVNaLDk4NTQ5MzM10200tXvRivBK?s=ap",
+ "id": "in_1Ok6F7DEQaroqDjslOe91xON",
+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QWkVpRm5DMWQxaEhrZnV6Rnl6OWFLcXFJem5IbVNaLDk4NTQ5MzM10200tXvRivBK/pdf?s=ap",
+ "issuer": {
+ "type": "self"
+ },
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": 10000,
+ "amount_excluding_tax": 10000,
+ "currency": "usd",
+ "description": "Zulip Basic",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1Ok6F7DEQaroqDjs5qpv2Heh",
+ "invoice": "in_1Ok6F7DEQaroqDjslOe91xON",
+ "invoice_item": "ii_1Ok6F7DEQaroqDjs24pAIHvX",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1708008533,
+ "start": 1708008533
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1706114464,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1Oc9VcDEQaroqDjs9z5VJret",
+ "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": 10000,
+ "unit_amount_decimal": "10000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "10000"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 1,
+ "url": "/v1/invoices/in_1Ok6F7DEQaroqDjslOe91xON/lines"
+ },
+ "livemode": false,
+ "metadata": {
+ "billing_schedule": "2",
+ "license_management": "automatic",
+ "licenses": "11",
+ "plan_tier": "103"
+ },
+ "next_payment_attempt": null,
+ "number": "4B9E7A40-0001",
+ "object": "invoice",
+ "on_behalf_of": null,
+ "paid": false,
+ "paid_out_of_band": false,
+ "payment_intent": "pi_3Ok6F8DEQaroqDjs1alKvD7i",
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1708008533,
+ "period_start": 1708008533,
+ "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": "open",
+ "status_transitions": {
+ "finalized_at": 1708008534,
+ "marked_uncollectible_at": null,
+ "paid_at": null,
+ "voided_at": null
+ },
+ "subscription": null,
+ "subscription_details": {
+ "metadata": null
+ },
+ "subtotal": 10000,
+ "subtotal_excluding_tax": 10000,
+ "tax": null,
+ "test_clock": null,
+ "total": 10000,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 10000,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": 1708008534
+ }
+ },
+ "id": "evt_1Ok6F9DEQaroqDjsWqyWrElg",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_cqaAW920i6zF2h",
+ "idempotency_key": "d67722fa-2db8-4b94-b2d9-b98eaa501d38"
+ },
+ "type": "invoice.finalized"
+ },
+ {
+ "api_version": "2020-08-27",
+ "created": 1708008534,
+ "data": {
+ "object": {
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 10000,
+ "amount_paid": 0,
+ "amount_remaining": 10000,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 0,
+ "attempted": false,
+ "auto_advance": false,
+ "automatic_tax": {
+ "enabled": false,
+ "liability": null,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": null,
+ "collection_method": "charge_automatically",
+ "created": 1708008533,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_PZEia820z9Zo16",
+ "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": 1708008534,
+ "ending_balance": 0,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QWkVpRm5DMWQxaEhrZnV6Rnl6OWFLcXFJem5IbVNaLDk4NTQ5MzM10200tXvRivBK?s=ap",
+ "id": "in_1Ok6F7DEQaroqDjslOe91xON",
+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QWkVpRm5DMWQxaEhrZnV6Rnl6OWFLcXFJem5IbVNaLDk4NTQ5MzM10200tXvRivBK/pdf?s=ap",
+ "issuer": {
+ "type": "self"
+ },
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": 10000,
+ "amount_excluding_tax": 10000,
+ "currency": "usd",
+ "description": "Zulip Basic",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1Ok6F7DEQaroqDjs5qpv2Heh",
+ "invoice": "in_1Ok6F7DEQaroqDjslOe91xON",
+ "invoice_item": "ii_1Ok6F7DEQaroqDjs24pAIHvX",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1708008533,
+ "start": 1708008533
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1706114464,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1Oc9VcDEQaroqDjs9z5VJret",
+ "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": 10000,
+ "unit_amount_decimal": "10000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "10000"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 1,
+ "url": "/v1/invoices/in_1Ok6F7DEQaroqDjslOe91xON/lines"
+ },
+ "livemode": false,
+ "metadata": {
+ "billing_schedule": "2",
+ "license_management": "automatic",
+ "licenses": "11",
+ "plan_tier": "103"
+ },
+ "next_payment_attempt": null,
+ "number": "4B9E7A40-0001",
+ "object": "invoice",
+ "on_behalf_of": null,
+ "paid": false,
+ "paid_out_of_band": false,
+ "payment_intent": "pi_3Ok6F8DEQaroqDjs1alKvD7i",
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1708008533,
+ "period_start": 1708008533,
+ "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": "open",
+ "status_transitions": {
+ "finalized_at": 1708008534,
+ "marked_uncollectible_at": null,
+ "paid_at": null,
+ "voided_at": null
+ },
+ "subscription": null,
+ "subscription_details": {
+ "metadata": null
+ },
+ "subtotal": 10000,
+ "subtotal_excluding_tax": 10000,
+ "tax": null,
+ "test_clock": null,
+ "total": 10000,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 10000,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": 1708008534
+ },
+ "previous_attributes": {
+ "effective_at": null,
+ "ending_balance": null,
+ "hosted_invoice_url": null,
+ "invoice_pdf": null,
+ "number": null,
+ "payment_intent": null,
+ "rendering": {
+ "pdf": {
+ "page_size": "auto"
+ }
+ },
+ "status": "draft",
+ "status_transitions": {
+ "finalized_at": null
+ }
+ }
+ },
+ "id": "evt_1Ok6F9DEQaroqDjs0rdLQekD",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_cqaAW920i6zF2h",
+ "idempotency_key": "d67722fa-2db8-4b94-b2d9-b98eaa501d38"
+ },
+ "type": "invoice.updated"
+ },
+ {
+ "api_version": "2020-08-27",
+ "created": 1708008534,
+ "data": {
+ "object": {
+ "amount": 10000,
+ "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_3Ok6F8DEQaroqDjs1alKvD7i"
+ },
+ "client_secret": "pi_3Ok6F8DEQaroqDjs1alKvD7i_secret_FZ8ygIrElKjBNSpvPDw0ha4CZ",
+ "confirmation_method": "automatic",
+ "created": 1708008534,
+ "currency": "usd",
+ "customer": "cus_PZEia820z9Zo16",
+ "description": "Payment for Invoice",
+ "id": "pi_3Ok6F8DEQaroqDjs1alKvD7i",
+ "invoice": "in_1Ok6F7DEQaroqDjslOe91xON",
+ "last_payment_error": null,
+ "latest_charge": null,
+ "livemode": false,
+ "metadata": {},
+ "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"
+ },
+ "cashapp": {}
+ },
+ "payment_method_types": [
+ "card",
+ "cashapp"
+ ],
+ "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_3Ok6F8DEQaroqDjs1KJrwQrH",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_cqaAW920i6zF2h",
+ "idempotency_key": "d67722fa-2db8-4b94-b2d9-b98eaa501d38"
+ },
+ "type": "payment_intent.created"
+ },
+ {
+ "api_version": "2020-08-27",
+ "created": 1708008534,
+ "data": {
+ "object": {
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 10000,
+ "amount_paid": 0,
+ "amount_remaining": 10000,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 0,
+ "attempted": false,
+ "auto_advance": false,
+ "automatic_tax": {
+ "enabled": false,
+ "liability": null,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": null,
+ "collection_method": "charge_automatically",
+ "created": 1708008533,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_PZEia820z9Zo16",
+ "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_1Ok6F7DEQaroqDjslOe91xON",
+ "invoice_pdf": null,
+ "issuer": {
+ "type": "self"
+ },
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": 10000,
+ "amount_excluding_tax": 10000,
+ "currency": "usd",
+ "description": "Zulip Basic",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1Ok6F7DEQaroqDjs5qpv2Heh",
+ "invoice": "in_1Ok6F7DEQaroqDjslOe91xON",
+ "invoice_item": "ii_1Ok6F7DEQaroqDjs24pAIHvX",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1708008533,
+ "start": 1708008533
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1706114464,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1Oc9VcDEQaroqDjs9z5VJret",
+ "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": 10000,
+ "unit_amount_decimal": "10000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "10000"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 1,
+ "url": "/v1/invoices/in_1Ok6F7DEQaroqDjslOe91xON/lines"
+ },
+ "livemode": false,
+ "metadata": {
+ "billing_schedule": "2",
+ "license_management": "automatic",
+ "licenses": "11",
+ "plan_tier": "103"
+ },
+ "next_payment_attempt": null,
+ "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": 1708008533,
+ "period_start": 1708008533,
+ "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": 10000,
+ "subtotal_excluding_tax": 10000,
+ "tax": null,
+ "test_clock": null,
+ "total": 10000,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 10000,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": null
+ }
+ },
+ "id": "evt_1Ok6F8DEQaroqDjsg2dOKiij",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_bJb4CKGTE9X5e3",
+ "idempotency_key": "eb13bd62-3050-4192-ac96-284ef6890134"
+ },
+ "type": "invoice.created"
+ },
+ {
+ "api_version": "2020-08-27",
+ "created": 1708008533,
+ "data": {
+ "object": {
+ "amount": 10000,
+ "currency": "usd",
+ "customer": "cus_PZEia820z9Zo16",
+ "date": 1708008533,
+ "description": "Zulip Basic",
+ "discountable": false,
+ "discounts": [],
+ "id": "ii_1Ok6F7DEQaroqDjs24pAIHvX",
+ "invoice": null,
+ "livemode": false,
+ "metadata": {},
+ "object": "invoiceitem",
+ "period": {
+ "end": 1708008533,
+ "start": 1708008533
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1706114464,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1Oc9VcDEQaroqDjs9z5VJret",
+ "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": 10000,
+ "unit_amount_decimal": "10000"
+ },
+ "proration": false,
+ "quantity": 1,
+ "subscription": null,
+ "tax_rates": [],
+ "test_clock": null,
+ "unit_amount": 10000,
+ "unit_amount_decimal": "10000"
+ }
+ },
+ "id": "evt_1Ok6F7DEQaroqDjsZLTTK10x",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_Oy54RCH9j52o50",
+ "idempotency_key": "1812e364-61c9-4918-9f6f-bfccff47b17f"
+ },
+ "type": "invoiceitem.created"
+ },
+ {
+ "api_version": "2020-08-27",
+ "created": 1708008533,
+ "data": {
+ "object": {
+ "address": null,
+ "balance": 0,
+ "created": 1708008524,
+ "currency": "usd",
+ "default_currency": "usd",
+ "default_source": null,
+ "delinquent": false,
+ "description": "zulip.testserver f267ada0-3e8",
+ "discount": null,
+ "email": "[email protected]",
+ "id": "cus_PZEia820z9Zo16",
+ "invoice_prefix": "4B9E7A40",
+ "invoice_settings": {
+ "custom_fields": null,
+ "default_payment_method": "pm_1Ok6F2DEQaroqDjsaS0caoc1",
+ "footer": null,
+ "rendering_options": null
+ },
+ "livemode": false,
+ "metadata": {
+ "remote_realm_host": "zulip.testserver",
+ "remote_realm_uuid": "f267ada0-3e8e-4c92-991d-5715db017e75"
+ },
+ "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_1Ok6F7DEQaroqDjsg6OEkK0V",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_Oy54RCH9j52o50",
+ "idempotency_key": "1812e364-61c9-4918-9f6f-bfccff47b17f"
+ },
+ "type": "customer.updated"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "url": "/v1/events"
+}
diff --git a/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Event.list.3.json b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Event.list.3.json
new file mode 100644
index 00000000000..6ab8b29bc8e
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Event.list.3.json
@@ -0,0 +1,568 @@
+{
+ "data": [
+ {
+ "api_version": "2020-08-27",
+ "created": 1708008536,
+ "data": {
+ "object": {
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 10000,
+ "amount_paid": 10000,
+ "amount_remaining": 0,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 1,
+ "attempted": true,
+ "auto_advance": false,
+ "automatic_tax": {
+ "enabled": false,
+ "liability": null,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": "ch_3Ok6F8DEQaroqDjs177d5Sdi",
+ "collection_method": "charge_automatically",
+ "created": 1708008533,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_PZEia820z9Zo16",
+ "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": 1708008534,
+ "ending_balance": 0,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QWkVpRm5DMWQxaEhrZnV6Rnl6OWFLcXFJem5IbVNaLDk4NTQ5MzM3020040tGIsYh?s=ap",
+ "id": "in_1Ok6F7DEQaroqDjslOe91xON",
+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QWkVpRm5DMWQxaEhrZnV6Rnl6OWFLcXFJem5IbVNaLDk4NTQ5MzM3020040tGIsYh/pdf?s=ap",
+ "issuer": {
+ "type": "self"
+ },
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": 10000,
+ "amount_excluding_tax": 10000,
+ "currency": "usd",
+ "description": "Zulip Basic",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1Ok6F7DEQaroqDjs5qpv2Heh",
+ "invoice": "in_1Ok6F7DEQaroqDjslOe91xON",
+ "invoice_item": "ii_1Ok6F7DEQaroqDjs24pAIHvX",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1708008533,
+ "start": 1708008533
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1706114464,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1Oc9VcDEQaroqDjs9z5VJret",
+ "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": 10000,
+ "unit_amount_decimal": "10000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "10000"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 1,
+ "url": "/v1/invoices/in_1Ok6F7DEQaroqDjslOe91xON/lines"
+ },
+ "livemode": false,
+ "metadata": {
+ "billing_schedule": "2",
+ "license_management": "automatic",
+ "licenses": "11",
+ "plan_tier": "103"
+ },
+ "next_payment_attempt": null,
+ "number": "4B9E7A40-0001",
+ "object": "invoice",
+ "on_behalf_of": null,
+ "paid": true,
+ "paid_out_of_band": false,
+ "payment_intent": "pi_3Ok6F8DEQaroqDjs1alKvD7i",
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1708008533,
+ "period_start": 1708008533,
+ "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": 1708008534,
+ "marked_uncollectible_at": null,
+ "paid_at": 1708008535,
+ "voided_at": null
+ },
+ "subscription": null,
+ "subscription_details": {
+ "metadata": null
+ },
+ "subtotal": 10000,
+ "subtotal_excluding_tax": 10000,
+ "tax": null,
+ "test_clock": null,
+ "total": 10000,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 10000,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": 1708008534
+ }
+ },
+ "id": "evt_1Ok6FBDEQaroqDjsfrJltxrW",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_5NAIOMLpXXEH9L",
+ "idempotency_key": "6368f02d-e32c-4037-9d6b-d9fb092f5ee5"
+ },
+ "type": "invoice.payment_succeeded"
+ },
+ {
+ "api_version": "2020-08-27",
+ "created": 1708008536,
+ "data": {
+ "object": {
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 10000,
+ "amount_paid": 10000,
+ "amount_remaining": 0,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 1,
+ "attempted": true,
+ "auto_advance": false,
+ "automatic_tax": {
+ "enabled": false,
+ "liability": null,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": "ch_3Ok6F8DEQaroqDjs177d5Sdi",
+ "collection_method": "charge_automatically",
+ "created": 1708008533,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_PZEia820z9Zo16",
+ "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": 1708008534,
+ "ending_balance": 0,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QWkVpRm5DMWQxaEhrZnV6Rnl6OWFLcXFJem5IbVNaLDk4NTQ5MzM3020040tGIsYh?s=ap",
+ "id": "in_1Ok6F7DEQaroqDjslOe91xON",
+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QWkVpRm5DMWQxaEhrZnV6Rnl6OWFLcXFJem5IbVNaLDk4NTQ5MzM3020040tGIsYh/pdf?s=ap",
+ "issuer": {
+ "type": "self"
+ },
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": 10000,
+ "amount_excluding_tax": 10000,
+ "currency": "usd",
+ "description": "Zulip Basic",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1Ok6F7DEQaroqDjs5qpv2Heh",
+ "invoice": "in_1Ok6F7DEQaroqDjslOe91xON",
+ "invoice_item": "ii_1Ok6F7DEQaroqDjs24pAIHvX",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1708008533,
+ "start": 1708008533
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1706114464,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1Oc9VcDEQaroqDjs9z5VJret",
+ "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": 10000,
+ "unit_amount_decimal": "10000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "10000"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 1,
+ "url": "/v1/invoices/in_1Ok6F7DEQaroqDjslOe91xON/lines"
+ },
+ "livemode": false,
+ "metadata": {
+ "billing_schedule": "2",
+ "license_management": "automatic",
+ "licenses": "11",
+ "plan_tier": "103"
+ },
+ "next_payment_attempt": null,
+ "number": "4B9E7A40-0001",
+ "object": "invoice",
+ "on_behalf_of": null,
+ "paid": true,
+ "paid_out_of_band": false,
+ "payment_intent": "pi_3Ok6F8DEQaroqDjs1alKvD7i",
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1708008533,
+ "period_start": 1708008533,
+ "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": 1708008534,
+ "marked_uncollectible_at": null,
+ "paid_at": 1708008535,
+ "voided_at": null
+ },
+ "subscription": null,
+ "subscription_details": {
+ "metadata": null
+ },
+ "subtotal": 10000,
+ "subtotal_excluding_tax": 10000,
+ "tax": null,
+ "test_clock": null,
+ "total": 10000,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 10000,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": 1708008534
+ }
+ },
+ "id": "evt_1Ok6FBDEQaroqDjs3ywvu0ze",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_5NAIOMLpXXEH9L",
+ "idempotency_key": "6368f02d-e32c-4037-9d6b-d9fb092f5ee5"
+ },
+ "type": "invoice.paid"
+ },
+ {
+ "api_version": "2020-08-27",
+ "created": 1708008536,
+ "data": {
+ "object": {
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 10000,
+ "amount_paid": 10000,
+ "amount_remaining": 0,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 1,
+ "attempted": true,
+ "auto_advance": false,
+ "automatic_tax": {
+ "enabled": false,
+ "liability": null,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": "ch_3Ok6F8DEQaroqDjs177d5Sdi",
+ "collection_method": "charge_automatically",
+ "created": 1708008533,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_PZEia820z9Zo16",
+ "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": 1708008534,
+ "ending_balance": 0,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QWkVpRm5DMWQxaEhrZnV6Rnl6OWFLcXFJem5IbVNaLDk4NTQ5MzM3020040tGIsYh?s=ap",
+ "id": "in_1Ok6F7DEQaroqDjslOe91xON",
+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QWkVpRm5DMWQxaEhrZnV6Rnl6OWFLcXFJem5IbVNaLDk4NTQ5MzM3020040tGIsYh/pdf?s=ap",
+ "issuer": {
+ "type": "self"
+ },
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": 10000,
+ "amount_excluding_tax": 10000,
+ "currency": "usd",
+ "description": "Zulip Basic",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1Ok6F7DEQaroqDjs5qpv2Heh",
+ "invoice": "in_1Ok6F7DEQaroqDjslOe91xON",
+ "invoice_item": "ii_1Ok6F7DEQaroqDjs24pAIHvX",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1708008533,
+ "start": 1708008533
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1706114464,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1Oc9VcDEQaroqDjs9z5VJret",
+ "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": 10000,
+ "unit_amount_decimal": "10000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "10000"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 1,
+ "url": "/v1/invoices/in_1Ok6F7DEQaroqDjslOe91xON/lines"
+ },
+ "livemode": false,
+ "metadata": {
+ "billing_schedule": "2",
+ "license_management": "automatic",
+ "licenses": "11",
+ "plan_tier": "103"
+ },
+ "next_payment_attempt": null,
+ "number": "4B9E7A40-0001",
+ "object": "invoice",
+ "on_behalf_of": null,
+ "paid": true,
+ "paid_out_of_band": false,
+ "payment_intent": "pi_3Ok6F8DEQaroqDjs1alKvD7i",
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1708008533,
+ "period_start": 1708008533,
+ "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": 1708008534,
+ "marked_uncollectible_at": null,
+ "paid_at": 1708008535,
+ "voided_at": null
+ },
+ "subscription": null,
+ "subscription_details": {
+ "metadata": null
+ },
+ "subtotal": 10000,
+ "subtotal_excluding_tax": 10000,
+ "tax": null,
+ "test_clock": null,
+ "total": 10000,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 10000,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": 1708008534
+ },
+ "previous_attributes": {
+ "amount_paid": 0,
+ "amount_remaining": 10000,
+ "attempt_count": 0,
+ "attempted": false,
+ "charge": null,
+ "paid": false,
+ "status": "open",
+ "status_transitions": {
+ "paid_at": null
+ }
+ }
+ },
+ "id": "evt_1Ok6FBDEQaroqDjsHTkMhuv8",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_5NAIOMLpXXEH9L",
+ "idempotency_key": "6368f02d-e32c-4037-9d6b-d9fb092f5ee5"
+ },
+ "type": "invoice.updated"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "url": "/v1/events"
+}
diff --git a/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Event.list.4.json b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Event.list.4.json
new file mode 100644
index 00000000000..6d922067afe
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Event.list.4.json
@@ -0,0 +1,6 @@
+{
+ "data": [],
+ "has_more": false,
+ "object": "list",
+ "url": "/v1/events"
+}
diff --git a/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.create.1.json b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.create.1.json
new file mode 100644
index 00000000000..fb372cc999c
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.create.1.json
@@ -0,0 +1,168 @@
+{
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 10000,
+ "amount_paid": 0,
+ "amount_remaining": 10000,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 0,
+ "attempted": false,
+ "auto_advance": false,
+ "automatic_tax": {
+ "enabled": false,
+ "liability": null,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": null,
+ "collection_method": "charge_automatically",
+ "created": 1708008533,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_PZEia820z9Zo16",
+ "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_1Ok6F7DEQaroqDjslOe91xON",
+ "invoice_pdf": null,
+ "issuer": {
+ "type": "self"
+ },
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": 10000,
+ "amount_excluding_tax": 10000,
+ "currency": "usd",
+ "description": "Zulip Basic",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1Ok6F7DEQaroqDjs5qpv2Heh",
+ "invoice": "in_1Ok6F7DEQaroqDjslOe91xON",
+ "invoice_item": "ii_1Ok6F7DEQaroqDjs24pAIHvX",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1708008533,
+ "start": 1708008533
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1706114464,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1Oc9VcDEQaroqDjs9z5VJret",
+ "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": 10000,
+ "unit_amount_decimal": "10000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "10000"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 1,
+ "url": "/v1/invoices/in_1Ok6F7DEQaroqDjslOe91xON/lines"
+ },
+ "livemode": false,
+ "metadata": {
+ "billing_schedule": "2",
+ "license_management": "automatic",
+ "licenses": "11",
+ "plan_tier": "103"
+ },
+ "next_payment_attempt": null,
+ "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": 1708008533,
+ "period_start": 1708008533,
+ "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": 10000,
+ "subtotal_excluding_tax": 10000,
+ "tax": null,
+ "test_clock": null,
+ "total": 10000,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 10000,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": null
+}
diff --git a/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.create.10.json b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.create.10.json
new file mode 100644
index 00000000000..a98c7ba9e36
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.create.10.json
@@ -0,0 +1,163 @@
+{
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 10000,
+ "amount_paid": 0,
+ "amount_remaining": 10000,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 0,
+ "attempted": false,
+ "auto_advance": true,
+ "automatic_tax": {
+ "enabled": false,
+ "liability": null,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": null,
+ "collection_method": "charge_automatically",
+ "created": 1708008556,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_PZEia820z9Zo16",
+ "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_1Ok6FUDEQaroqDjsXHkqSdRn",
+ "invoice_pdf": null,
+ "issuer": {
+ "type": "self"
+ },
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": 10000,
+ "amount_excluding_tax": 10000,
+ "currency": "usd",
+ "description": "Zulip Basic - renewal",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1Ok6FTDEQaroqDjsC0czKUmL",
+ "invoice": "in_1Ok6FUDEQaroqDjsXHkqSdRn",
+ "invoice_item": "ii_1Ok6FTDEQaroqDjs4iYz8E5l",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1351825445,
+ "start": 1349147045
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1708006262,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1Ok5eUDEQaroqDjshX1NDxnx",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PL1wqMUzILAcbD",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 10000,
+ "unit_amount_decimal": "10000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "10000"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 1,
+ "url": "/v1/invoices/in_1Ok6FUDEQaroqDjsXHkqSdRn/lines"
+ },
+ "livemode": false,
+ "metadata": {},
+ "next_payment_attempt": 1708012156,
+ "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": 1708008556,
+ "period_start": 1708008556,
+ "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": 10000,
+ "subtotal_excluding_tax": 10000,
+ "tax": null,
+ "test_clock": null,
+ "total": 10000,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 10000,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": null
+}
diff --git a/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.create.11.json b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.create.11.json
new file mode 100644
index 00000000000..a747eb63d2b
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.create.11.json
@@ -0,0 +1,163 @@
+{
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 10000,
+ "amount_paid": 0,
+ "amount_remaining": 10000,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 0,
+ "attempted": false,
+ "auto_advance": true,
+ "automatic_tax": {
+ "enabled": false,
+ "liability": null,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": null,
+ "collection_method": "charge_automatically",
+ "created": 1708008558,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_PZEia820z9Zo16",
+ "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_1Ok6FWDEQaroqDjsJ19FPr2z",
+ "invoice_pdf": null,
+ "issuer": {
+ "type": "self"
+ },
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": 10000,
+ "amount_excluding_tax": 10000,
+ "currency": "usd",
+ "description": "Zulip Basic - renewal",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1Ok6FVDEQaroqDjsU0vwtWFA",
+ "invoice": "in_1Ok6FWDEQaroqDjsJ19FPr2z",
+ "invoice_item": "ii_1Ok6FVDEQaroqDjsF610cGBM",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1354417445,
+ "start": 1351825445
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1708006262,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1Ok5eUDEQaroqDjshX1NDxnx",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PL1wqMUzILAcbD",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 10000,
+ "unit_amount_decimal": "10000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "10000"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 1,
+ "url": "/v1/invoices/in_1Ok6FWDEQaroqDjsJ19FPr2z/lines"
+ },
+ "livemode": false,
+ "metadata": {},
+ "next_payment_attempt": 1708012158,
+ "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": 1708008558,
+ "period_start": 1708008558,
+ "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": 10000,
+ "subtotal_excluding_tax": 10000,
+ "tax": null,
+ "test_clock": null,
+ "total": 10000,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 10000,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": null
+}
diff --git a/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.create.12.json b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.create.12.json
new file mode 100644
index 00000000000..cf4ca25f3d9
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.create.12.json
@@ -0,0 +1,163 @@
+{
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 10000,
+ "amount_paid": 0,
+ "amount_remaining": 10000,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 0,
+ "attempted": false,
+ "auto_advance": true,
+ "automatic_tax": {
+ "enabled": false,
+ "liability": null,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": null,
+ "collection_method": "charge_automatically",
+ "created": 1708008560,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_PZEia820z9Zo16",
+ "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_1Ok6FYDEQaroqDjsEpZnXYMn",
+ "invoice_pdf": null,
+ "issuer": {
+ "type": "self"
+ },
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": 10000,
+ "amount_excluding_tax": 10000,
+ "currency": "usd",
+ "description": "Zulip Basic - renewal",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1Ok6FXDEQaroqDjsAwIlpkZG",
+ "invoice": "in_1Ok6FYDEQaroqDjsEpZnXYMn",
+ "invoice_item": "ii_1Ok6FXDEQaroqDjstkBNGP1P",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1357095845,
+ "start": 1354417445
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1708006262,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1Ok5eUDEQaroqDjshX1NDxnx",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PL1wqMUzILAcbD",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 10000,
+ "unit_amount_decimal": "10000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "10000"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 1,
+ "url": "/v1/invoices/in_1Ok6FYDEQaroqDjsEpZnXYMn/lines"
+ },
+ "livemode": false,
+ "metadata": {},
+ "next_payment_attempt": 1708012160,
+ "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": 1708008560,
+ "period_start": 1708008560,
+ "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": 10000,
+ "subtotal_excluding_tax": 10000,
+ "tax": null,
+ "test_clock": null,
+ "total": 10000,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 10000,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": null
+}
diff --git a/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.create.13.json b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.create.13.json
new file mode 100644
index 00000000000..55464796b60
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.create.13.json
@@ -0,0 +1,163 @@
+{
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 14166,
+ "amount_paid": 0,
+ "amount_remaining": 14166,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 0,
+ "attempted": false,
+ "auto_advance": true,
+ "automatic_tax": {
+ "enabled": false,
+ "liability": null,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": null,
+ "collection_method": "charge_automatically",
+ "created": 1708008562,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_PZEia820z9Zo16",
+ "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_1Ok6FaDEQaroqDjsU4FjJIJF",
+ "invoice_pdf": null,
+ "issuer": {
+ "type": "self"
+ },
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": 14166,
+ "amount_excluding_tax": 14166,
+ "currency": "usd",
+ "description": "Zulip Basic - renewal",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1Ok6FZDEQaroqDjsb3vqKZkB",
+ "invoice": "in_1Ok6FaDEQaroqDjsU4FjJIJF",
+ "invoice_item": "ii_1Ok6FZDEQaroqDjsrVeibhC4",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1359774245,
+ "start": 1357095845
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1708008561,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1Ok6FZDEQaroqDjslmbiQTS8",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PL1wqMUzILAcbD",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 14166,
+ "unit_amount_decimal": "14166"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "14166"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 1,
+ "url": "/v1/invoices/in_1Ok6FaDEQaroqDjsU4FjJIJF/lines"
+ },
+ "livemode": false,
+ "metadata": {},
+ "next_payment_attempt": 1708012162,
+ "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": 1708008562,
+ "period_start": 1708008562,
+ "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": 14166,
+ "subtotal_excluding_tax": 14166,
+ "tax": null,
+ "test_clock": null,
+ "total": 14166,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 14166,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": null
+}
diff --git a/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.create.2.json b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.create.2.json
new file mode 100644
index 00000000000..488cef05bb4
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.create.2.json
@@ -0,0 +1,163 @@
+{
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 10000,
+ "amount_paid": 0,
+ "amount_remaining": 10000,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 0,
+ "attempted": false,
+ "auto_advance": true,
+ "automatic_tax": {
+ "enabled": false,
+ "liability": null,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": null,
+ "collection_method": "charge_automatically",
+ "created": 1708008539,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_PZEia820z9Zo16",
+ "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_1Ok6FDDEQaroqDjsOmsu3UGH",
+ "invoice_pdf": null,
+ "issuer": {
+ "type": "self"
+ },
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": 10000,
+ "amount_excluding_tax": 10000,
+ "currency": "usd",
+ "description": "Zulip Basic - renewal",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1Ok6FDDEQaroqDjsqcURxFCm",
+ "invoice": "in_1Ok6FDDEQaroqDjsOmsu3UGH",
+ "invoice_item": "ii_1Ok6FDDEQaroqDjsobmrF8r5",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1330657445,
+ "start": 1328151845
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1708006262,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1Ok5eUDEQaroqDjshX1NDxnx",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PL1wqMUzILAcbD",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 10000,
+ "unit_amount_decimal": "10000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "10000"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 1,
+ "url": "/v1/invoices/in_1Ok6FDDEQaroqDjsOmsu3UGH/lines"
+ },
+ "livemode": false,
+ "metadata": {},
+ "next_payment_attempt": 1708012139,
+ "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": 1708008539,
+ "period_start": 1708008539,
+ "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": 10000,
+ "subtotal_excluding_tax": 10000,
+ "tax": null,
+ "test_clock": null,
+ "total": 10000,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 10000,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": null
+}
diff --git a/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.create.3.json b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.create.3.json
new file mode 100644
index 00000000000..ecbafd2b759
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.create.3.json
@@ -0,0 +1,163 @@
+{
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 10000,
+ "amount_paid": 0,
+ "amount_remaining": 10000,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 0,
+ "attempted": false,
+ "auto_advance": true,
+ "automatic_tax": {
+ "enabled": false,
+ "liability": null,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": null,
+ "collection_method": "charge_automatically",
+ "created": 1708008541,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_PZEia820z9Zo16",
+ "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_1Ok6FFDEQaroqDjsLt19vWWG",
+ "invoice_pdf": null,
+ "issuer": {
+ "type": "self"
+ },
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": 10000,
+ "amount_excluding_tax": 10000,
+ "currency": "usd",
+ "description": "Zulip Basic - renewal",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1Ok6FFDEQaroqDjsokI1EFt8",
+ "invoice": "in_1Ok6FFDEQaroqDjsLt19vWWG",
+ "invoice_item": "ii_1Ok6FFDEQaroqDjs5Ax5K3un",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1333335845,
+ "start": 1330657445
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1708006262,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1Ok5eUDEQaroqDjshX1NDxnx",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PL1wqMUzILAcbD",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 10000,
+ "unit_amount_decimal": "10000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "10000"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 1,
+ "url": "/v1/invoices/in_1Ok6FFDEQaroqDjsLt19vWWG/lines"
+ },
+ "livemode": false,
+ "metadata": {},
+ "next_payment_attempt": 1708012141,
+ "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": 1708008541,
+ "period_start": 1708008541,
+ "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": 10000,
+ "subtotal_excluding_tax": 10000,
+ "tax": null,
+ "test_clock": null,
+ "total": 10000,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 10000,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": null
+}
diff --git a/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.create.4.json b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.create.4.json
new file mode 100644
index 00000000000..4e9ce8971bb
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.create.4.json
@@ -0,0 +1,163 @@
+{
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 10000,
+ "amount_paid": 0,
+ "amount_remaining": 10000,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 0,
+ "attempted": false,
+ "auto_advance": true,
+ "automatic_tax": {
+ "enabled": false,
+ "liability": null,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": null,
+ "collection_method": "charge_automatically",
+ "created": 1708008543,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_PZEia820z9Zo16",
+ "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_1Ok6FHDEQaroqDjsjETDjm3N",
+ "invoice_pdf": null,
+ "issuer": {
+ "type": "self"
+ },
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": 10000,
+ "amount_excluding_tax": 10000,
+ "currency": "usd",
+ "description": "Zulip Basic - renewal",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1Ok6FHDEQaroqDjsuaJsHLX7",
+ "invoice": "in_1Ok6FHDEQaroqDjsjETDjm3N",
+ "invoice_item": "ii_1Ok6FHDEQaroqDjsYbai5bKM",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1335927845,
+ "start": 1333335845
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1708006262,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1Ok5eUDEQaroqDjshX1NDxnx",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PL1wqMUzILAcbD",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 10000,
+ "unit_amount_decimal": "10000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "10000"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 1,
+ "url": "/v1/invoices/in_1Ok6FHDEQaroqDjsjETDjm3N/lines"
+ },
+ "livemode": false,
+ "metadata": {},
+ "next_payment_attempt": 1708012143,
+ "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": 1708008543,
+ "period_start": 1708008543,
+ "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": 10000,
+ "subtotal_excluding_tax": 10000,
+ "tax": null,
+ "test_clock": null,
+ "total": 10000,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 10000,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": null
+}
diff --git a/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.create.5.json b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.create.5.json
new file mode 100644
index 00000000000..a23b2b203a7
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.create.5.json
@@ -0,0 +1,163 @@
+{
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 10000,
+ "amount_paid": 0,
+ "amount_remaining": 10000,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 0,
+ "attempted": false,
+ "auto_advance": true,
+ "automatic_tax": {
+ "enabled": false,
+ "liability": null,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": null,
+ "collection_method": "charge_automatically",
+ "created": 1708008545,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_PZEia820z9Zo16",
+ "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_1Ok6FJDEQaroqDjsr5vNb1mu",
+ "invoice_pdf": null,
+ "issuer": {
+ "type": "self"
+ },
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": 10000,
+ "amount_excluding_tax": 10000,
+ "currency": "usd",
+ "description": "Zulip Basic - renewal",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1Ok6FJDEQaroqDjsbuUtMsbz",
+ "invoice": "in_1Ok6FJDEQaroqDjsr5vNb1mu",
+ "invoice_item": "ii_1Ok6FJDEQaroqDjsYiAZ5f7J",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1338606245,
+ "start": 1335927845
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1708006262,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1Ok5eUDEQaroqDjshX1NDxnx",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PL1wqMUzILAcbD",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 10000,
+ "unit_amount_decimal": "10000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "10000"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 1,
+ "url": "/v1/invoices/in_1Ok6FJDEQaroqDjsr5vNb1mu/lines"
+ },
+ "livemode": false,
+ "metadata": {},
+ "next_payment_attempt": 1708012145,
+ "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": 1708008545,
+ "period_start": 1708008545,
+ "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": 10000,
+ "subtotal_excluding_tax": 10000,
+ "tax": null,
+ "test_clock": null,
+ "total": 10000,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 10000,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": null
+}
diff --git a/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.create.6.json b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.create.6.json
new file mode 100644
index 00000000000..da25f5b0e7d
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.create.6.json
@@ -0,0 +1,163 @@
+{
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 10000,
+ "amount_paid": 0,
+ "amount_remaining": 10000,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 0,
+ "attempted": false,
+ "auto_advance": true,
+ "automatic_tax": {
+ "enabled": false,
+ "liability": null,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": null,
+ "collection_method": "charge_automatically",
+ "created": 1708008547,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_PZEia820z9Zo16",
+ "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_1Ok6FLDEQaroqDjscwwAP1gG",
+ "invoice_pdf": null,
+ "issuer": {
+ "type": "self"
+ },
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": 10000,
+ "amount_excluding_tax": 10000,
+ "currency": "usd",
+ "description": "Zulip Basic - renewal",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1Ok6FLDEQaroqDjsMtJKF1V2",
+ "invoice": "in_1Ok6FLDEQaroqDjscwwAP1gG",
+ "invoice_item": "ii_1Ok6FLDEQaroqDjsJ8fkxeT2",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1341198245,
+ "start": 1338606245
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1708006262,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1Ok5eUDEQaroqDjshX1NDxnx",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PL1wqMUzILAcbD",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 10000,
+ "unit_amount_decimal": "10000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "10000"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 1,
+ "url": "/v1/invoices/in_1Ok6FLDEQaroqDjscwwAP1gG/lines"
+ },
+ "livemode": false,
+ "metadata": {},
+ "next_payment_attempt": 1708012147,
+ "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": 1708008547,
+ "period_start": 1708008547,
+ "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": 10000,
+ "subtotal_excluding_tax": 10000,
+ "tax": null,
+ "test_clock": null,
+ "total": 10000,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 10000,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": null
+}
diff --git a/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.create.7.json b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.create.7.json
new file mode 100644
index 00000000000..5661602fd1e
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.create.7.json
@@ -0,0 +1,163 @@
+{
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 10000,
+ "amount_paid": 0,
+ "amount_remaining": 10000,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 0,
+ "attempted": false,
+ "auto_advance": true,
+ "automatic_tax": {
+ "enabled": false,
+ "liability": null,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": null,
+ "collection_method": "charge_automatically",
+ "created": 1708008550,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_PZEia820z9Zo16",
+ "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_1Ok6FODEQaroqDjsxAen1rCO",
+ "invoice_pdf": null,
+ "issuer": {
+ "type": "self"
+ },
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": 10000,
+ "amount_excluding_tax": 10000,
+ "currency": "usd",
+ "description": "Zulip Basic - renewal",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1Ok6FNDEQaroqDjsj9Abe5vE",
+ "invoice": "in_1Ok6FODEQaroqDjsxAen1rCO",
+ "invoice_item": "ii_1Ok6FNDEQaroqDjsqzHmAwmk",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1343876645,
+ "start": 1341198245
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1708006262,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1Ok5eUDEQaroqDjshX1NDxnx",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PL1wqMUzILAcbD",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 10000,
+ "unit_amount_decimal": "10000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "10000"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 1,
+ "url": "/v1/invoices/in_1Ok6FODEQaroqDjsxAen1rCO/lines"
+ },
+ "livemode": false,
+ "metadata": {},
+ "next_payment_attempt": 1708012150,
+ "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": 1708008550,
+ "period_start": 1708008550,
+ "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": 10000,
+ "subtotal_excluding_tax": 10000,
+ "tax": null,
+ "test_clock": null,
+ "total": 10000,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 10000,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": null
+}
diff --git a/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.create.8.json b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.create.8.json
new file mode 100644
index 00000000000..913c7957a3b
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.create.8.json
@@ -0,0 +1,163 @@
+{
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 10000,
+ "amount_paid": 0,
+ "amount_remaining": 10000,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 0,
+ "attempted": false,
+ "auto_advance": true,
+ "automatic_tax": {
+ "enabled": false,
+ "liability": null,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": null,
+ "collection_method": "charge_automatically",
+ "created": 1708008552,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_PZEia820z9Zo16",
+ "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_1Ok6FQDEQaroqDjskVWg8EKf",
+ "invoice_pdf": null,
+ "issuer": {
+ "type": "self"
+ },
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": 10000,
+ "amount_excluding_tax": 10000,
+ "currency": "usd",
+ "description": "Zulip Basic - renewal",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1Ok6FPDEQaroqDjsFiW413HO",
+ "invoice": "in_1Ok6FQDEQaroqDjskVWg8EKf",
+ "invoice_item": "ii_1Ok6FPDEQaroqDjsgUXTYMsr",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1346555045,
+ "start": 1343876645
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1708006262,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1Ok5eUDEQaroqDjshX1NDxnx",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PL1wqMUzILAcbD",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 10000,
+ "unit_amount_decimal": "10000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "10000"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 1,
+ "url": "/v1/invoices/in_1Ok6FQDEQaroqDjskVWg8EKf/lines"
+ },
+ "livemode": false,
+ "metadata": {},
+ "next_payment_attempt": 1708012152,
+ "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": 1708008552,
+ "period_start": 1708008552,
+ "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": 10000,
+ "subtotal_excluding_tax": 10000,
+ "tax": null,
+ "test_clock": null,
+ "total": 10000,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 10000,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": null
+}
diff --git a/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.create.9.json b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.create.9.json
new file mode 100644
index 00000000000..e4c3f619f11
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.create.9.json
@@ -0,0 +1,163 @@
+{
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 10000,
+ "amount_paid": 0,
+ "amount_remaining": 10000,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 0,
+ "attempted": false,
+ "auto_advance": true,
+ "automatic_tax": {
+ "enabled": false,
+ "liability": null,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": null,
+ "collection_method": "charge_automatically",
+ "created": 1708008553,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_PZEia820z9Zo16",
+ "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_1Ok6FSDEQaroqDjselZMgjkA",
+ "invoice_pdf": null,
+ "issuer": {
+ "type": "self"
+ },
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": 10000,
+ "amount_excluding_tax": 10000,
+ "currency": "usd",
+ "description": "Zulip Basic - renewal",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1Ok6FRDEQaroqDjs9qv4Oyjo",
+ "invoice": "in_1Ok6FSDEQaroqDjselZMgjkA",
+ "invoice_item": "ii_1Ok6FRDEQaroqDjsxxNJcAA3",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1349147045,
+ "start": 1346555045
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1708006262,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1Ok5eUDEQaroqDjshX1NDxnx",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PL1wqMUzILAcbD",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 10000,
+ "unit_amount_decimal": "10000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "10000"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 1,
+ "url": "/v1/invoices/in_1Ok6FSDEQaroqDjselZMgjkA/lines"
+ },
+ "livemode": false,
+ "metadata": {},
+ "next_payment_attempt": 1708012153,
+ "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": 1708008553,
+ "period_start": 1708008553,
+ "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": 10000,
+ "subtotal_excluding_tax": 10000,
+ "tax": null,
+ "test_clock": null,
+ "total": 10000,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 10000,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": null
+}
diff --git a/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.finalize_invoice.1.json b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.finalize_invoice.1.json
new file mode 100644
index 00000000000..d537de05a7b
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.finalize_invoice.1.json
@@ -0,0 +1,168 @@
+{
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 10000,
+ "amount_paid": 0,
+ "amount_remaining": 10000,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 0,
+ "attempted": false,
+ "auto_advance": false,
+ "automatic_tax": {
+ "enabled": false,
+ "liability": null,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": null,
+ "collection_method": "charge_automatically",
+ "created": 1708008533,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_PZEia820z9Zo16",
+ "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": 1708008534,
+ "ending_balance": 0,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QWkVpRm5DMWQxaEhrZnV6Rnl6OWFLcXFJem5IbVNaLDk4NTQ5MzM00200r2lvslrL?s=ap",
+ "id": "in_1Ok6F7DEQaroqDjslOe91xON",
+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QWkVpRm5DMWQxaEhrZnV6Rnl6OWFLcXFJem5IbVNaLDk4NTQ5MzM00200r2lvslrL/pdf?s=ap",
+ "issuer": {
+ "type": "self"
+ },
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": 10000,
+ "amount_excluding_tax": 10000,
+ "currency": "usd",
+ "description": "Zulip Basic",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1Ok6F7DEQaroqDjs5qpv2Heh",
+ "invoice": "in_1Ok6F7DEQaroqDjslOe91xON",
+ "invoice_item": "ii_1Ok6F7DEQaroqDjs24pAIHvX",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1708008533,
+ "start": 1708008533
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1706114464,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1Oc9VcDEQaroqDjs9z5VJret",
+ "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": 10000,
+ "unit_amount_decimal": "10000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "10000"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 1,
+ "url": "/v1/invoices/in_1Ok6F7DEQaroqDjslOe91xON/lines"
+ },
+ "livemode": false,
+ "metadata": {
+ "billing_schedule": "2",
+ "license_management": "automatic",
+ "licenses": "11",
+ "plan_tier": "103"
+ },
+ "next_payment_attempt": null,
+ "number": "4B9E7A40-0001",
+ "object": "invoice",
+ "on_behalf_of": null,
+ "paid": false,
+ "paid_out_of_band": false,
+ "payment_intent": "pi_3Ok6F8DEQaroqDjs1alKvD7i",
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1708008533,
+ "period_start": 1708008533,
+ "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": "open",
+ "status_transitions": {
+ "finalized_at": 1708008534,
+ "marked_uncollectible_at": null,
+ "paid_at": null,
+ "voided_at": null
+ },
+ "subscription": null,
+ "subscription_details": {
+ "metadata": null
+ },
+ "subtotal": 10000,
+ "subtotal_excluding_tax": 10000,
+ "tax": null,
+ "test_clock": null,
+ "total": 10000,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 10000,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": 1708008534
+}
diff --git a/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.finalize_invoice.10.json b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.finalize_invoice.10.json
new file mode 100644
index 00000000000..34039529380
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.finalize_invoice.10.json
@@ -0,0 +1,163 @@
+{
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 10000,
+ "amount_paid": 0,
+ "amount_remaining": 10000,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 0,
+ "attempted": false,
+ "auto_advance": true,
+ "automatic_tax": {
+ "enabled": false,
+ "liability": null,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": null,
+ "collection_method": "charge_automatically",
+ "created": 1708008556,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_PZEia820z9Zo16",
+ "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": 1708008556,
+ "ending_balance": 0,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QWkVpR0M2TUMxVkNmbXI1ZmJqRWRIVmxqZXNBQkFzLDk4NTQ5MzU30200aoiW5hr5?s=ap",
+ "id": "in_1Ok6FUDEQaroqDjsXHkqSdRn",
+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QWkVpR0M2TUMxVkNmbXI1ZmJqRWRIVmxqZXNBQkFzLDk4NTQ5MzU30200aoiW5hr5/pdf?s=ap",
+ "issuer": {
+ "type": "self"
+ },
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": 10000,
+ "amount_excluding_tax": 10000,
+ "currency": "usd",
+ "description": "Zulip Basic - renewal",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1Ok6FTDEQaroqDjsC0czKUmL",
+ "invoice": "in_1Ok6FUDEQaroqDjsXHkqSdRn",
+ "invoice_item": "ii_1Ok6FTDEQaroqDjs4iYz8E5l",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1351825445,
+ "start": 1349147045
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1708006262,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1Ok5eUDEQaroqDjshX1NDxnx",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PL1wqMUzILAcbD",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 10000,
+ "unit_amount_decimal": "10000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "10000"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 1,
+ "url": "/v1/invoices/in_1Ok6FUDEQaroqDjsXHkqSdRn/lines"
+ },
+ "livemode": false,
+ "metadata": {},
+ "next_payment_attempt": 1708012156,
+ "number": "4B9E7A40-0010",
+ "object": "invoice",
+ "on_behalf_of": null,
+ "paid": false,
+ "paid_out_of_band": false,
+ "payment_intent": "pi_3Ok6FUDEQaroqDjs0Qh3LAW4",
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1708008556,
+ "period_start": 1708008556,
+ "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": "open",
+ "status_transitions": {
+ "finalized_at": 1708008556,
+ "marked_uncollectible_at": null,
+ "paid_at": null,
+ "voided_at": null
+ },
+ "subscription": null,
+ "subscription_details": {
+ "metadata": null
+ },
+ "subtotal": 10000,
+ "subtotal_excluding_tax": 10000,
+ "tax": null,
+ "test_clock": null,
+ "total": 10000,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 10000,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": 1708008556
+}
diff --git a/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.finalize_invoice.11.json b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.finalize_invoice.11.json
new file mode 100644
index 00000000000..122319e7a78
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.finalize_invoice.11.json
@@ -0,0 +1,163 @@
+{
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 10000,
+ "amount_paid": 0,
+ "amount_remaining": 10000,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 0,
+ "attempted": false,
+ "auto_advance": true,
+ "automatic_tax": {
+ "enabled": false,
+ "liability": null,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": null,
+ "collection_method": "charge_automatically",
+ "created": 1708008558,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_PZEia820z9Zo16",
+ "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": 1708008558,
+ "ending_balance": 0,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QWkVpWjBVZEdGdUIxSWdkaG82VUJtaUtOQVFBM1RNLDk4NTQ5MzU50200L46Pn7da?s=ap",
+ "id": "in_1Ok6FWDEQaroqDjsJ19FPr2z",
+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QWkVpWjBVZEdGdUIxSWdkaG82VUJtaUtOQVFBM1RNLDk4NTQ5MzU50200L46Pn7da/pdf?s=ap",
+ "issuer": {
+ "type": "self"
+ },
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": 10000,
+ "amount_excluding_tax": 10000,
+ "currency": "usd",
+ "description": "Zulip Basic - renewal",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1Ok6FVDEQaroqDjsU0vwtWFA",
+ "invoice": "in_1Ok6FWDEQaroqDjsJ19FPr2z",
+ "invoice_item": "ii_1Ok6FVDEQaroqDjsF610cGBM",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1354417445,
+ "start": 1351825445
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1708006262,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1Ok5eUDEQaroqDjshX1NDxnx",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PL1wqMUzILAcbD",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 10000,
+ "unit_amount_decimal": "10000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "10000"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 1,
+ "url": "/v1/invoices/in_1Ok6FWDEQaroqDjsJ19FPr2z/lines"
+ },
+ "livemode": false,
+ "metadata": {},
+ "next_payment_attempt": 1708012158,
+ "number": "4B9E7A40-0011",
+ "object": "invoice",
+ "on_behalf_of": null,
+ "paid": false,
+ "paid_out_of_band": false,
+ "payment_intent": "pi_3Ok6FWDEQaroqDjs0OcdvUja",
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1708008558,
+ "period_start": 1708008558,
+ "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": "open",
+ "status_transitions": {
+ "finalized_at": 1708008558,
+ "marked_uncollectible_at": null,
+ "paid_at": null,
+ "voided_at": null
+ },
+ "subscription": null,
+ "subscription_details": {
+ "metadata": null
+ },
+ "subtotal": 10000,
+ "subtotal_excluding_tax": 10000,
+ "tax": null,
+ "test_clock": null,
+ "total": 10000,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 10000,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": 1708008558
+}
diff --git a/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.finalize_invoice.12.json b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.finalize_invoice.12.json
new file mode 100644
index 00000000000..8f1f0b17cd4
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.finalize_invoice.12.json
@@ -0,0 +1,163 @@
+{
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 10000,
+ "amount_paid": 0,
+ "amount_remaining": 10000,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 0,
+ "attempted": false,
+ "auto_advance": true,
+ "automatic_tax": {
+ "enabled": false,
+ "liability": null,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": null,
+ "collection_method": "charge_automatically",
+ "created": 1708008560,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_PZEia820z9Zo16",
+ "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": 1708008560,
+ "ending_balance": 0,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QWkVqQlY3TFY1NXhWZFlhVlE4Rzk5bVlSVnZIcFZ3LDk4NTQ5MzYx0200k3EUVlU7?s=ap",
+ "id": "in_1Ok6FYDEQaroqDjsEpZnXYMn",
+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QWkVqQlY3TFY1NXhWZFlhVlE4Rzk5bVlSVnZIcFZ3LDk4NTQ5MzYx0200k3EUVlU7/pdf?s=ap",
+ "issuer": {
+ "type": "self"
+ },
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": 10000,
+ "amount_excluding_tax": 10000,
+ "currency": "usd",
+ "description": "Zulip Basic - renewal",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1Ok6FXDEQaroqDjsAwIlpkZG",
+ "invoice": "in_1Ok6FYDEQaroqDjsEpZnXYMn",
+ "invoice_item": "ii_1Ok6FXDEQaroqDjstkBNGP1P",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1357095845,
+ "start": 1354417445
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1708006262,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1Ok5eUDEQaroqDjshX1NDxnx",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PL1wqMUzILAcbD",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 10000,
+ "unit_amount_decimal": "10000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "10000"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 1,
+ "url": "/v1/invoices/in_1Ok6FYDEQaroqDjsEpZnXYMn/lines"
+ },
+ "livemode": false,
+ "metadata": {},
+ "next_payment_attempt": 1708012160,
+ "number": "4B9E7A40-0012",
+ "object": "invoice",
+ "on_behalf_of": null,
+ "paid": false,
+ "paid_out_of_band": false,
+ "payment_intent": "pi_3Ok6FZDEQaroqDjs0j5VNR6m",
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1708008560,
+ "period_start": 1708008560,
+ "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": "open",
+ "status_transitions": {
+ "finalized_at": 1708008560,
+ "marked_uncollectible_at": null,
+ "paid_at": null,
+ "voided_at": null
+ },
+ "subscription": null,
+ "subscription_details": {
+ "metadata": null
+ },
+ "subtotal": 10000,
+ "subtotal_excluding_tax": 10000,
+ "tax": null,
+ "test_clock": null,
+ "total": 10000,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 10000,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": null
+}
diff --git a/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.finalize_invoice.13.json b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.finalize_invoice.13.json
new file mode 100644
index 00000000000..1d483b575ba
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.finalize_invoice.13.json
@@ -0,0 +1,163 @@
+{
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 14166,
+ "amount_paid": 0,
+ "amount_remaining": 14166,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 0,
+ "attempted": false,
+ "auto_advance": true,
+ "automatic_tax": {
+ "enabled": false,
+ "liability": null,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": null,
+ "collection_method": "charge_automatically",
+ "created": 1708008562,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_PZEia820z9Zo16",
+ "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": 1708008562,
+ "ending_balance": 0,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QWkVqVlBndDJYa0NBTHlTS0VnWWxSaEdoc2daNGx3LDk4NTQ5MzYz0200r1LSAzXG?s=ap",
+ "id": "in_1Ok6FaDEQaroqDjsU4FjJIJF",
+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QWkVqVlBndDJYa0NBTHlTS0VnWWxSaEdoc2daNGx3LDk4NTQ5MzYz0200r1LSAzXG/pdf?s=ap",
+ "issuer": {
+ "type": "self"
+ },
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": 14166,
+ "amount_excluding_tax": 14166,
+ "currency": "usd",
+ "description": "Zulip Basic - renewal",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1Ok6FZDEQaroqDjsb3vqKZkB",
+ "invoice": "in_1Ok6FaDEQaroqDjsU4FjJIJF",
+ "invoice_item": "ii_1Ok6FZDEQaroqDjsrVeibhC4",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1359774245,
+ "start": 1357095845
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1708008561,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1Ok6FZDEQaroqDjslmbiQTS8",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PL1wqMUzILAcbD",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 14166,
+ "unit_amount_decimal": "14166"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "14166"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 1,
+ "url": "/v1/invoices/in_1Ok6FaDEQaroqDjsU4FjJIJF/lines"
+ },
+ "livemode": false,
+ "metadata": {},
+ "next_payment_attempt": 1708012162,
+ "number": "4B9E7A40-0013",
+ "object": "invoice",
+ "on_behalf_of": null,
+ "paid": false,
+ "paid_out_of_band": false,
+ "payment_intent": "pi_3Ok6FbDEQaroqDjs1jcH5DKT",
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1708008562,
+ "period_start": 1708008562,
+ "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": "open",
+ "status_transitions": {
+ "finalized_at": 1708008562,
+ "marked_uncollectible_at": null,
+ "paid_at": null,
+ "voided_at": null
+ },
+ "subscription": null,
+ "subscription_details": {
+ "metadata": null
+ },
+ "subtotal": 14166,
+ "subtotal_excluding_tax": 14166,
+ "tax": null,
+ "test_clock": null,
+ "total": 14166,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 14166,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": 1708008562
+}
diff --git a/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.finalize_invoice.2.json b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.finalize_invoice.2.json
new file mode 100644
index 00000000000..2d33d0244c5
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.finalize_invoice.2.json
@@ -0,0 +1,163 @@
+{
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 10000,
+ "amount_paid": 0,
+ "amount_remaining": 10000,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 0,
+ "attempted": false,
+ "auto_advance": true,
+ "automatic_tax": {
+ "enabled": false,
+ "liability": null,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": null,
+ "collection_method": "charge_automatically",
+ "created": 1708008539,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_PZEia820z9Zo16",
+ "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": 1708008540,
+ "ending_balance": 0,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QWkVpdGJUUzY4MjQ4UXk2Y0oxQjMweDBrQXBWbnMxLDk4NTQ5MzQw0200NgBRRnsC?s=ap",
+ "id": "in_1Ok6FDDEQaroqDjsOmsu3UGH",
+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QWkVpdGJUUzY4MjQ4UXk2Y0oxQjMweDBrQXBWbnMxLDk4NTQ5MzQw0200NgBRRnsC/pdf?s=ap",
+ "issuer": {
+ "type": "self"
+ },
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": 10000,
+ "amount_excluding_tax": 10000,
+ "currency": "usd",
+ "description": "Zulip Basic - renewal",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1Ok6FDDEQaroqDjsqcURxFCm",
+ "invoice": "in_1Ok6FDDEQaroqDjsOmsu3UGH",
+ "invoice_item": "ii_1Ok6FDDEQaroqDjsobmrF8r5",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1330657445,
+ "start": 1328151845
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1708006262,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1Ok5eUDEQaroqDjshX1NDxnx",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PL1wqMUzILAcbD",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 10000,
+ "unit_amount_decimal": "10000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "10000"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 1,
+ "url": "/v1/invoices/in_1Ok6FDDEQaroqDjsOmsu3UGH/lines"
+ },
+ "livemode": false,
+ "metadata": {},
+ "next_payment_attempt": 1708012139,
+ "number": "4B9E7A40-0002",
+ "object": "invoice",
+ "on_behalf_of": null,
+ "paid": false,
+ "paid_out_of_band": false,
+ "payment_intent": "pi_3Ok6FEDEQaroqDjs0sbrBvag",
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1708008539,
+ "period_start": 1708008539,
+ "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": "open",
+ "status_transitions": {
+ "finalized_at": 1708008540,
+ "marked_uncollectible_at": null,
+ "paid_at": null,
+ "voided_at": null
+ },
+ "subscription": null,
+ "subscription_details": {
+ "metadata": null
+ },
+ "subtotal": 10000,
+ "subtotal_excluding_tax": 10000,
+ "tax": null,
+ "test_clock": null,
+ "total": 10000,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 10000,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": 1708008540
+}
diff --git a/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.finalize_invoice.3.json b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.finalize_invoice.3.json
new file mode 100644
index 00000000000..680be56d64f
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.finalize_invoice.3.json
@@ -0,0 +1,163 @@
+{
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 10000,
+ "amount_paid": 0,
+ "amount_remaining": 10000,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 0,
+ "attempted": false,
+ "auto_advance": true,
+ "automatic_tax": {
+ "enabled": false,
+ "liability": null,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": null,
+ "collection_method": "charge_automatically",
+ "created": 1708008541,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_PZEia820z9Zo16",
+ "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": 1708008542,
+ "ending_balance": 0,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QWkVpTWhvTzFRT3JxNjRKSWdTZVF3bmt1aWY1VG5TLDk4NTQ5MzQy02008gR99B0O?s=ap",
+ "id": "in_1Ok6FFDEQaroqDjsLt19vWWG",
+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QWkVpTWhvTzFRT3JxNjRKSWdTZVF3bmt1aWY1VG5TLDk4NTQ5MzQy02008gR99B0O/pdf?s=ap",
+ "issuer": {
+ "type": "self"
+ },
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": 10000,
+ "amount_excluding_tax": 10000,
+ "currency": "usd",
+ "description": "Zulip Basic - renewal",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1Ok6FFDEQaroqDjsokI1EFt8",
+ "invoice": "in_1Ok6FFDEQaroqDjsLt19vWWG",
+ "invoice_item": "ii_1Ok6FFDEQaroqDjs5Ax5K3un",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1333335845,
+ "start": 1330657445
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1708006262,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1Ok5eUDEQaroqDjshX1NDxnx",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PL1wqMUzILAcbD",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 10000,
+ "unit_amount_decimal": "10000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "10000"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 1,
+ "url": "/v1/invoices/in_1Ok6FFDEQaroqDjsLt19vWWG/lines"
+ },
+ "livemode": false,
+ "metadata": {},
+ "next_payment_attempt": 1708012141,
+ "number": "4B9E7A40-0003",
+ "object": "invoice",
+ "on_behalf_of": null,
+ "paid": false,
+ "paid_out_of_band": false,
+ "payment_intent": "pi_3Ok6FGDEQaroqDjs1IMocKEu",
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1708008541,
+ "period_start": 1708008541,
+ "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": "open",
+ "status_transitions": {
+ "finalized_at": 1708008542,
+ "marked_uncollectible_at": null,
+ "paid_at": null,
+ "voided_at": null
+ },
+ "subscription": null,
+ "subscription_details": {
+ "metadata": null
+ },
+ "subtotal": 10000,
+ "subtotal_excluding_tax": 10000,
+ "tax": null,
+ "test_clock": null,
+ "total": 10000,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 10000,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": 1708008542
+}
diff --git a/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.finalize_invoice.4.json b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.finalize_invoice.4.json
new file mode 100644
index 00000000000..cd51b6d524d
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.finalize_invoice.4.json
@@ -0,0 +1,163 @@
+{
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 10000,
+ "amount_paid": 0,
+ "amount_remaining": 10000,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 0,
+ "attempted": false,
+ "auto_advance": true,
+ "automatic_tax": {
+ "enabled": false,
+ "liability": null,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": null,
+ "collection_method": "charge_automatically",
+ "created": 1708008543,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_PZEia820z9Zo16",
+ "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": 1708008544,
+ "ending_balance": 0,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QWkVpbUtENVk2eUozNHhmdHFoU3N4Wk1yNzB5VEVGLDk4NTQ5MzQ10200u6IcYseW?s=ap",
+ "id": "in_1Ok6FHDEQaroqDjsjETDjm3N",
+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QWkVpbUtENVk2eUozNHhmdHFoU3N4Wk1yNzB5VEVGLDk4NTQ5MzQ10200u6IcYseW/pdf?s=ap",
+ "issuer": {
+ "type": "self"
+ },
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": 10000,
+ "amount_excluding_tax": 10000,
+ "currency": "usd",
+ "description": "Zulip Basic - renewal",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1Ok6FHDEQaroqDjsuaJsHLX7",
+ "invoice": "in_1Ok6FHDEQaroqDjsjETDjm3N",
+ "invoice_item": "ii_1Ok6FHDEQaroqDjsYbai5bKM",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1335927845,
+ "start": 1333335845
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1708006262,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1Ok5eUDEQaroqDjshX1NDxnx",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PL1wqMUzILAcbD",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 10000,
+ "unit_amount_decimal": "10000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "10000"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 1,
+ "url": "/v1/invoices/in_1Ok6FHDEQaroqDjsjETDjm3N/lines"
+ },
+ "livemode": false,
+ "metadata": {},
+ "next_payment_attempt": 1708012143,
+ "number": "4B9E7A40-0004",
+ "object": "invoice",
+ "on_behalf_of": null,
+ "paid": false,
+ "paid_out_of_band": false,
+ "payment_intent": "pi_3Ok6FIDEQaroqDjs01eAMKm1",
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1708008543,
+ "period_start": 1708008543,
+ "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": "open",
+ "status_transitions": {
+ "finalized_at": 1708008544,
+ "marked_uncollectible_at": null,
+ "paid_at": null,
+ "voided_at": null
+ },
+ "subscription": null,
+ "subscription_details": {
+ "metadata": null
+ },
+ "subtotal": 10000,
+ "subtotal_excluding_tax": 10000,
+ "tax": null,
+ "test_clock": null,
+ "total": 10000,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 10000,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": 1708008544
+}
diff --git a/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.finalize_invoice.5.json b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.finalize_invoice.5.json
new file mode 100644
index 00000000000..c151339fbea
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.finalize_invoice.5.json
@@ -0,0 +1,163 @@
+{
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 10000,
+ "amount_paid": 0,
+ "amount_remaining": 10000,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 0,
+ "attempted": false,
+ "auto_advance": true,
+ "automatic_tax": {
+ "enabled": false,
+ "liability": null,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": null,
+ "collection_method": "charge_automatically",
+ "created": 1708008545,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_PZEia820z9Zo16",
+ "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": 1708008546,
+ "ending_balance": 0,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QWkVpbkVIQnJJMGhYU1VnRHJpdW5lWnNiZmVLU1BYLDk4NTQ5MzQ20200MiwnYrzs?s=ap",
+ "id": "in_1Ok6FJDEQaroqDjsr5vNb1mu",
+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QWkVpbkVIQnJJMGhYU1VnRHJpdW5lWnNiZmVLU1BYLDk4NTQ5MzQ20200MiwnYrzs/pdf?s=ap",
+ "issuer": {
+ "type": "self"
+ },
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": 10000,
+ "amount_excluding_tax": 10000,
+ "currency": "usd",
+ "description": "Zulip Basic - renewal",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1Ok6FJDEQaroqDjsbuUtMsbz",
+ "invoice": "in_1Ok6FJDEQaroqDjsr5vNb1mu",
+ "invoice_item": "ii_1Ok6FJDEQaroqDjsYiAZ5f7J",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1338606245,
+ "start": 1335927845
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1708006262,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1Ok5eUDEQaroqDjshX1NDxnx",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PL1wqMUzILAcbD",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 10000,
+ "unit_amount_decimal": "10000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "10000"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 1,
+ "url": "/v1/invoices/in_1Ok6FJDEQaroqDjsr5vNb1mu/lines"
+ },
+ "livemode": false,
+ "metadata": {},
+ "next_payment_attempt": 1708012145,
+ "number": "4B9E7A40-0005",
+ "object": "invoice",
+ "on_behalf_of": null,
+ "paid": false,
+ "paid_out_of_band": false,
+ "payment_intent": "pi_3Ok6FKDEQaroqDjs0hpVrdOE",
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1708008545,
+ "period_start": 1708008545,
+ "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": "open",
+ "status_transitions": {
+ "finalized_at": 1708008546,
+ "marked_uncollectible_at": null,
+ "paid_at": null,
+ "voided_at": null
+ },
+ "subscription": null,
+ "subscription_details": {
+ "metadata": null
+ },
+ "subtotal": 10000,
+ "subtotal_excluding_tax": 10000,
+ "tax": null,
+ "test_clock": null,
+ "total": 10000,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 10000,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": 1708008546
+}
diff --git a/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.finalize_invoice.6.json b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.finalize_invoice.6.json
new file mode 100644
index 00000000000..8722d4eb4a4
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.finalize_invoice.6.json
@@ -0,0 +1,163 @@
+{
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 10000,
+ "amount_paid": 0,
+ "amount_remaining": 10000,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 0,
+ "attempted": false,
+ "auto_advance": true,
+ "automatic_tax": {
+ "enabled": false,
+ "liability": null,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": null,
+ "collection_method": "charge_automatically",
+ "created": 1708008547,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_PZEia820z9Zo16",
+ "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": 1708008548,
+ "ending_balance": 0,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QWkVpbERXRzJYdUpRZjA5TVgzOWVrdUc4U241YTVDLDk4NTQ5MzQ50200mfjotCWj?s=ap",
+ "id": "in_1Ok6FLDEQaroqDjscwwAP1gG",
+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QWkVpbERXRzJYdUpRZjA5TVgzOWVrdUc4U241YTVDLDk4NTQ5MzQ50200mfjotCWj/pdf?s=ap",
+ "issuer": {
+ "type": "self"
+ },
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": 10000,
+ "amount_excluding_tax": 10000,
+ "currency": "usd",
+ "description": "Zulip Basic - renewal",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1Ok6FLDEQaroqDjsMtJKF1V2",
+ "invoice": "in_1Ok6FLDEQaroqDjscwwAP1gG",
+ "invoice_item": "ii_1Ok6FLDEQaroqDjsJ8fkxeT2",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1341198245,
+ "start": 1338606245
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1708006262,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1Ok5eUDEQaroqDjshX1NDxnx",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PL1wqMUzILAcbD",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 10000,
+ "unit_amount_decimal": "10000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "10000"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 1,
+ "url": "/v1/invoices/in_1Ok6FLDEQaroqDjscwwAP1gG/lines"
+ },
+ "livemode": false,
+ "metadata": {},
+ "next_payment_attempt": 1708012147,
+ "number": "4B9E7A40-0006",
+ "object": "invoice",
+ "on_behalf_of": null,
+ "paid": false,
+ "paid_out_of_band": false,
+ "payment_intent": "pi_3Ok6FMDEQaroqDjs0dDWCYyW",
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1708008547,
+ "period_start": 1708008547,
+ "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": "open",
+ "status_transitions": {
+ "finalized_at": 1708008548,
+ "marked_uncollectible_at": null,
+ "paid_at": null,
+ "voided_at": null
+ },
+ "subscription": null,
+ "subscription_details": {
+ "metadata": null
+ },
+ "subtotal": 10000,
+ "subtotal_excluding_tax": 10000,
+ "tax": null,
+ "test_clock": null,
+ "total": 10000,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 10000,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": 1708008548
+}
diff --git a/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.finalize_invoice.7.json b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.finalize_invoice.7.json
new file mode 100644
index 00000000000..c16325beb61
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.finalize_invoice.7.json
@@ -0,0 +1,163 @@
+{
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 10000,
+ "amount_paid": 0,
+ "amount_remaining": 10000,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 0,
+ "attempted": false,
+ "auto_advance": true,
+ "automatic_tax": {
+ "enabled": false,
+ "liability": null,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": null,
+ "collection_method": "charge_automatically",
+ "created": 1708008550,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_PZEia820z9Zo16",
+ "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": 1708008550,
+ "ending_balance": 0,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QWkVpWTh0bnJ3eUR5UlE2eUdLMlRjaFJxcXVPazVqLDk4NTQ5MzUx0200PwkNuVho?s=ap",
+ "id": "in_1Ok6FODEQaroqDjsxAen1rCO",
+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QWkVpWTh0bnJ3eUR5UlE2eUdLMlRjaFJxcXVPazVqLDk4NTQ5MzUx0200PwkNuVho/pdf?s=ap",
+ "issuer": {
+ "type": "self"
+ },
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": 10000,
+ "amount_excluding_tax": 10000,
+ "currency": "usd",
+ "description": "Zulip Basic - renewal",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1Ok6FNDEQaroqDjsj9Abe5vE",
+ "invoice": "in_1Ok6FODEQaroqDjsxAen1rCO",
+ "invoice_item": "ii_1Ok6FNDEQaroqDjsqzHmAwmk",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1343876645,
+ "start": 1341198245
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1708006262,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1Ok5eUDEQaroqDjshX1NDxnx",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PL1wqMUzILAcbD",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 10000,
+ "unit_amount_decimal": "10000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "10000"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 1,
+ "url": "/v1/invoices/in_1Ok6FODEQaroqDjsxAen1rCO/lines"
+ },
+ "livemode": false,
+ "metadata": {},
+ "next_payment_attempt": 1708012150,
+ "number": "4B9E7A40-0007",
+ "object": "invoice",
+ "on_behalf_of": null,
+ "paid": false,
+ "paid_out_of_band": false,
+ "payment_intent": "pi_3Ok6FODEQaroqDjs1VTeTMsX",
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1708008550,
+ "period_start": 1708008550,
+ "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": "open",
+ "status_transitions": {
+ "finalized_at": 1708008550,
+ "marked_uncollectible_at": null,
+ "paid_at": null,
+ "voided_at": null
+ },
+ "subscription": null,
+ "subscription_details": {
+ "metadata": null
+ },
+ "subtotal": 10000,
+ "subtotal_excluding_tax": 10000,
+ "tax": null,
+ "test_clock": null,
+ "total": 10000,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 10000,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": 1708008550
+}
diff --git a/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.finalize_invoice.8.json b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.finalize_invoice.8.json
new file mode 100644
index 00000000000..1a768606c0d
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.finalize_invoice.8.json
@@ -0,0 +1,163 @@
+{
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 10000,
+ "amount_paid": 0,
+ "amount_remaining": 10000,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 0,
+ "attempted": false,
+ "auto_advance": true,
+ "automatic_tax": {
+ "enabled": false,
+ "liability": null,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": null,
+ "collection_method": "charge_automatically",
+ "created": 1708008552,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_PZEia820z9Zo16",
+ "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": 1708008552,
+ "ending_balance": 0,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QWkVpajNvTmUzSEoyS2ZnUkd2eE00SmI0bGVXOThMLDk4NTQ5MzUz0200r8xKedk1?s=ap",
+ "id": "in_1Ok6FQDEQaroqDjskVWg8EKf",
+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QWkVpajNvTmUzSEoyS2ZnUkd2eE00SmI0bGVXOThMLDk4NTQ5MzUz0200r8xKedk1/pdf?s=ap",
+ "issuer": {
+ "type": "self"
+ },
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": 10000,
+ "amount_excluding_tax": 10000,
+ "currency": "usd",
+ "description": "Zulip Basic - renewal",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1Ok6FPDEQaroqDjsFiW413HO",
+ "invoice": "in_1Ok6FQDEQaroqDjskVWg8EKf",
+ "invoice_item": "ii_1Ok6FPDEQaroqDjsgUXTYMsr",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1346555045,
+ "start": 1343876645
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1708006262,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1Ok5eUDEQaroqDjshX1NDxnx",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PL1wqMUzILAcbD",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 10000,
+ "unit_amount_decimal": "10000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "10000"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 1,
+ "url": "/v1/invoices/in_1Ok6FQDEQaroqDjskVWg8EKf/lines"
+ },
+ "livemode": false,
+ "metadata": {},
+ "next_payment_attempt": 1708012152,
+ "number": "4B9E7A40-0008",
+ "object": "invoice",
+ "on_behalf_of": null,
+ "paid": false,
+ "paid_out_of_band": false,
+ "payment_intent": "pi_3Ok6FQDEQaroqDjs1eOoiRWG",
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1708008552,
+ "period_start": 1708008552,
+ "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": "open",
+ "status_transitions": {
+ "finalized_at": 1708008552,
+ "marked_uncollectible_at": null,
+ "paid_at": null,
+ "voided_at": null
+ },
+ "subscription": null,
+ "subscription_details": {
+ "metadata": null
+ },
+ "subtotal": 10000,
+ "subtotal_excluding_tax": 10000,
+ "tax": null,
+ "test_clock": null,
+ "total": 10000,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 10000,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": null
+}
diff --git a/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.finalize_invoice.9.json b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.finalize_invoice.9.json
new file mode 100644
index 00000000000..39266a3d616
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.finalize_invoice.9.json
@@ -0,0 +1,163 @@
+{
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 10000,
+ "amount_paid": 0,
+ "amount_remaining": 10000,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 0,
+ "attempted": false,
+ "auto_advance": true,
+ "automatic_tax": {
+ "enabled": false,
+ "liability": null,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": null,
+ "collection_method": "charge_automatically",
+ "created": 1708008553,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_PZEia820z9Zo16",
+ "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": 1708008554,
+ "ending_balance": 0,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QWkVpY21adGt2ZGFTTHpQOVg2ZzNqS3Z2dGhTRjcwLDk4NTQ5MzU00200T6sNXxOh?s=ap",
+ "id": "in_1Ok6FSDEQaroqDjselZMgjkA",
+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QWkVpY21adGt2ZGFTTHpQOVg2ZzNqS3Z2dGhTRjcwLDk4NTQ5MzU00200T6sNXxOh/pdf?s=ap",
+ "issuer": {
+ "type": "self"
+ },
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": 10000,
+ "amount_excluding_tax": 10000,
+ "currency": "usd",
+ "description": "Zulip Basic - renewal",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1Ok6FRDEQaroqDjs9qv4Oyjo",
+ "invoice": "in_1Ok6FSDEQaroqDjselZMgjkA",
+ "invoice_item": "ii_1Ok6FRDEQaroqDjsxxNJcAA3",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1349147045,
+ "start": 1346555045
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1708006262,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1Ok5eUDEQaroqDjshX1NDxnx",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PL1wqMUzILAcbD",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 10000,
+ "unit_amount_decimal": "10000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "10000"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 1,
+ "url": "/v1/invoices/in_1Ok6FSDEQaroqDjselZMgjkA/lines"
+ },
+ "livemode": false,
+ "metadata": {},
+ "next_payment_attempt": 1708012153,
+ "number": "4B9E7A40-0009",
+ "object": "invoice",
+ "on_behalf_of": null,
+ "paid": false,
+ "paid_out_of_band": false,
+ "payment_intent": "pi_3Ok6FSDEQaroqDjs1qD1nbd4",
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1708008553,
+ "period_start": 1708008553,
+ "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": "open",
+ "status_transitions": {
+ "finalized_at": 1708008554,
+ "marked_uncollectible_at": null,
+ "paid_at": null,
+ "voided_at": null
+ },
+ "subscription": null,
+ "subscription_details": {
+ "metadata": null
+ },
+ "subtotal": 10000,
+ "subtotal_excluding_tax": 10000,
+ "tax": null,
+ "test_clock": null,
+ "total": 10000,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 10000,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": null
+}
diff --git a/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.list.1.json b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.list.1.json
new file mode 100644
index 00000000000..e39960ab725
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.list.1.json
@@ -0,0 +1,6 @@
+{
+ "data": [],
+ "has_more": false,
+ "object": "list",
+ "url": "/v1/invoices"
+}
diff --git a/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.pay.1.json b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.pay.1.json
new file mode 100644
index 00000000000..42a7c2bf9a0
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--Invoice.pay.1.json
@@ -0,0 +1,168 @@
+{
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 10000,
+ "amount_paid": 10000,
+ "amount_remaining": 0,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 1,
+ "attempted": true,
+ "auto_advance": false,
+ "automatic_tax": {
+ "enabled": false,
+ "liability": null,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": "ch_3Ok6F8DEQaroqDjs177d5Sdi",
+ "collection_method": "charge_automatically",
+ "created": 1708008533,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_PZEia820z9Zo16",
+ "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": 1708008534,
+ "ending_balance": 0,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QWkVpRm5DMWQxaEhrZnV6Rnl6OWFLcXFJem5IbVNaLDk4NTQ5MzM20200bsZCZ46O?s=ap",
+ "id": "in_1Ok6F7DEQaroqDjslOe91xON",
+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QWkVpRm5DMWQxaEhrZnV6Rnl6OWFLcXFJem5IbVNaLDk4NTQ5MzM20200bsZCZ46O/pdf?s=ap",
+ "issuer": {
+ "type": "self"
+ },
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": 10000,
+ "amount_excluding_tax": 10000,
+ "currency": "usd",
+ "description": "Zulip Basic",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1Ok6F7DEQaroqDjs5qpv2Heh",
+ "invoice": "in_1Ok6F7DEQaroqDjslOe91xON",
+ "invoice_item": "ii_1Ok6F7DEQaroqDjs24pAIHvX",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1708008533,
+ "start": 1708008533
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1706114464,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1Oc9VcDEQaroqDjs9z5VJret",
+ "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": 10000,
+ "unit_amount_decimal": "10000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "10000"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 1,
+ "url": "/v1/invoices/in_1Ok6F7DEQaroqDjslOe91xON/lines"
+ },
+ "livemode": false,
+ "metadata": {
+ "billing_schedule": "2",
+ "license_management": "automatic",
+ "licenses": "11",
+ "plan_tier": "103"
+ },
+ "next_payment_attempt": null,
+ "number": "4B9E7A40-0001",
+ "object": "invoice",
+ "on_behalf_of": null,
+ "paid": true,
+ "paid_out_of_band": false,
+ "payment_intent": "pi_3Ok6F8DEQaroqDjs1alKvD7i",
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1708008533,
+ "period_start": 1708008533,
+ "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": 1708008534,
+ "marked_uncollectible_at": null,
+ "paid_at": 1708008535,
+ "voided_at": null
+ },
+ "subscription": null,
+ "subscription_details": {
+ "metadata": null
+ },
+ "subtotal": 10000,
+ "subtotal_excluding_tax": 10000,
+ "tax": null,
+ "test_clock": null,
+ "total": 10000,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 10000,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": 1708008534
+}
diff --git a/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--InvoiceItem.create.1.json b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--InvoiceItem.create.1.json
new file mode 100644
index 00000000000..54bf865a2aa
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--InvoiceItem.create.1.json
@@ -0,0 +1,47 @@
+{
+ "amount": 10000,
+ "currency": "usd",
+ "customer": "cus_PZEia820z9Zo16",
+ "date": 1708008533,
+ "description": "Zulip Basic",
+ "discountable": false,
+ "discounts": [],
+ "id": "ii_1Ok6F7DEQaroqDjs24pAIHvX",
+ "invoice": null,
+ "livemode": false,
+ "metadata": {},
+ "object": "invoiceitem",
+ "period": {
+ "end": 1708008533,
+ "start": 1708008533
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1706114464,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1Oc9VcDEQaroqDjs9z5VJret",
+ "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": 10000,
+ "unit_amount_decimal": "10000"
+ },
+ "proration": false,
+ "quantity": 1,
+ "subscription": null,
+ "tax_rates": [],
+ "test_clock": null,
+ "unit_amount": 10000,
+ "unit_amount_decimal": "10000"
+}
diff --git a/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--InvoiceItem.create.10.json b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--InvoiceItem.create.10.json
new file mode 100644
index 00000000000..b15c8ca1fc6
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--InvoiceItem.create.10.json
@@ -0,0 +1,47 @@
+{
+ "amount": 10000,
+ "currency": "usd",
+ "customer": "cus_PZEia820z9Zo16",
+ "date": 1708008555,
+ "description": "Zulip Basic - renewal",
+ "discountable": false,
+ "discounts": [],
+ "id": "ii_1Ok6FTDEQaroqDjs4iYz8E5l",
+ "invoice": null,
+ "livemode": false,
+ "metadata": {},
+ "object": "invoiceitem",
+ "period": {
+ "end": 1351825445,
+ "start": 1349147045
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1708006262,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1Ok5eUDEQaroqDjshX1NDxnx",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PL1wqMUzILAcbD",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 10000,
+ "unit_amount_decimal": "10000"
+ },
+ "proration": false,
+ "quantity": 1,
+ "subscription": null,
+ "tax_rates": [],
+ "test_clock": null,
+ "unit_amount": 10000,
+ "unit_amount_decimal": "10000"
+}
diff --git a/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--InvoiceItem.create.11.json b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--InvoiceItem.create.11.json
new file mode 100644
index 00000000000..954f81b7db7
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--InvoiceItem.create.11.json
@@ -0,0 +1,47 @@
+{
+ "amount": 10000,
+ "currency": "usd",
+ "customer": "cus_PZEia820z9Zo16",
+ "date": 1708008557,
+ "description": "Zulip Basic - renewal",
+ "discountable": false,
+ "discounts": [],
+ "id": "ii_1Ok6FVDEQaroqDjsF610cGBM",
+ "invoice": null,
+ "livemode": false,
+ "metadata": {},
+ "object": "invoiceitem",
+ "period": {
+ "end": 1354417445,
+ "start": 1351825445
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1708006262,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1Ok5eUDEQaroqDjshX1NDxnx",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PL1wqMUzILAcbD",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 10000,
+ "unit_amount_decimal": "10000"
+ },
+ "proration": false,
+ "quantity": 1,
+ "subscription": null,
+ "tax_rates": [],
+ "test_clock": null,
+ "unit_amount": 10000,
+ "unit_amount_decimal": "10000"
+}
diff --git a/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--InvoiceItem.create.12.json b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--InvoiceItem.create.12.json
new file mode 100644
index 00000000000..d6c56fad606
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--InvoiceItem.create.12.json
@@ -0,0 +1,47 @@
+{
+ "amount": 10000,
+ "currency": "usd",
+ "customer": "cus_PZEia820z9Zo16",
+ "date": 1708008559,
+ "description": "Zulip Basic - renewal",
+ "discountable": false,
+ "discounts": [],
+ "id": "ii_1Ok6FXDEQaroqDjstkBNGP1P",
+ "invoice": null,
+ "livemode": false,
+ "metadata": {},
+ "object": "invoiceitem",
+ "period": {
+ "end": 1357095845,
+ "start": 1354417445
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1708006262,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1Ok5eUDEQaroqDjshX1NDxnx",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PL1wqMUzILAcbD",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 10000,
+ "unit_amount_decimal": "10000"
+ },
+ "proration": false,
+ "quantity": 1,
+ "subscription": null,
+ "tax_rates": [],
+ "test_clock": null,
+ "unit_amount": 10000,
+ "unit_amount_decimal": "10000"
+}
diff --git a/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--InvoiceItem.create.13.json b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--InvoiceItem.create.13.json
new file mode 100644
index 00000000000..7f2e230c855
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--InvoiceItem.create.13.json
@@ -0,0 +1,47 @@
+{
+ "amount": 14166,
+ "currency": "usd",
+ "customer": "cus_PZEia820z9Zo16",
+ "date": 1708008561,
+ "description": "Zulip Basic - renewal",
+ "discountable": false,
+ "discounts": [],
+ "id": "ii_1Ok6FZDEQaroqDjsrVeibhC4",
+ "invoice": null,
+ "livemode": false,
+ "metadata": {},
+ "object": "invoiceitem",
+ "period": {
+ "end": 1359774245,
+ "start": 1357095845
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1708008561,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1Ok6FZDEQaroqDjslmbiQTS8",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PL1wqMUzILAcbD",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 14166,
+ "unit_amount_decimal": "14166"
+ },
+ "proration": false,
+ "quantity": 1,
+ "subscription": null,
+ "tax_rates": [],
+ "test_clock": null,
+ "unit_amount": 14166,
+ "unit_amount_decimal": "14166"
+}
diff --git a/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--InvoiceItem.create.2.json b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--InvoiceItem.create.2.json
new file mode 100644
index 00000000000..74a74c530a9
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--InvoiceItem.create.2.json
@@ -0,0 +1,47 @@
+{
+ "amount": 10000,
+ "currency": "usd",
+ "customer": "cus_PZEia820z9Zo16",
+ "date": 1708008539,
+ "description": "Zulip Basic - renewal",
+ "discountable": false,
+ "discounts": [],
+ "id": "ii_1Ok6FDDEQaroqDjsobmrF8r5",
+ "invoice": null,
+ "livemode": false,
+ "metadata": {},
+ "object": "invoiceitem",
+ "period": {
+ "end": 1330657445,
+ "start": 1328151845
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1708006262,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1Ok5eUDEQaroqDjshX1NDxnx",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PL1wqMUzILAcbD",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 10000,
+ "unit_amount_decimal": "10000"
+ },
+ "proration": false,
+ "quantity": 1,
+ "subscription": null,
+ "tax_rates": [],
+ "test_clock": null,
+ "unit_amount": 10000,
+ "unit_amount_decimal": "10000"
+}
diff --git a/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--InvoiceItem.create.3.json b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--InvoiceItem.create.3.json
new file mode 100644
index 00000000000..d5001395da9
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--InvoiceItem.create.3.json
@@ -0,0 +1,47 @@
+{
+ "amount": 10000,
+ "currency": "usd",
+ "customer": "cus_PZEia820z9Zo16",
+ "date": 1708008541,
+ "description": "Zulip Basic - renewal",
+ "discountable": false,
+ "discounts": [],
+ "id": "ii_1Ok6FFDEQaroqDjs5Ax5K3un",
+ "invoice": null,
+ "livemode": false,
+ "metadata": {},
+ "object": "invoiceitem",
+ "period": {
+ "end": 1333335845,
+ "start": 1330657445
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1708006262,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1Ok5eUDEQaroqDjshX1NDxnx",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PL1wqMUzILAcbD",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 10000,
+ "unit_amount_decimal": "10000"
+ },
+ "proration": false,
+ "quantity": 1,
+ "subscription": null,
+ "tax_rates": [],
+ "test_clock": null,
+ "unit_amount": 10000,
+ "unit_amount_decimal": "10000"
+}
diff --git a/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--InvoiceItem.create.4.json b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--InvoiceItem.create.4.json
new file mode 100644
index 00000000000..18b6fea6b16
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--InvoiceItem.create.4.json
@@ -0,0 +1,47 @@
+{
+ "amount": 10000,
+ "currency": "usd",
+ "customer": "cus_PZEia820z9Zo16",
+ "date": 1708008543,
+ "description": "Zulip Basic - renewal",
+ "discountable": false,
+ "discounts": [],
+ "id": "ii_1Ok6FHDEQaroqDjsYbai5bKM",
+ "invoice": null,
+ "livemode": false,
+ "metadata": {},
+ "object": "invoiceitem",
+ "period": {
+ "end": 1335927845,
+ "start": 1333335845
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1708006262,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1Ok5eUDEQaroqDjshX1NDxnx",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PL1wqMUzILAcbD",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 10000,
+ "unit_amount_decimal": "10000"
+ },
+ "proration": false,
+ "quantity": 1,
+ "subscription": null,
+ "tax_rates": [],
+ "test_clock": null,
+ "unit_amount": 10000,
+ "unit_amount_decimal": "10000"
+}
diff --git a/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--InvoiceItem.create.5.json b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--InvoiceItem.create.5.json
new file mode 100644
index 00000000000..e45334af0a4
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--InvoiceItem.create.5.json
@@ -0,0 +1,47 @@
+{
+ "amount": 10000,
+ "currency": "usd",
+ "customer": "cus_PZEia820z9Zo16",
+ "date": 1708008545,
+ "description": "Zulip Basic - renewal",
+ "discountable": false,
+ "discounts": [],
+ "id": "ii_1Ok6FJDEQaroqDjsYiAZ5f7J",
+ "invoice": null,
+ "livemode": false,
+ "metadata": {},
+ "object": "invoiceitem",
+ "period": {
+ "end": 1338606245,
+ "start": 1335927845
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1708006262,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1Ok5eUDEQaroqDjshX1NDxnx",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PL1wqMUzILAcbD",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 10000,
+ "unit_amount_decimal": "10000"
+ },
+ "proration": false,
+ "quantity": 1,
+ "subscription": null,
+ "tax_rates": [],
+ "test_clock": null,
+ "unit_amount": 10000,
+ "unit_amount_decimal": "10000"
+}
diff --git a/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--InvoiceItem.create.6.json b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--InvoiceItem.create.6.json
new file mode 100644
index 00000000000..272e43cadb2
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--InvoiceItem.create.6.json
@@ -0,0 +1,47 @@
+{
+ "amount": 10000,
+ "currency": "usd",
+ "customer": "cus_PZEia820z9Zo16",
+ "date": 1708008547,
+ "description": "Zulip Basic - renewal",
+ "discountable": false,
+ "discounts": [],
+ "id": "ii_1Ok6FLDEQaroqDjsJ8fkxeT2",
+ "invoice": null,
+ "livemode": false,
+ "metadata": {},
+ "object": "invoiceitem",
+ "period": {
+ "end": 1341198245,
+ "start": 1338606245
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1708006262,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1Ok5eUDEQaroqDjshX1NDxnx",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PL1wqMUzILAcbD",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 10000,
+ "unit_amount_decimal": "10000"
+ },
+ "proration": false,
+ "quantity": 1,
+ "subscription": null,
+ "tax_rates": [],
+ "test_clock": null,
+ "unit_amount": 10000,
+ "unit_amount_decimal": "10000"
+}
diff --git a/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--InvoiceItem.create.7.json b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--InvoiceItem.create.7.json
new file mode 100644
index 00000000000..5c8e77c4039
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--InvoiceItem.create.7.json
@@ -0,0 +1,47 @@
+{
+ "amount": 10000,
+ "currency": "usd",
+ "customer": "cus_PZEia820z9Zo16",
+ "date": 1708008549,
+ "description": "Zulip Basic - renewal",
+ "discountable": false,
+ "discounts": [],
+ "id": "ii_1Ok6FNDEQaroqDjsqzHmAwmk",
+ "invoice": null,
+ "livemode": false,
+ "metadata": {},
+ "object": "invoiceitem",
+ "period": {
+ "end": 1343876645,
+ "start": 1341198245
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1708006262,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1Ok5eUDEQaroqDjshX1NDxnx",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PL1wqMUzILAcbD",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 10000,
+ "unit_amount_decimal": "10000"
+ },
+ "proration": false,
+ "quantity": 1,
+ "subscription": null,
+ "tax_rates": [],
+ "test_clock": null,
+ "unit_amount": 10000,
+ "unit_amount_decimal": "10000"
+}
diff --git a/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--InvoiceItem.create.8.json b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--InvoiceItem.create.8.json
new file mode 100644
index 00000000000..f39ca2b396a
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--InvoiceItem.create.8.json
@@ -0,0 +1,47 @@
+{
+ "amount": 10000,
+ "currency": "usd",
+ "customer": "cus_PZEia820z9Zo16",
+ "date": 1708008551,
+ "description": "Zulip Basic - renewal",
+ "discountable": false,
+ "discounts": [],
+ "id": "ii_1Ok6FPDEQaroqDjsgUXTYMsr",
+ "invoice": null,
+ "livemode": false,
+ "metadata": {},
+ "object": "invoiceitem",
+ "period": {
+ "end": 1346555045,
+ "start": 1343876645
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1708006262,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1Ok5eUDEQaroqDjshX1NDxnx",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PL1wqMUzILAcbD",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 10000,
+ "unit_amount_decimal": "10000"
+ },
+ "proration": false,
+ "quantity": 1,
+ "subscription": null,
+ "tax_rates": [],
+ "test_clock": null,
+ "unit_amount": 10000,
+ "unit_amount_decimal": "10000"
+}
diff --git a/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--InvoiceItem.create.9.json b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--InvoiceItem.create.9.json
new file mode 100644
index 00000000000..63d4e1e730f
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--InvoiceItem.create.9.json
@@ -0,0 +1,47 @@
+{
+ "amount": 10000,
+ "currency": "usd",
+ "customer": "cus_PZEia820z9Zo16",
+ "date": 1708008553,
+ "description": "Zulip Basic - renewal",
+ "discountable": false,
+ "discounts": [],
+ "id": "ii_1Ok6FRDEQaroqDjsxxNJcAA3",
+ "invoice": null,
+ "livemode": false,
+ "metadata": {},
+ "object": "invoiceitem",
+ "period": {
+ "end": 1349147045,
+ "start": 1346555045
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1708006262,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1Ok5eUDEQaroqDjshX1NDxnx",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PL1wqMUzILAcbD",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 10000,
+ "unit_amount_decimal": "10000"
+ },
+ "proration": false,
+ "quantity": 1,
+ "subscription": null,
+ "tax_rates": [],
+ "test_clock": null,
+ "unit_amount": 10000,
+ "unit_amount_decimal": "10000"
+}
diff --git a/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--SetupIntent.create.1.json b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--SetupIntent.create.1.json
new file mode 100644
index 00000000000..e17d541c0c6
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--SetupIntent.create.1.json
@@ -0,0 +1,34 @@
+{
+ "application": null,
+ "automatic_payment_methods": null,
+ "cancellation_reason": null,
+ "client_secret": "seti_1Ok6F2DEQaroqDjsIh4vYZnG_secret_PZEit1aU8ty3GlSdbagzfNCeNKjf4ve",
+ "created": 1708008528,
+ "customer": "cus_PZEia820z9Zo16",
+ "description": null,
+ "flow_directions": null,
+ "id": "seti_1Ok6F2DEQaroqDjsIh4vYZnG",
+ "last_setup_error": null,
+ "latest_attempt": "setatt_1Ok6F2DEQaroqDjsgHikhqvO",
+ "livemode": false,
+ "mandate": null,
+ "metadata": {},
+ "next_action": null,
+ "object": "setup_intent",
+ "on_behalf_of": null,
+ "payment_method": "pm_1Ok6F2DEQaroqDjsaS0caoc1",
+ "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/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--SetupIntent.list.1.json b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--SetupIntent.list.1.json
new file mode 100644
index 00000000000..cd7100ad027
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--SetupIntent.list.1.json
@@ -0,0 +1,41 @@
+{
+ "data": [
+ {
+ "application": null,
+ "automatic_payment_methods": null,
+ "cancellation_reason": null,
+ "client_secret": "seti_1Ok6F1DEQaroqDjsaAnghUo3_secret_PZEivvxKinah2WSKi6xRmJ5gdOASL4f",
+ "created": 1708008527,
+ "customer": "cus_PZEia820z9Zo16",
+ "description": null,
+ "flow_directions": null,
+ "id": "seti_1Ok6F1DEQaroqDjsaAnghUo3",
+ "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/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--SetupIntent.retrieve.1.json b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--SetupIntent.retrieve.1.json
new file mode 100644
index 00000000000..e17d541c0c6
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--SetupIntent.retrieve.1.json
@@ -0,0 +1,34 @@
+{
+ "application": null,
+ "automatic_payment_methods": null,
+ "cancellation_reason": null,
+ "client_secret": "seti_1Ok6F2DEQaroqDjsIh4vYZnG_secret_PZEit1aU8ty3GlSdbagzfNCeNKjf4ve",
+ "created": 1708008528,
+ "customer": "cus_PZEia820z9Zo16",
+ "description": null,
+ "flow_directions": null,
+ "id": "seti_1Ok6F2DEQaroqDjsIh4vYZnG",
+ "last_setup_error": null,
+ "latest_attempt": "setatt_1Ok6F2DEQaroqDjsgHikhqvO",
+ "livemode": false,
+ "mandate": null,
+ "metadata": {},
+ "next_action": null,
+ "object": "setup_intent",
+ "on_behalf_of": null,
+ "payment_method": "pm_1Ok6F2DEQaroqDjsaS0caoc1",
+ "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/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--checkout.Session.create.1.json b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--checkout.Session.create.1.json
new file mode 100644
index 00000000000..d974ef5bb67
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--checkout.Session.create.1.json
@@ -0,0 +1,75 @@
+{
+ "after_expiration": null,
+ "allow_promotion_codes": null,
+ "amount_subtotal": null,
+ "amount_total": null,
+ "automatic_tax": {
+ "enabled": false,
+ "liability": null,
+ "status": null
+ },
+ "billing_address_collection": "required",
+ "cancel_url": "http://selfhosting.testserver/realm/f267ada0-3e8e-4c92-991d-5715db017e75/upgrade/?manual_license_management=false&tier=1",
+ "client_reference_id": null,
+ "client_secret": null,
+ "consent": null,
+ "consent_collection": null,
+ "created": 1708008527,
+ "currency": null,
+ "currency_conversion": null,
+ "custom_fields": [],
+ "custom_text": {
+ "after_submit": null,
+ "shipping_address": null,
+ "submit": null,
+ "terms_of_service_acceptance": null
+ },
+ "customer": "cus_PZEia820z9Zo16",
+ "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": 1708094927,
+ "id": "cs_test_c1AW8fEbcPdhctLWfgzkQ41lXw0DdofTO2wFS3ttiE2UqiqJI3B0R0xQ3P",
+ "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_1Ok6F1DEQaroqDjsaAnghUo3",
+ "shipping": null,
+ "shipping_address_collection": null,
+ "shipping_options": [],
+ "shipping_rate": null,
+ "status": "open",
+ "submit_type": null,
+ "subscription": null,
+ "success_url": "http://selfhosting.testserver/realm/f267ada0-3e8e-4c92-991d-5715db017e75/billing/event_status/?stripe_session_id={CHECKOUT_SESSION_ID}",
+ "total_details": null,
+ "ui_mode": "hosted",
+ "url": "https://checkout.stripe.com/c/pay/cs_test_c1AW8fEbcPdhctLWfgzkQ41lXw0DdofTO2wFS3ttiE2UqiqJI3B0R0xQ3P#fid1d2BpamRhQ2prcSc%2FJ1ZqcHdmYCVWZGt2JVV3aicpJ2p1cWxobHZxbGZSZGlpYHFXYGthYHcnP3F3cGApJ2R1bE5gfCc%2FJ3VuWnFgdnFaXVRmMU5zNkldQTY9SnNRY09XZml2UXNQJyknY3dqaFZgd3Ngdyc%2FcXdwYCknaWR8anBxUXx1YCc%2FJ3Zsa2JpYFpmamlwaGsnKSdga2RnaWBVaWRmYG1qaWFgd3YnP3F3cGB4JSUl"
+}
diff --git a/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--checkout.Session.list.1.json b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--checkout.Session.list.1.json
new file mode 100644
index 00000000000..8e02ead8302
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan--checkout.Session.list.1.json
@@ -0,0 +1,82 @@
+{
+ "data": [
+ {
+ "after_expiration": null,
+ "allow_promotion_codes": null,
+ "amount_subtotal": null,
+ "amount_total": null,
+ "automatic_tax": {
+ "enabled": false,
+ "liability": null,
+ "status": null
+ },
+ "billing_address_collection": "required",
+ "cancel_url": "http://selfhosting.testserver/realm/f267ada0-3e8e-4c92-991d-5715db017e75/upgrade/?manual_license_management=false&tier=1",
+ "client_reference_id": null,
+ "client_secret": null,
+ "consent": null,
+ "consent_collection": null,
+ "created": 1708008527,
+ "currency": null,
+ "currency_conversion": null,
+ "custom_fields": [],
+ "custom_text": {
+ "after_submit": null,
+ "shipping_address": null,
+ "submit": null,
+ "terms_of_service_acceptance": null
+ },
+ "customer": "cus_PZEia820z9Zo16",
+ "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": 1708094927,
+ "id": "cs_test_c1AW8fEbcPdhctLWfgzkQ41lXw0DdofTO2wFS3ttiE2UqiqJI3B0R0xQ3P",
+ "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_1Ok6F1DEQaroqDjsaAnghUo3",
+ "shipping": null,
+ "shipping_address_collection": null,
+ "shipping_options": [],
+ "shipping_rate": null,
+ "status": "open",
+ "submit_type": null,
+ "subscription": null,
+ "success_url": "http://selfhosting.testserver/realm/f267ada0-3e8e-4c92-991d-5715db017e75/billing/event_status/?stripe_session_id={CHECKOUT_SESSION_ID}",
+ "total_details": null,
+ "ui_mode": "hosted",
+ "url": "https://checkout.stripe.com/c/pay/cs_test_c1AW8fEbcPdhctLWfgzkQ41lXw0DdofTO2wFS3ttiE2UqiqJI3B0R0xQ3P#fid1d2BpamRhQ2prcSc%2FJ1ZqcHdmYCVWZGt2JVV3aicpJ2p1cWxobHZxbGZSZGlpYHFXYGthYHcnP3F3cGApJ2R1bE5gfCc%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 350d04b4cca..acd6d44d41b 100644
--- a/corporate/tests/test_stripe.py
+++ b/corporate/tests/test_stripe.py
@@ -6788,6 +6788,105 @@ class TestRemoteRealmBillingFlow(StripeTestCase, RemoteRealmBillingTestCase):
self.assertEqual(legacy_plan.status, CustomerPlan.ENDED)
self.assertEqual(legacy_plan.next_invoice_date, None)
+ @responses.activate
+ @mock_stripe()
+ def test_schedule_fixed_price_plan_upgrade_to_another_fixed_price_plan(
+ self, *mocks: Mock
+ ) -> None:
+ self.login("iago")
+
+ self.add_mock_response()
+ with time_machine.travel(self.now, tick=False):
+ send_server_data_to_push_bouncer(consider_usage_statistics=False)
+
+ # Configure required_plan_tier and fixed_price.
+ annual_fixed_price = 1200
+ result = self.client_post(
+ "/activity/remote/support",
+ {
+ "remote_realm_id": f"{self.remote_realm.id}",
+ "required_plan_tier": CustomerPlan.TIER_SELF_HOSTED_BASIC,
+ },
+ )
+ result = self.client_post(
+ "/activity/remote/support",
+ {"remote_realm_id": f"{self.remote_realm.id}", "fixed_price": annual_fixed_price},
+ )
+ self.assert_in_success_response(
+ ["Customer can now buy a fixed price Zulip Basic plan."], result
+ )
+
+ self.logout()
+ self.login("hamlet")
+ hamlet = self.example_user("hamlet")
+
+ # Upgrade to fixed-price Zulip Basic plan with monthly billing_schedule.
+ 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"
+ )
+
+ customer = Customer.objects.get(stripe_customer_id=stripe_customer.id)
+ current_plan = CustomerPlan.objects.get(customer=customer, status=CustomerPlan.ACTIVE)
+ end_date = add_months(self.now, 12)
+ self.assertIsNotNone(current_plan.fixed_price)
+ self.assertEqual(current_plan.billing_schedule, CustomerPlan.BILLING_SCHEDULE_MONTHLY)
+ self.assertEqual(current_plan.end_date, end_date)
+
+ # Invoice for february to november
+ for invoice_count in range(1, 11):
+ with time_machine.travel(add_months(self.now, invoice_count), tick=False):
+ send_server_data_to_push_bouncer(consider_usage_statistics=False)
+ invoice_plans_as_needed()
+
+ billing_entity = self.billing_session.billing_entity_display_name
+
+ self.logout()
+ self.login("iago")
+
+ # Verify that we can't schedule a new fixed-price plan until invoice for 12th month is processed.
+ result = self.client_post(
+ "/activity/remote/support",
+ {"remote_realm_id": f"{self.remote_realm.id}", "fixed_price": annual_fixed_price + 200},
+ )
+ self.assert_in_success_response(
+ [
+ f"New plan for {billing_entity} can not be scheduled until all the invoices of the current plan are processed."
+ ],
+ result,
+ )
+
+ # Customer is charged for the last month of current plan.
+ with time_machine.travel(add_months(self.now, 11), tick=False):
+ send_server_data_to_push_bouncer(consider_usage_statistics=False)
+ invoice_plans_as_needed()
+
+ # All the monthly invoices are processed, now we can schedule a plan.
+ updated_annual_fixed_price = annual_fixed_price + 500
+ result = self.client_post(
+ "/activity/remote/support",
+ {
+ "remote_realm_id": f"{self.remote_realm.id}",
+ "fixed_price": updated_annual_fixed_price,
+ },
+ )
+ self.assert_in_success_response(
+ [f"Fixed price Zulip Basic plan scheduled to start on {end_date.date()}."],
+ result,
+ )
+
+ # Cron runs on end_date and customer switches to the new plan
+ with time_machine.travel(end_date, tick=False):
+ send_server_data_to_push_bouncer(consider_usage_statistics=False)
+ invoice_plans_as_needed()
+ current_plan.refresh_from_db()
+ self.assertEqual(current_plan.status, CustomerPlan.ENDED)
+ new_plan = get_current_plan_by_customer(customer)
+ assert new_plan is not None
+ self.assertEqual(new_plan.status, CustomerPlan.ACTIVE)
+ self.assertEqual(new_plan.fixed_price, updated_annual_fixed_price * 100)
+
@responses.activate
def test_request_sponsorship(self) -> None:
self.login("hamlet")