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 additional licenses in one invoice item.

Lauryn Menardc27366920352
diff --git a/corporate/lib/stripe.py b/corporate/lib/stripe.py
index 3e9c3dc2ff0..d5c9aef8336 100644
--- a/corporate/lib/stripe.py
+++ b/corporate/lib/stripe.py
@@ -5,7 +5,7 @@ import secrets
from abc import ABC, abstractmethod
from collections.abc import Callable, Generator
from dataclasses import dataclass
-from datetime import datetime, timedelta, timezone
+from datetime import date, datetime, timedelta, timezone
from decimal import Decimal
from enum import Enum, IntEnum
from functools import wraps
@@ -3324,6 +3324,17 @@ class BillingSession(ABC):
)
return invoice_item_params
+ def update_additional_licenses_invoice_item_quantity(
+ self,
+ ledger_entry: LicenseLedger,
+ invoice_item: stripe.params.InvoiceItemCreateParams,
+ licenses_base: int,
+ ) -> stripe.params.InvoiceItemCreateParams:
+ current_quantity = invoice_item.get("quantity")
+ assert current_quantity is not None
+ invoice_item["quantity"] = current_quantity + (ledger_entry.licenses - licenses_base)
+ return invoice_item
+
def invoice_plan(self, plan: CustomerPlan, event_time: datetime) -> None:
if plan.invoicing_status == CustomerPlan.INVOICING_STATUS_STARTED:
raise NotImplementedError(
@@ -3364,8 +3375,15 @@ class BillingSession(ABC):
# Invoice Variables
stripe_invoice: stripe.Invoice | None = None
+ # Track invoice item parameters for additional licenses added on a specific
+ # date so that we can bundle them into one item on the invoice.
+ current_tracked_date: date | None = None
+ complete_invoice_items: list[stripe.params.InvoiceItemCreateParams] = []
+ pending_invoice_item: stripe.params.InvoiceItemCreateParams | None = None
+
# Track if we added renewal invoice item which is possibly eligible for discount.
renewal_invoice_period: stripe.params.InvoiceItemCreateParamsPeriod | None = None
+
for ledger_entry in LicenseLedger.objects.filter(
plan=plan, id__gt=invoiced_through_id, event_time__lte=event_time
).order_by("id"):
@@ -3397,23 +3415,51 @@ class BillingSession(ABC):
invoice_item_params = self.build_renewal_invoice_item_parameters(
plan, ledger_entry, stripe_invoice, invoice_period
)
+ complete_invoice_items.append(invoice_item_params)
else:
- # TODO: Bundle additional licenses by date added so that
- # we don't exceed the limit of 250 invoice items in Stripe.
assert licenses_base is not None
- invoice_item_params = (
- self.build_additional_licenses_invoice_item_parameters(
- plan, ledger_entry, licenses_base, stripe_invoice, invoice_period
+ if (
+ current_tracked_date is not None
+ and current_tracked_date == ledger_entry.event_time.date()
+ ):
+ assert pending_invoice_item is not None
+ # Update tracked pending invoice item parameters for new
+ # additional licenses that were added on the same date.
+ pending_invoice_item = (
+ self.update_additional_licenses_invoice_item_quantity(
+ ledger_entry, pending_invoice_item, licenses_base
+ )
)
- )
-
- stripe.InvoiceItem.create(**invoice_item_params)
+ else:
+ # Add the completed invoice item parameters to the tracked
+ # list, if it exists.
+ if pending_invoice_item is not None:
+ complete_invoice_items.append(pending_invoice_item)
+ # Create new invoice item parameters and update tracked date.
+ pending_invoice_item = (
+ self.build_additional_licenses_invoice_item_parameters(
+ plan,
+ ledger_entry,
+ licenses_base,
+ stripe_invoice,
+ invoice_period,
+ )
+ )
+ current_tracked_date = ledger_entry.event_time.date()
# Update license base per ledger_entry.
licenses_base = ledger_entry.licenses
plan.invoiced_through = ledger_entry
plan.save(update_fields=["invoiced_through"])
+ # Add pending invoice item parameters to complete invoice
+ # item list, if it exists.
+ if pending_invoice_item is not None:
+ complete_invoice_items.append(pending_invoice_item)
+
+ for invoice_item in complete_invoice_items:
+ stripe.InvoiceItem.create(**invoice_item)
+
if stripe_invoice is not None:
# Only apply discount if this invoice contains renewal of the plan.
# Note that only self-hosted plans have a flat rate discount offer.
diff --git a/corporate/tests/stripe_fixtures/invoice_plan--Event.list.1.json b/corporate/tests/stripe_fixtures/invoice_plan--Event.list.1.json
index 09c64ab18a8..0eca6635b29 100644
--- a/corporate/tests/stripe_fixtures/invoice_plan--Event.list.1.json
+++ b/corporate/tests/stripe_fixtures/invoice_plan--Event.list.1.json
@@ -45,7 +45,7 @@
"id": "invoice_plan--Event.list.1.json",
"livemode": false,
"object": "event",
- "pending_webhooks": 1,
+ "pending_webhooks": 0,
"request": {
"id": "invoice_plan--Event.list.1.json",
"idempotency_key": "00000000-0000-0000-0000-000000000000"
diff --git a/corporate/tests/stripe_fixtures/invoice_plan--Event.list.2.json b/corporate/tests/stripe_fixtures/invoice_plan--Event.list.2.json
index bbbf286e2fc..11eb3ffb9c3 100644
--- a/corporate/tests/stripe_fixtures/invoice_plan--Event.list.2.json
+++ b/corporate/tests/stripe_fixtures/invoice_plan--Event.list.2.json
@@ -69,7 +69,7 @@
"on_behalf_of": null,
"payment_details": {
"customer_reference": null,
- "order_reference": "in_1SPOxlRVfKEFJaqcZnJKoA"
+ "order_reference": "in_1SPn19DwzgQ85STgRErffF"
},
"payment_method": "pm_NORMALIZED",
"payment_method_configuration_details": null,
@@ -104,7 +104,7 @@
"id": "invoice_plan--Event.list.2.json",
"livemode": false,
"object": "event",
- "pending_webhooks": 1,
+ "pending_webhooks": 0,
"request": {
"id": "invoice_plan--Event.list.2.json",
"idempotency_key": "00000000-0000-0000-0000-000000000000"
@@ -173,7 +173,7 @@
"payment_method_details": {
"card": {
"amount_authorized": 48000,
- "authorization_code": "951621",
+ "authorization_code": "946507",
"brand": "visa",
"checks": {
"address_line1_check": "pass",
@@ -201,7 +201,7 @@
"network_token": {
"used": false
},
- "network_transaction_id": "100110997670110",
+ "network_transaction_id": "749857738210088",
"overcapture": {
"maximum_amount_capturable": 48000,
"status": "unavailable"
@@ -231,7 +231,7 @@
"id": "invoice_plan--Event.list.2.json",
"livemode": false,
"object": "event",
- "pending_webhooks": 2,
+ "pending_webhooks": 0,
"request": {
"id": "invoice_plan--Event.list.2.json",
"idempotency_key": "00000000-0000-0000-0000-000000000000"
@@ -279,7 +279,7 @@
"default_payment_method": null,
"default_source": null,
"default_tax_rates": [],
- "description": null,
+ "description": "If paying by bank transfer outside of the US, use the OUR option for who should pay bank transfer fees, to make sure that your invoice is paid in full.",
"discounts": [],
"due_date": null,
"effective_at": 1000000000,
@@ -394,7 +394,7 @@
"total_excluding_tax": 48000,
"total_pretax_credit_amounts": [],
"total_taxes": [],
- "webhooks_delivered_at": null
+ "webhooks_delivered_at": 1000000000
}
},
"id": "invoice_plan--Event.list.2.json",
@@ -448,7 +448,7 @@
"default_payment_method": null,
"default_source": null,
"default_tax_rates": [],
- "description": null,
+ "description": "If paying by bank transfer outside of the US, use the OUR option for who should pay bank transfer fees, to make sure that your invoice is paid in full.",
"discounts": [],
"due_date": null,
"effective_at": 1000000000,
@@ -563,7 +563,7 @@
"total_excluding_tax": 48000,
"total_pretax_credit_amounts": [],
"total_taxes": [],
- "webhooks_delivered_at": null
+ "webhooks_delivered_at": 1000000000
},
"previous_attributes": {
"effective_at": null,
@@ -705,7 +705,7 @@
"default_payment_method": null,
"default_source": null,
"default_tax_rates": [],
- "description": null,
+ "description": "If paying by bank transfer outside of the US, use the OUR option for who should pay bank transfer fees, to make sure that your invoice is paid in full.",
"discounts": [],
"due_date": null,
"effective_at": null,
@@ -820,7 +820,7 @@
"total_excluding_tax": 48000,
"total_pretax_credit_amounts": [],
"total_taxes": [],
- "webhooks_delivered_at": null
+ "webhooks_delivered_at": 1000000000
},
"previous_attributes": {
"amount_due": 0,
@@ -933,7 +933,7 @@
"default_payment_method": null,
"default_source": null,
"default_tax_rates": [],
- "description": null,
+ "description": "If paying by bank transfer outside of the US, use the OUR option for who should pay bank transfer fees, to make sure that your invoice is paid in full.",
"discounts": [],
"due_date": null,
"effective_at": null,
@@ -1007,7 +1007,7 @@
"total_excluding_tax": 0,
"total_pretax_credit_amounts": [],
"total_taxes": [],
- "webhooks_delivered_at": null
+ "webhooks_delivered_at": 1000000000
}
},
"id": "invoice_plan--Event.list.2.json",
@@ -1071,7 +1071,7 @@
"type": "customer.updated"
}
],
- "has_more": true,
+ "has_more": false,
"object": "list",
"url": "/v1/events"
}
diff --git a/corporate/tests/stripe_fixtures/invoice_plan--Event.list.3.json b/corporate/tests/stripe_fixtures/invoice_plan--Event.list.3.json
index f3988fe1629..e0486ffd4a9 100644
--- a/corporate/tests/stripe_fixtures/invoice_plan--Event.list.3.json
+++ b/corporate/tests/stripe_fixtures/invoice_plan--Event.list.3.json
@@ -41,7 +41,7 @@
"default_payment_method": null,
"default_source": null,
"default_tax_rates": [],
- "description": null,
+ "description": "If paying by bank transfer outside of the US, use the OUR option for who should pay bank transfer fees, to make sure that your invoice is paid in full.",
"discounts": [],
"due_date": null,
"effective_at": 1000000000,
@@ -156,7 +156,7 @@
"total_excluding_tax": 48000,
"total_pretax_credit_amounts": [],
"total_taxes": [],
- "webhooks_delivered_at": null
+ "webhooks_delivered_at": 1000000000
}
},
"id": "invoice_plan--Event.list.3.json",
@@ -210,7 +210,7 @@
"default_payment_method": null,
"default_source": null,
"default_tax_rates": [],
- "description": null,
+ "description": "If paying by bank transfer outside of the US, use the OUR option for who should pay bank transfer fees, to make sure that your invoice is paid in full.",
"discounts": [],
"due_date": null,
"effective_at": 1000000000,
@@ -325,7 +325,7 @@
"total_excluding_tax": 48000,
"total_pretax_credit_amounts": [],
"total_taxes": [],
- "webhooks_delivered_at": null
+ "webhooks_delivered_at": 1000000000
}
},
"id": "invoice_plan--Event.list.3.json",
@@ -379,7 +379,7 @@
"default_payment_method": null,
"default_source": null,
"default_tax_rates": [],
- "description": null,
+ "description": "If paying by bank transfer outside of the US, use the OUR option for who should pay bank transfer fees, to make sure that your invoice is paid in full.",
"discounts": [],
"due_date": null,
"effective_at": 1000000000,
@@ -494,7 +494,7 @@
"total_excluding_tax": 48000,
"total_pretax_credit_amounts": [],
"total_taxes": [],
- "webhooks_delivered_at": null
+ "webhooks_delivered_at": 1000000000
},
"previous_attributes": {
"amount_paid": 0,
diff --git a/corporate/tests/stripe_fixtures/invoice_plan--Invoice.create.1.json b/corporate/tests/stripe_fixtures/invoice_plan--Invoice.create.1.json
index 8974987786b..ee464aacdaf 100644
--- a/corporate/tests/stripe_fixtures/invoice_plan--Invoice.create.1.json
+++ b/corporate/tests/stripe_fixtures/invoice_plan--Invoice.create.1.json
@@ -35,7 +35,7 @@
"default_payment_method": null,
"default_source": null,
"default_tax_rates": [],
- "description": null,
+ "description": "If paying by bank transfer outside of the US, use the OUR option for who should pay bank transfer fees, to make sure that your invoice is paid in full.",
"discounts": [],
"due_date": null,
"effective_at": null,
@@ -109,5 +109,5 @@
"total_excluding_tax": 0,
"total_pretax_credit_amounts": [],
"total_taxes": [],
- "webhooks_delivered_at": null
+ "webhooks_delivered_at": 1000000000
}
diff --git a/corporate/tests/stripe_fixtures/invoice_plan--Invoice.create.2.json b/corporate/tests/stripe_fixtures/invoice_plan--Invoice.create.2.json
index 732487bb927..3bff16bafdf 100644
--- a/corporate/tests/stripe_fixtures/invoice_plan--Invoice.create.2.json
+++ b/corporate/tests/stripe_fixtures/invoice_plan--Invoice.create.2.json
@@ -35,7 +35,7 @@
"default_payment_method": null,
"default_source": null,
"default_tax_rates": [],
- "description": null,
+ "description": "If paying by bank transfer outside of the US, use the OUR option for who should pay bank transfer fees, to make sure that your invoice is paid in full.",
"discounts": [],
"due_date": null,
"effective_at": null,
@@ -101,5 +101,5 @@
"total_excluding_tax": 0,
"total_pretax_credit_amounts": [],
"total_taxes": [],
- "webhooks_delivered_at": null
+ "webhooks_delivered_at": 1000000000
}
diff --git a/corporate/tests/stripe_fixtures/invoice_plan--Invoice.finalize_invoice.1.json b/corporate/tests/stripe_fixtures/invoice_plan--Invoice.finalize_invoice.1.json
index 5885305d594..67b00533714 100644
--- a/corporate/tests/stripe_fixtures/invoice_plan--Invoice.finalize_invoice.1.json
+++ b/corporate/tests/stripe_fixtures/invoice_plan--Invoice.finalize_invoice.1.json
@@ -35,7 +35,7 @@
"default_payment_method": null,
"default_source": null,
"default_tax_rates": [],
- "description": null,
+ "description": "If paying by bank transfer outside of the US, use the OUR option for who should pay bank transfer fees, to make sure that your invoice is paid in full.",
"discounts": [],
"due_date": null,
"effective_at": 1000000000,
@@ -150,5 +150,5 @@
"total_excluding_tax": 48000,
"total_pretax_credit_amounts": [],
"total_taxes": [],
- "webhooks_delivered_at": null
+ "webhooks_delivered_at": 1000000000
}
diff --git a/corporate/tests/stripe_fixtures/invoice_plan--Invoice.finalize_invoice.2.json b/corporate/tests/stripe_fixtures/invoice_plan--Invoice.finalize_invoice.2.json
index c2b2880cbb0..86b20c6fe35 100644
--- a/corporate/tests/stripe_fixtures/invoice_plan--Invoice.finalize_invoice.2.json
+++ b/corporate/tests/stripe_fixtures/invoice_plan--Invoice.finalize_invoice.2.json
@@ -35,7 +35,7 @@
"default_payment_method": null,
"default_source": null,
"default_tax_rates": [],
- "description": null,
+ "description": "If paying by bank transfer outside of the US, use the OUR option for who should pay bank transfer fees, to make sure that your invoice is paid in full.",
"discounts": [],
"due_date": null,
"effective_at": 1000000000,
@@ -93,9 +93,9 @@
"taxes": []
},
{
- "amount": 56000,
+ "amount": 17442,
"currency": "usd",
- "description": "Zulip Cloud Standard - renewal",
+ "description": "Additional license (Apr 11, 2012 - Jan 2, 2013)",
"discount_amounts": [],
"discountable": false,
"discounts": [],
@@ -117,8 +117,8 @@
"type": "invoice_item_details"
},
"period": {
- "end": 1388631845,
- "start": 1357095845
+ "end": 1357095845,
+ "start": 1334113445
},
"pretax_credit_amounts": [],
"pricing": {
@@ -127,15 +127,15 @@
"product": "prod_NORMALIZED"
},
"type": "price_details",
- "unit_amount_decimal": "8000"
+ "unit_amount_decimal": "5814"
},
- "quantity": 7,
+ "quantity": 3,
"taxes": []
},
{
- "amount": 17442,
+ "amount": 56000,
"currency": "usd",
- "description": "Additional license (Apr 11, 2012 - Jan 2, 2013)",
+ "description": "Zulip Cloud Standard - renewal",
"discount_amounts": [],
"discountable": false,
"discounts": [],
@@ -157,8 +157,8 @@
"type": "invoice_item_details"
},
"period": {
- "end": 1357095845,
- "start": 1334113445
+ "end": 1388631845,
+ "start": 1357095845
},
"pretax_credit_amounts": [],
"pricing": {
@@ -167,9 +167,9 @@
"product": "prod_NORMALIZED"
},
"type": "price_details",
- "unit_amount_decimal": "5814"
+ "unit_amount_decimal": "8000"
},
- "quantity": 3,
+ "quantity": 7,
"taxes": []
}
],
diff --git a/corporate/tests/stripe_fixtures/invoice_plan--Invoice.list.2.json b/corporate/tests/stripe_fixtures/invoice_plan--Invoice.list.2.json
index 430363e69b8..a44b6bbbfc8 100644
--- a/corporate/tests/stripe_fixtures/invoice_plan--Invoice.list.2.json
+++ b/corporate/tests/stripe_fixtures/invoice_plan--Invoice.list.2.json
@@ -37,7 +37,7 @@
"default_payment_method": null,
"default_source": null,
"default_tax_rates": [],
- "description": null,
+ "description": "If paying by bank transfer outside of the US, use the OUR option for who should pay bank transfer fees, to make sure that your invoice is paid in full.",
"discounts": [],
"due_date": null,
"effective_at": 1000000000,
@@ -95,9 +95,9 @@
"taxes": []
},
{
- "amount": 56000,
+ "amount": 17442,
"currency": "usd",
- "description": "Zulip Cloud Standard - renewal",
+ "description": "Additional license (Apr 11, 2012 - Jan 2, 2013)",
"discount_amounts": [],
"discountable": false,
"discounts": [],
@@ -119,8 +119,8 @@
"type": "invoice_item_details"
},
"period": {
- "end": 1388631845,
- "start": 1357095845
+ "end": 1357095845,
+ "start": 1334113445
},
"pretax_credit_amounts": [],
"pricing": {
@@ -129,15 +129,15 @@
"product": "prod_NORMALIZED"
},
"type": "price_details",
- "unit_amount_decimal": "8000"
+ "unit_amount_decimal": "5814"
},
- "quantity": 7,
+ "quantity": 3,
"taxes": []
},
{
- "amount": 17442,
+ "amount": 56000,
"currency": "usd",
- "description": "Additional license (Apr 11, 2012 - Jan 2, 2013)",
+ "description": "Zulip Cloud Standard - renewal",
"discount_amounts": [],
"discountable": false,
"discounts": [],
@@ -159,8 +159,8 @@
"type": "invoice_item_details"
},
"period": {
- "end": 1357095845,
- "start": 1334113445
+ "end": 1388631845,
+ "start": 1357095845
},
"pretax_credit_amounts": [],
"pricing": {
@@ -169,9 +169,9 @@
"product": "prod_NORMALIZED"
},
"type": "price_details",
- "unit_amount_decimal": "5814"
+ "unit_amount_decimal": "8000"
},
- "quantity": 3,
+ "quantity": 7,
"taxes": []
}
],
@@ -263,7 +263,7 @@
"default_payment_method": null,
"default_source": null,
"default_tax_rates": [],
- "description": null,
+ "description": "If paying by bank transfer outside of the US, use the OUR option for who should pay bank transfer fees, to make sure that your invoice is paid in full.",
"discounts": [],
"due_date": null,
"effective_at": 1000000000,
@@ -378,7 +378,7 @@
"total_excluding_tax": 48000,
"total_pretax_credit_amounts": [],
"total_taxes": [],
- "webhooks_delivered_at": null
+ "webhooks_delivered_at": 1000000000
}
],
"has_more": false,
diff --git a/corporate/tests/stripe_fixtures/invoice_plan--Invoice.pay.1.json b/corporate/tests/stripe_fixtures/invoice_plan--Invoice.pay.1.json
index b5f0c344d8c..b0aaa8e2d53 100644
--- a/corporate/tests/stripe_fixtures/invoice_plan--Invoice.pay.1.json
+++ b/corporate/tests/stripe_fixtures/invoice_plan--Invoice.pay.1.json
@@ -35,7 +35,7 @@
"default_payment_method": null,
"default_source": null,
"default_tax_rates": [],
- "description": null,
+ "description": "If paying by bank transfer outside of the US, use the OUR option for who should pay bank transfer fees, to make sure that your invoice is paid in full.",
"discounts": [],
"due_date": null,
"effective_at": 1000000000,
@@ -150,5 +150,5 @@
"total_excluding_tax": 48000,
"total_pretax_credit_amounts": [],
"total_taxes": [],
- "webhooks_delivered_at": null
+ "webhooks_delivered_at": 1000000000
}
diff --git a/corporate/tests/stripe_fixtures/invoice_plan--InvoiceItem.create.2.json b/corporate/tests/stripe_fixtures/invoice_plan--InvoiceItem.create.2.json
index 619645024fc..5b1824fff69 100644
--- a/corporate/tests/stripe_fixtures/invoice_plan--InvoiceItem.create.2.json
+++ b/corporate/tests/stripe_fixtures/invoice_plan--InvoiceItem.create.2.json
@@ -1,21 +1,21 @@
{
- "amount": 17442,
+ "amount": 56000,
"currency": "usd",
"customer": "cus_NORMALIZED",
"date": 1000000000,
- "description": "Additional license (Apr 11, 2012 - Jan 2, 2013)",
+ "description": "Zulip Cloud Standard - renewal",
"discountable": false,
"discounts": [],
"id": "invoice_plan--InvoiceItem.create.2.json",
"invoice": "in_NORMALIZED",
"livemode": false,
"metadata": {},
- "net_amount": 17442,
+ "net_amount": 56000,
"object": "invoiceitem",
"parent": null,
"period": {
- "end": 1357095845,
- "start": 1334113445
+ "end": 1388631845,
+ "start": 1357095845
},
"pricing": {
"price_details": {
@@ -23,10 +23,10 @@
"product": "prod_NORMALIZED"
},
"type": "price_details",
- "unit_amount_decimal": "5814"
+ "unit_amount_decimal": "8000"
},
"proration": false,
- "quantity": 3,
+ "quantity": 7,
"tax_rates": [],
"test_clock": null
}
diff --git a/corporate/tests/stripe_fixtures/invoice_plan--InvoiceItem.create.3.json b/corporate/tests/stripe_fixtures/invoice_plan--InvoiceItem.create.3.json
index 4137ff283ab..593c793949a 100644
--- a/corporate/tests/stripe_fixtures/invoice_plan--InvoiceItem.create.3.json
+++ b/corporate/tests/stripe_fixtures/invoice_plan--InvoiceItem.create.3.json
@@ -1,21 +1,21 @@
{
- "amount": 56000,
+ "amount": 17442,
"currency": "usd",
"customer": "cus_NORMALIZED",
"date": 1000000000,
- "description": "Zulip Cloud Standard - renewal",
+ "description": "Additional license (Apr 11, 2012 - Jan 2, 2013)",
"discountable": false,
"discounts": [],
"id": "invoice_plan--InvoiceItem.create.3.json",
"invoice": "in_NORMALIZED",
"livemode": false,
"metadata": {},
- "net_amount": 56000,
+ "net_amount": 17442,
"object": "invoiceitem",
"parent": null,
"period": {
- "end": 1388631845,
- "start": 1357095845
+ "end": 1357095845,
+ "start": 1334113445
},
"pricing": {
"price_details": {
@@ -23,10 +23,10 @@
"product": "prod_NORMALIZED"
},
"type": "price_details",
- "unit_amount_decimal": "8000"
+ "unit_amount_decimal": "5814"
},
"proration": false,
- "quantity": 7,
+ "quantity": 3,
"tax_rates": [],
"test_clock": null
}
diff --git a/corporate/tests/stripe_fixtures/invoice_plan--checkout.Session.create.1.json b/corporate/tests/stripe_fixtures/invoice_plan--checkout.Session.create.1.json
index c125cf4e413..5e17a4b4745 100644
--- a/corporate/tests/stripe_fixtures/invoice_plan--checkout.Session.create.1.json
+++ b/corporate/tests/stripe_fixtures/invoice_plan--checkout.Session.create.1.json
@@ -14,17 +14,17 @@
},
"billing_address_collection": "required",
"branding_settings": {
- "background_color": "#ffffff",
+ "background_color": "#dbedff",
"border_style": "rounded",
- "button_color": "#0074d4",
- "display_name": "Sandbox",
- "font_family": "default",
+ "button_color": "#3e6bfe",
+ "display_name": "Violet Beam",
+ "font_family": "source_sans_pro",
"icon": {
- "file": "file_1RCGizRVfKEFJaqcFHPvd6rl",
+ "file": "file_1RxpnoDwzgQ85STgf3bBl5KY",
"type": "file"
},
"logo": {
- "file": "file_1RCGiyRVfKEFJaqc9ny0K376",
+ "file": "file_1RxpnoDwzgQ85STgvEm4ntJu",
"type": "file"
}
},
diff --git a/corporate/tests/stripe_fixtures/invoice_plan--checkout.Session.list.1.json b/corporate/tests/stripe_fixtures/invoice_plan--checkout.Session.list.1.json
index 28b4a5bbd21..6be52105f42 100644
--- a/corporate/tests/stripe_fixtures/invoice_plan--checkout.Session.list.1.json
+++ b/corporate/tests/stripe_fixtures/invoice_plan--checkout.Session.list.1.json
@@ -16,17 +16,17 @@
},
"billing_address_collection": "required",
"branding_settings": {
- "background_color": "#ffffff",
+ "background_color": "#dbedff",
"border_style": "rounded",
- "button_color": "#0074d4",
- "display_name": "Sandbox",
- "font_family": "default",
+ "button_color": "#3e6bfe",
+ "display_name": "Violet Beam",
+ "font_family": "source_sans_pro",
"icon": {
- "file": "file_1RCGizRVfKEFJaqcFHPvd6rl",
+ "file": "file_1RxpnoDwzgQ85STgf3bBl5KY",
"type": "file"
},
"logo": {
- "file": "file_1RCGiyRVfKEFJaqc9ny0K376",
+ "file": "file_1RxpnoDwzgQ85STgvEm4ntJu",
"type": "file"
}
},
diff --git a/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--Customer.create.1.json b/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--Customer.create.1.json
new file mode 100644
index 00000000000..1f0c522a4b3
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--Customer.create.1.json
@@ -0,0 +1,32 @@
+{
+ "address": null,
+ "balance": 0,
+ "created": 1000000000,
+ "currency": null,
+ "default_source": null,
+ "delinquent": false,
+ "description": "zulip (Zulip Dev)",
+ "discount": null,
+ "email": "[email protected]",
+ "id": "invoice_plan_bundle_additional_licenses--Customer.create.1.json",
+ "invoice_prefix": "NORMALIZED",
+ "invoice_settings": {
+ "custom_fields": null,
+ "default_payment_method": null,
+ "footer": null,
+ "rendering_options": null
+ },
+ "livemode": false,
+ "metadata": {
+ "realm_id": "1",
+ "realm_str": "zulip"
+ },
+ "name": null,
+ "next_invoice_sequence": 1,
+ "object": "customer",
+ "phone": null,
+ "preferred_locales": [],
+ "shipping": null,
+ "tax_exempt": "none",
+ "test_clock": null
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--Customer.modify.1.json b/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--Customer.modify.1.json
new file mode 100644
index 00000000000..bec0249fe1b
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--Customer.modify.1.json
@@ -0,0 +1,32 @@
+{
+ "address": null,
+ "balance": 0,
+ "created": 1000000000,
+ "currency": null,
+ "default_source": null,
+ "delinquent": false,
+ "description": "zulip (Zulip Dev)",
+ "discount": null,
+ "email": "[email protected]",
+ "id": "invoice_plan_bundle_additional_licenses--Customer.create.1.json",
+ "invoice_prefix": "NORMALIZED",
+ "invoice_settings": {
+ "custom_fields": null,
+ "default_payment_method": "pm_NORMALIZED",
+ "footer": null,
+ "rendering_options": null
+ },
+ "livemode": false,
+ "metadata": {
+ "realm_id": "1",
+ "realm_str": "zulip"
+ },
+ "name": null,
+ "next_invoice_sequence": 1,
+ "object": "customer",
+ "phone": null,
+ "preferred_locales": [],
+ "shipping": null,
+ "tax_exempt": "none",
+ "test_clock": null
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--Customer.retrieve.1.json b/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--Customer.retrieve.1.json
new file mode 100644
index 00000000000..f52ee27b73d
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--Customer.retrieve.1.json
@@ -0,0 +1,82 @@
+{
+ "address": null,
+ "balance": 0,
+ "created": 1000000000,
+ "currency": null,
+ "default_source": null,
+ "delinquent": false,
+ "description": "zulip (Zulip Dev)",
+ "discount": null,
+ "email": "[email protected]",
+ "id": "invoice_plan_bundle_additional_licenses--Customer.create.1.json",
+ "invoice_prefix": "NORMALIZED",
+ "invoice_settings": {
+ "custom_fields": null,
+ "default_payment_method": {
+ "allow_redisplay": "unspecified",
+ "billing_details": {
+ "address": {
+ "city": "San Francisco",
+ "country": "US",
+ "line1": "123 Main St",
+ "line2": null,
+ "postal_code": "12345",
+ "state": "CA"
+ },
+ "email": null,
+ "name": "John Doe",
+ "phone": null,
+ "tax_id": null
+ },
+ "card": {
+ "brand": "visa",
+ "checks": {
+ "address_line1_check": "pass",
+ "address_postal_code_check": "pass",
+ "cvc_check": "pass"
+ },
+ "country": "US",
+ "display_brand": "visa",
+ "exp_month": 1,
+ "exp_year": 9999,
+ "fingerprint": "NORMALIZED",
+ "funding": "credit",
+ "generated_from": null,
+ "last4": "4242",
+ "networks": {
+ "available": [
+ "visa"
+ ],
+ "preferred": null
+ },
+ "regulated_status": "unregulated",
+ "three_d_secure_usage": {
+ "supported": true
+ },
+ "wallet": null
+ },
+ "created": 1000000000,
+ "customer": "invoice_plan_bundle_additional_licenses--Customer.create.1.json",
+ "id": "invoice_plan_bundle_additional_licenses--Customer.retrieve.1.json",
+ "livemode": false,
+ "metadata": {},
+ "object": "payment_method",
+ "type": "card"
+ },
+ "footer": null,
+ "rendering_options": null
+ },
+ "livemode": false,
+ "metadata": {
+ "realm_id": "1",
+ "realm_str": "zulip"
+ },
+ "name": null,
+ "next_invoice_sequence": 1,
+ "object": "customer",
+ "phone": null,
+ "preferred_locales": [],
+ "shipping": null,
+ "tax_exempt": "none",
+ "test_clock": null
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--Customer.retrieve.2.json b/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--Customer.retrieve.2.json
new file mode 100644
index 00000000000..f52ee27b73d
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--Customer.retrieve.2.json
@@ -0,0 +1,82 @@
+{
+ "address": null,
+ "balance": 0,
+ "created": 1000000000,
+ "currency": null,
+ "default_source": null,
+ "delinquent": false,
+ "description": "zulip (Zulip Dev)",
+ "discount": null,
+ "email": "[email protected]",
+ "id": "invoice_plan_bundle_additional_licenses--Customer.create.1.json",
+ "invoice_prefix": "NORMALIZED",
+ "invoice_settings": {
+ "custom_fields": null,
+ "default_payment_method": {
+ "allow_redisplay": "unspecified",
+ "billing_details": {
+ "address": {
+ "city": "San Francisco",
+ "country": "US",
+ "line1": "123 Main St",
+ "line2": null,
+ "postal_code": "12345",
+ "state": "CA"
+ },
+ "email": null,
+ "name": "John Doe",
+ "phone": null,
+ "tax_id": null
+ },
+ "card": {
+ "brand": "visa",
+ "checks": {
+ "address_line1_check": "pass",
+ "address_postal_code_check": "pass",
+ "cvc_check": "pass"
+ },
+ "country": "US",
+ "display_brand": "visa",
+ "exp_month": 1,
+ "exp_year": 9999,
+ "fingerprint": "NORMALIZED",
+ "funding": "credit",
+ "generated_from": null,
+ "last4": "4242",
+ "networks": {
+ "available": [
+ "visa"
+ ],
+ "preferred": null
+ },
+ "regulated_status": "unregulated",
+ "three_d_secure_usage": {
+ "supported": true
+ },
+ "wallet": null
+ },
+ "created": 1000000000,
+ "customer": "invoice_plan_bundle_additional_licenses--Customer.create.1.json",
+ "id": "invoice_plan_bundle_additional_licenses--Customer.retrieve.1.json",
+ "livemode": false,
+ "metadata": {},
+ "object": "payment_method",
+ "type": "card"
+ },
+ "footer": null,
+ "rendering_options": null
+ },
+ "livemode": false,
+ "metadata": {
+ "realm_id": "1",
+ "realm_str": "zulip"
+ },
+ "name": null,
+ "next_invoice_sequence": 1,
+ "object": "customer",
+ "phone": null,
+ "preferred_locales": [],
+ "shipping": null,
+ "tax_exempt": "none",
+ "test_clock": null
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--Customer.retrieve.3.json b/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--Customer.retrieve.3.json
new file mode 100644
index 00000000000..f52ee27b73d
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--Customer.retrieve.3.json
@@ -0,0 +1,82 @@
+{
+ "address": null,
+ "balance": 0,
+ "created": 1000000000,
+ "currency": null,
+ "default_source": null,
+ "delinquent": false,
+ "description": "zulip (Zulip Dev)",
+ "discount": null,
+ "email": "[email protected]",
+ "id": "invoice_plan_bundle_additional_licenses--Customer.create.1.json",
+ "invoice_prefix": "NORMALIZED",
+ "invoice_settings": {
+ "custom_fields": null,
+ "default_payment_method": {
+ "allow_redisplay": "unspecified",
+ "billing_details": {
+ "address": {
+ "city": "San Francisco",
+ "country": "US",
+ "line1": "123 Main St",
+ "line2": null,
+ "postal_code": "12345",
+ "state": "CA"
+ },
+ "email": null,
+ "name": "John Doe",
+ "phone": null,
+ "tax_id": null
+ },
+ "card": {
+ "brand": "visa",
+ "checks": {
+ "address_line1_check": "pass",
+ "address_postal_code_check": "pass",
+ "cvc_check": "pass"
+ },
+ "country": "US",
+ "display_brand": "visa",
+ "exp_month": 1,
+ "exp_year": 9999,
+ "fingerprint": "NORMALIZED",
+ "funding": "credit",
+ "generated_from": null,
+ "last4": "4242",
+ "networks": {
+ "available": [
+ "visa"
+ ],
+ "preferred": null
+ },
+ "regulated_status": "unregulated",
+ "three_d_secure_usage": {
+ "supported": true
+ },
+ "wallet": null
+ },
+ "created": 1000000000,
+ "customer": "invoice_plan_bundle_additional_licenses--Customer.create.1.json",
+ "id": "invoice_plan_bundle_additional_licenses--Customer.retrieve.1.json",
+ "livemode": false,
+ "metadata": {},
+ "object": "payment_method",
+ "type": "card"
+ },
+ "footer": null,
+ "rendering_options": null
+ },
+ "livemode": false,
+ "metadata": {
+ "realm_id": "1",
+ "realm_str": "zulip"
+ },
+ "name": null,
+ "next_invoice_sequence": 1,
+ "object": "customer",
+ "phone": null,
+ "preferred_locales": [],
+ "shipping": null,
+ "tax_exempt": "none",
+ "test_clock": null
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--Customer.retrieve.4.json b/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--Customer.retrieve.4.json
new file mode 100644
index 00000000000..f52ee27b73d
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--Customer.retrieve.4.json
@@ -0,0 +1,82 @@
+{
+ "address": null,
+ "balance": 0,
+ "created": 1000000000,
+ "currency": null,
+ "default_source": null,
+ "delinquent": false,
+ "description": "zulip (Zulip Dev)",
+ "discount": null,
+ "email": "[email protected]",
+ "id": "invoice_plan_bundle_additional_licenses--Customer.create.1.json",
+ "invoice_prefix": "NORMALIZED",
+ "invoice_settings": {
+ "custom_fields": null,
+ "default_payment_method": {
+ "allow_redisplay": "unspecified",
+ "billing_details": {
+ "address": {
+ "city": "San Francisco",
+ "country": "US",
+ "line1": "123 Main St",
+ "line2": null,
+ "postal_code": "12345",
+ "state": "CA"
+ },
+ "email": null,
+ "name": "John Doe",
+ "phone": null,
+ "tax_id": null
+ },
+ "card": {
+ "brand": "visa",
+ "checks": {
+ "address_line1_check": "pass",
+ "address_postal_code_check": "pass",
+ "cvc_check": "pass"
+ },
+ "country": "US",
+ "display_brand": "visa",
+ "exp_month": 1,
+ "exp_year": 9999,
+ "fingerprint": "NORMALIZED",
+ "funding": "credit",
+ "generated_from": null,
+ "last4": "4242",
+ "networks": {
+ "available": [
+ "visa"
+ ],
+ "preferred": null
+ },
+ "regulated_status": "unregulated",
+ "three_d_secure_usage": {
+ "supported": true
+ },
+ "wallet": null
+ },
+ "created": 1000000000,
+ "customer": "invoice_plan_bundle_additional_licenses--Customer.create.1.json",
+ "id": "invoice_plan_bundle_additional_licenses--Customer.retrieve.1.json",
+ "livemode": false,
+ "metadata": {},
+ "object": "payment_method",
+ "type": "card"
+ },
+ "footer": null,
+ "rendering_options": null
+ },
+ "livemode": false,
+ "metadata": {
+ "realm_id": "1",
+ "realm_str": "zulip"
+ },
+ "name": null,
+ "next_invoice_sequence": 1,
+ "object": "customer",
+ "phone": null,
+ "preferred_locales": [],
+ "shipping": null,
+ "tax_exempt": "none",
+ "test_clock": null
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--Customer.retrieve.5.json b/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--Customer.retrieve.5.json
new file mode 100644
index 00000000000..f52ee27b73d
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--Customer.retrieve.5.json
@@ -0,0 +1,82 @@
+{
+ "address": null,
+ "balance": 0,
+ "created": 1000000000,
+ "currency": null,
+ "default_source": null,
+ "delinquent": false,
+ "description": "zulip (Zulip Dev)",
+ "discount": null,
+ "email": "[email protected]",
+ "id": "invoice_plan_bundle_additional_licenses--Customer.create.1.json",
+ "invoice_prefix": "NORMALIZED",
+ "invoice_settings": {
+ "custom_fields": null,
+ "default_payment_method": {
+ "allow_redisplay": "unspecified",
+ "billing_details": {
+ "address": {
+ "city": "San Francisco",
+ "country": "US",
+ "line1": "123 Main St",
+ "line2": null,
+ "postal_code": "12345",
+ "state": "CA"
+ },
+ "email": null,
+ "name": "John Doe",
+ "phone": null,
+ "tax_id": null
+ },
+ "card": {
+ "brand": "visa",
+ "checks": {
+ "address_line1_check": "pass",
+ "address_postal_code_check": "pass",
+ "cvc_check": "pass"
+ },
+ "country": "US",
+ "display_brand": "visa",
+ "exp_month": 1,
+ "exp_year": 9999,
+ "fingerprint": "NORMALIZED",
+ "funding": "credit",
+ "generated_from": null,
+ "last4": "4242",
+ "networks": {
+ "available": [
+ "visa"
+ ],
+ "preferred": null
+ },
+ "regulated_status": "unregulated",
+ "three_d_secure_usage": {
+ "supported": true
+ },
+ "wallet": null
+ },
+ "created": 1000000000,
+ "customer": "invoice_plan_bundle_additional_licenses--Customer.create.1.json",
+ "id": "invoice_plan_bundle_additional_licenses--Customer.retrieve.1.json",
+ "livemode": false,
+ "metadata": {},
+ "object": "payment_method",
+ "type": "card"
+ },
+ "footer": null,
+ "rendering_options": null
+ },
+ "livemode": false,
+ "metadata": {
+ "realm_id": "1",
+ "realm_str": "zulip"
+ },
+ "name": null,
+ "next_invoice_sequence": 1,
+ "object": "customer",
+ "phone": null,
+ "preferred_locales": [],
+ "shipping": null,
+ "tax_exempt": "none",
+ "test_clock": null
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--Event.list.1.json b/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--Event.list.1.json
new file mode 100644
index 00000000000..9275a324922
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--Event.list.1.json
@@ -0,0 +1,59 @@
+{
+ "data": [
+ {
+ "api_version": "2025-10-29.clover",
+ "created": 1000000000,
+ "data": {
+ "object": {
+ "address": null,
+ "balance": 0,
+ "created": 1000000000,
+ "currency": null,
+ "default_source": null,
+ "delinquent": false,
+ "description": "zulip (Zulip Dev)",
+ "discount": null,
+ "email": "[email protected]",
+ "id": "invoice_plan_bundle_additional_licenses--Customer.create.1.json",
+ "invoice_prefix": "NORMALIZED",
+ "invoice_settings": {
+ "custom_fields": null,
+ "default_payment_method": "pm_NORMALIZED",
+ "footer": null,
+ "rendering_options": null
+ },
+ "livemode": false,
+ "metadata": {
+ "realm_id": "1",
+ "realm_str": "zulip"
+ },
+ "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": "invoice_plan_bundle_additional_licenses--Event.list.1.json",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "invoice_plan_bundle_additional_licenses--Event.list.1.json",
+ "idempotency_key": "00000000-0000-0000-0000-000000000000"
+ },
+ "type": "customer.updated"
+ }
+ ],
+ "has_more": true,
+ "object": "list",
+ "url": "/v1/events"
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--Event.list.2.json b/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--Event.list.2.json
new file mode 100644
index 00000000000..cce446fe4bd
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--Event.list.2.json
@@ -0,0 +1,1077 @@
+{
+ "data": [
+ {
+ "api_version": "2025-10-29.clover",
+ "created": 1000000000,
+ "data": {
+ "object": {
+ "amount_paid": null,
+ "amount_requested": 48000,
+ "created": 1000000000,
+ "currency": "usd",
+ "id": "invoice_plan_bundle_additional_licenses--Event.list.2.json",
+ "invoice": "invoice_plan_bundle_additional_licenses--Event.list.2.json",
+ "is_default": true,
+ "livemode": false,
+ "object": "invoice_payment",
+ "payment": {
+ "payment_intent": "invoice_plan_bundle_additional_licenses--Event.list.2.json",
+ "type": "payment_intent"
+ },
+ "status": "open",
+ "status_transitions": {
+ "canceled_at": null,
+ "paid_at": null
+ }
+ }
+ },
+ "id": "invoice_plan_bundle_additional_licenses--Event.list.2.json",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "invoice_plan_bundle_additional_licenses--Event.list.2.json",
+ "idempotency_key": "00000000-0000-0000-0000-000000000000"
+ },
+ "type": "invoice_payment.paid"
+ },
+ {
+ "api_version": "2025-10-29.clover",
+ "created": 1000000000,
+ "data": {
+ "object": {
+ "amount": 48000,
+ "amount_capturable": 0,
+ "amount_details": {
+ "tip": {}
+ },
+ "amount_received": 48000,
+ "application": null,
+ "application_fee_amount": null,
+ "automatic_payment_methods": null,
+ "canceled_at": null,
+ "cancellation_reason": null,
+ "capture_method": "automatic",
+ "client_secret": "NORMALIZED",
+ "confirmation_method": "automatic",
+ "created": 1000000000,
+ "currency": "usd",
+ "customer": "invoice_plan_bundle_additional_licenses--Customer.create.1.json",
+ "description": "Payment for Invoice",
+ "excluded_payment_method_types": null,
+ "id": "invoice_plan_bundle_additional_licenses--Event.list.2.json",
+ "last_payment_error": null,
+ "latest_charge": "invoice_plan_bundle_additional_licenses--Event.list.2.json",
+ "livemode": false,
+ "metadata": {},
+ "next_action": null,
+ "object": "payment_intent",
+ "on_behalf_of": null,
+ "payment_details": {
+ "customer_reference": null,
+ "order_reference": "in_1SPmbgDwzgQ85STgIxZOvn"
+ },
+ "payment_method": "pm_NORMALIZED",
+ "payment_method_configuration_details": null,
+ "payment_method_options": {
+ "card": {
+ "installments": null,
+ "mandate_options": null,
+ "network": null,
+ "request_three_d_secure": "automatic"
+ },
+ "link": {
+ "persistent_token": null
+ }
+ },
+ "payment_method_types": [
+ "card",
+ "link"
+ ],
+ "processing": null,
+ "receipt_email": "[email protected]",
+ "review": null,
+ "setup_future_usage": null,
+ "shipping": null,
+ "source": null,
+ "statement_descriptor": "Zulip Cloud Standard",
+ "statement_descriptor_suffix": null,
+ "status": "succeeded",
+ "transfer_data": null,
+ "transfer_group": null
+ }
+ },
+ "id": "invoice_plan_bundle_additional_licenses--Event.list.2.json",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "invoice_plan_bundle_additional_licenses--Event.list.2.json",
+ "idempotency_key": "00000000-0000-0000-0000-000000000000"
+ },
+ "type": "payment_intent.succeeded"
+ },
+ {
+ "api_version": "2025-10-29.clover",
+ "created": 1000000000,
+ "data": {
+ "object": {
+ "amount": 48000,
+ "amount_captured": 48000,
+ "amount_refunded": 0,
+ "application": null,
+ "application_fee": null,
+ "application_fee_amount": null,
+ "balance_transaction": "txn_NORMALIZED",
+ "billing_details": {
+ "address": {
+ "city": "San Francisco",
+ "country": "US",
+ "line1": "123 Main St",
+ "line2": null,
+ "postal_code": "12345",
+ "state": "CA"
+ },
+ "email": null,
+ "name": "John Doe",
+ "phone": null,
+ "tax_id": null
+ },
+ "calculated_statement_descriptor": "ZULIP CLOUD STANDARD",
+ "captured": true,
+ "created": 1000000000,
+ "currency": "usd",
+ "customer": "invoice_plan_bundle_additional_licenses--Customer.create.1.json",
+ "description": "Payment for Invoice",
+ "destination": null,
+ "dispute": null,
+ "disputed": false,
+ "failure_balance_transaction": null,
+ "failure_code": null,
+ "failure_message": null,
+ "fraud_details": {},
+ "id": "invoice_plan_bundle_additional_licenses--Event.list.2.json",
+ "livemode": false,
+ "metadata": {},
+ "object": "charge",
+ "on_behalf_of": null,
+ "order": null,
+ "outcome": {
+ "advice_code": null,
+ "network_advice_code": null,
+ "network_decline_code": null,
+ "network_status": "approved_by_network",
+ "reason": null,
+ "risk_level": "normal",
+ "risk_score": 0,
+ "seller_message": "Payment complete.",
+ "type": "authorized"
+ },
+ "paid": true,
+ "payment_intent": "invoice_plan_bundle_additional_licenses--Event.list.2.json",
+ "payment_method": "pm_NORMALIZED",
+ "payment_method_details": {
+ "card": {
+ "amount_authorized": 48000,
+ "authorization_code": "646205",
+ "brand": "visa",
+ "checks": {
+ "address_line1_check": "pass",
+ "address_postal_code_check": "pass",
+ "cvc_check": "pass"
+ },
+ "country": "US",
+ "exp_month": 1,
+ "exp_year": 9999,
+ "extended_authorization": {
+ "status": "disabled"
+ },
+ "fingerprint": "NORMALIZED",
+ "funding": "credit",
+ "incremental_authorization": {
+ "status": "unavailable"
+ },
+ "installments": null,
+ "last4": "4242",
+ "mandate": null,
+ "multicapture": {
+ "status": "unavailable"
+ },
+ "network": "visa",
+ "network_token": {
+ "used": false
+ },
+ "network_transaction_id": "749857738210088",
+ "overcapture": {
+ "maximum_amount_capturable": 48000,
+ "status": "unavailable"
+ },
+ "regulated_status": "unregulated",
+ "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/NORMALIZED?s=ap",
+ "refunded": false,
+ "review": null,
+ "shipping": null,
+ "source": null,
+ "source_transfer": null,
+ "statement_descriptor": "Zulip Cloud Standard",
+ "statement_descriptor_suffix": null,
+ "status": "succeeded",
+ "transfer_data": null,
+ "transfer_group": null
+ }
+ },
+ "id": "invoice_plan_bundle_additional_licenses--Event.list.2.json",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "invoice_plan_bundle_additional_licenses--Event.list.2.json",
+ "idempotency_key": "00000000-0000-0000-0000-000000000000"
+ },
+ "type": "charge.succeeded"
+ },
+ {
+ "api_version": "2025-10-29.clover",
+ "created": 1000000000,
+ "data": {
+ "object": {
+ "account_country": "US",
+ "account_name": "NORMALIZED",
+ "account_tax_ids": null,
+ "amount_due": 48000,
+ "amount_overpaid": 0,
+ "amount_paid": 0,
+ "amount_remaining": 48000,
+ "amount_shipping": 0,
+ "application": null,
+ "attempt_count": 0,
+ "attempted": false,
+ "auto_advance": false,
+ "automatic_tax": {
+ "disabled_reason": null,
+ "enabled": false,
+ "liability": null,
+ "provider": null,
+ "status": null
+ },
+ "automatically_finalizes_at": null,
+ "billing_reason": "manual",
+ "collection_method": "charge_automatically",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "invoice_plan_bundle_additional_licenses--Customer.create.1.json",
+ "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": "If paying by bank transfer outside of the US, use the OUR option for who should pay bank transfer fees, to make sure that your invoice is paid in full.",
+ "discounts": [],
+ "due_date": null,
+ "effective_at": 1000000000,
+ "ending_balance": 0,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED/test_NORMALIZED?s=ap",
+ "id": "invoice_plan_bundle_additional_licenses--Event.list.2.json",
+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED/test_NORMALIZED/pdf?s=ap",
+ "issuer": {
+ "type": "self"
+ },
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": 48000,
+ "currency": "usd",
+ "description": "Zulip Cloud Standard",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "invoice_plan_bundle_additional_licenses--Event.list.2.json",
+ "invoice": "invoice_plan_bundle_additional_licenses--Event.list.2.json",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "parent": {
+ "invoice_item_details": {
+ "invoice_item": "invoice_plan_bundle_additional_licenses--Event.list.2.json",
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "subscription": null
+ },
+ "subscription_item_details": null,
+ "type": "invoice_item_details"
+ },
+ "period": {
+ "end": 1357095845,
+ "start": 1325473445
+ },
+ "pretax_credit_amounts": [],
+ "pricing": {
+ "price_details": {
+ "price": "price_NORMALIZED",
+ "product": "prod_NORMALIZED"
+ },
+ "type": "price_details",
+ "unit_amount_decimal": "8000"
+ },
+ "quantity": 6,
+ "taxes": []
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 1,
+ "url": "/v1/invoices/invoice_plan_bundle_additional_licenses--Event.list.2.json/lines"
+ },
+ "livemode": false,
+ "metadata": {
+ "billing_schedule": "1",
+ "current_plan_id": "None",
+ "license_management": "automatic",
+ "licenses": "6",
+ "on_free_trial": "False",
+ "plan_tier": "1",
+ "user_id": "10"
+ },
+ "next_payment_attempt": null,
+ "number": "NORMALIZED",
+ "object": "invoice",
+ "on_behalf_of": null,
+ "parent": null,
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1000000000,
+ "period_start": 1000000000,
+ "post_payment_credit_notes_amount": 0,
+ "pre_payment_credit_notes_amount": 0,
+ "receipt_number": null,
+ "rendering": {
+ "amount_tax_display": null,
+ "pdf": {
+ "page_size": "letter"
+ },
+ "template": null,
+ "template_version": null
+ },
+ "shipping_cost": null,
+ "shipping_details": null,
+ "starting_balance": 0,
+ "statement_descriptor": "Zulip Cloud Standard",
+ "status": "open",
+ "status_transitions": {
+ "finalized_at": 1000000000,
+ "marked_uncollectible_at": null,
+ "paid_at": null,
+ "voided_at": null
+ },
+ "subtotal": 48000,
+ "subtotal_excluding_tax": 48000,
+ "test_clock": null,
+ "total": 48000,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 48000,
+ "total_pretax_credit_amounts": [],
+ "total_taxes": [],
+ "webhooks_delivered_at": 1000000000
+ }
+ },
+ "id": "invoice_plan_bundle_additional_licenses--Event.list.2.json",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "invoice_plan_bundle_additional_licenses--Event.list.2.json",
+ "idempotency_key": "00000000-0000-0000-0000-000000000000"
+ },
+ "type": "invoice.finalized"
+ },
+ {
+ "api_version": "2025-10-29.clover",
+ "created": 1000000000,
+ "data": {
+ "object": {
+ "account_country": "US",
+ "account_name": "NORMALIZED",
+ "account_tax_ids": null,
+ "amount_due": 48000,
+ "amount_overpaid": 0,
+ "amount_paid": 0,
+ "amount_remaining": 48000,
+ "amount_shipping": 0,
+ "application": null,
+ "attempt_count": 0,
+ "attempted": false,
+ "auto_advance": false,
+ "automatic_tax": {
+ "disabled_reason": null,
+ "enabled": false,
+ "liability": null,
+ "provider": null,
+ "status": null
+ },
+ "automatically_finalizes_at": null,
+ "billing_reason": "manual",
+ "collection_method": "charge_automatically",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "invoice_plan_bundle_additional_licenses--Customer.create.1.json",
+ "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": "If paying by bank transfer outside of the US, use the OUR option for who should pay bank transfer fees, to make sure that your invoice is paid in full.",
+ "discounts": [],
+ "due_date": null,
+ "effective_at": 1000000000,
+ "ending_balance": 0,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED/test_NORMALIZED?s=ap",
+ "id": "invoice_plan_bundle_additional_licenses--Event.list.2.json",
+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED/test_NORMALIZED/pdf?s=ap",
+ "issuer": {
+ "type": "self"
+ },
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": 48000,
+ "currency": "usd",
+ "description": "Zulip Cloud Standard",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "invoice_plan_bundle_additional_licenses--Event.list.2.json",
+ "invoice": "invoice_plan_bundle_additional_licenses--Event.list.2.json",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "parent": {
+ "invoice_item_details": {
+ "invoice_item": "invoice_plan_bundle_additional_licenses--Event.list.2.json",
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "subscription": null
+ },
+ "subscription_item_details": null,
+ "type": "invoice_item_details"
+ },
+ "period": {
+ "end": 1357095845,
+ "start": 1325473445
+ },
+ "pretax_credit_amounts": [],
+ "pricing": {
+ "price_details": {
+ "price": "price_NORMALIZED",
+ "product": "prod_NORMALIZED"
+ },
+ "type": "price_details",
+ "unit_amount_decimal": "8000"
+ },
+ "quantity": 6,
+ "taxes": []
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 1,
+ "url": "/v1/invoices/invoice_plan_bundle_additional_licenses--Event.list.2.json/lines"
+ },
+ "livemode": false,
+ "metadata": {
+ "billing_schedule": "1",
+ "current_plan_id": "None",
+ "license_management": "automatic",
+ "licenses": "6",
+ "on_free_trial": "False",
+ "plan_tier": "1",
+ "user_id": "10"
+ },
+ "next_payment_attempt": null,
+ "number": "NORMALIZED",
+ "object": "invoice",
+ "on_behalf_of": null,
+ "parent": null,
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1000000000,
+ "period_start": 1000000000,
+ "post_payment_credit_notes_amount": 0,
+ "pre_payment_credit_notes_amount": 0,
+ "receipt_number": null,
+ "rendering": {
+ "amount_tax_display": null,
+ "pdf": {
+ "page_size": "letter"
+ },
+ "template": null,
+ "template_version": null
+ },
+ "shipping_cost": null,
+ "shipping_details": null,
+ "starting_balance": 0,
+ "statement_descriptor": "Zulip Cloud Standard",
+ "status": "open",
+ "status_transitions": {
+ "finalized_at": 1000000000,
+ "marked_uncollectible_at": null,
+ "paid_at": null,
+ "voided_at": null
+ },
+ "subtotal": 48000,
+ "subtotal_excluding_tax": 48000,
+ "test_clock": null,
+ "total": 48000,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 48000,
+ "total_pretax_credit_amounts": [],
+ "total_taxes": [],
+ "webhooks_delivered_at": 1000000000
+ },
+ "previous_attributes": {
+ "effective_at": null,
+ "ending_balance": null,
+ "hosted_invoice_url": null,
+ "invoice_pdf": null,
+ "number": null,
+ "rendering": {
+ "pdf": {
+ "page_size": "auto"
+ }
+ },
+ "status": "draft",
+ "status_transitions": {
+ "finalized_at": null
+ }
+ }
+ },
+ "id": "invoice_plan_bundle_additional_licenses--Event.list.2.json",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "invoice_plan_bundle_additional_licenses--Event.list.2.json",
+ "idempotency_key": "00000000-0000-0000-0000-000000000000"
+ },
+ "type": "invoice.updated"
+ },
+ {
+ "api_version": "2025-10-29.clover",
+ "created": 1000000000,
+ "data": {
+ "object": {
+ "amount": 48000,
+ "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",
+ "client_secret": "NORMALIZED",
+ "confirmation_method": "automatic",
+ "created": 1000000000,
+ "currency": "usd",
+ "customer": "invoice_plan_bundle_additional_licenses--Customer.create.1.json",
+ "description": "Payment for Invoice",
+ "excluded_payment_method_types": null,
+ "id": "invoice_plan_bundle_additional_licenses--Event.list.2.json",
+ "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"
+ },
+ "link": {
+ "persistent_token": null
+ }
+ },
+ "payment_method_types": [
+ "card",
+ "link"
+ ],
+ "processing": null,
+ "receipt_email": "[email protected]",
+ "review": null,
+ "setup_future_usage": null,
+ "shipping": null,
+ "source": null,
+ "statement_descriptor": "Zulip Cloud Standard",
+ "statement_descriptor_suffix": null,
+ "status": "requires_payment_method",
+ "transfer_data": null,
+ "transfer_group": null
+ }
+ },
+ "id": "invoice_plan_bundle_additional_licenses--Event.list.2.json",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "invoice_plan_bundle_additional_licenses--Event.list.2.json",
+ "idempotency_key": "00000000-0000-0000-0000-000000000000"
+ },
+ "type": "payment_intent.created"
+ },
+ {
+ "api_version": "2025-10-29.clover",
+ "created": 1000000000,
+ "data": {
+ "object": {
+ "account_country": "US",
+ "account_name": "NORMALIZED",
+ "account_tax_ids": null,
+ "amount_due": 48000,
+ "amount_overpaid": 0,
+ "amount_paid": 0,
+ "amount_remaining": 48000,
+ "amount_shipping": 0,
+ "application": null,
+ "attempt_count": 0,
+ "attempted": false,
+ "auto_advance": false,
+ "automatic_tax": {
+ "disabled_reason": null,
+ "enabled": false,
+ "liability": null,
+ "provider": null,
+ "status": null
+ },
+ "automatically_finalizes_at": null,
+ "billing_reason": "manual",
+ "collection_method": "charge_automatically",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "invoice_plan_bundle_additional_licenses--Customer.create.1.json",
+ "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": "If paying by bank transfer outside of the US, use the OUR option for who should pay bank transfer fees, to make sure that your invoice is paid in full.",
+ "discounts": [],
+ "due_date": null,
+ "effective_at": null,
+ "ending_balance": null,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": null,
+ "id": "invoice_plan_bundle_additional_licenses--Event.list.2.json",
+ "invoice_pdf": null,
+ "issuer": {
+ "type": "self"
+ },
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": 48000,
+ "currency": "usd",
+ "description": "Zulip Cloud Standard",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "invoice_plan_bundle_additional_licenses--Event.list.2.json",
+ "invoice": "invoice_plan_bundle_additional_licenses--Event.list.2.json",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "parent": {
+ "invoice_item_details": {
+ "invoice_item": "invoice_plan_bundle_additional_licenses--Event.list.2.json",
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "subscription": null
+ },
+ "subscription_item_details": null,
+ "type": "invoice_item_details"
+ },
+ "period": {
+ "end": 1357095845,
+ "start": 1325473445
+ },
+ "pretax_credit_amounts": [],
+ "pricing": {
+ "price_details": {
+ "price": "price_NORMALIZED",
+ "product": "prod_NORMALIZED"
+ },
+ "type": "price_details",
+ "unit_amount_decimal": "8000"
+ },
+ "quantity": 6,
+ "taxes": []
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 1,
+ "url": "/v1/invoices/invoice_plan_bundle_additional_licenses--Event.list.2.json/lines"
+ },
+ "livemode": false,
+ "metadata": {
+ "billing_schedule": "1",
+ "current_plan_id": "None",
+ "license_management": "automatic",
+ "licenses": "6",
+ "on_free_trial": "False",
+ "plan_tier": "1",
+ "user_id": "10"
+ },
+ "next_payment_attempt": null,
+ "number": null,
+ "object": "invoice",
+ "on_behalf_of": null,
+ "parent": null,
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1000000000,
+ "period_start": 1000000000,
+ "post_payment_credit_notes_amount": 0,
+ "pre_payment_credit_notes_amount": 0,
+ "receipt_number": null,
+ "rendering": {
+ "amount_tax_display": null,
+ "pdf": {
+ "page_size": "auto"
+ },
+ "template": null,
+ "template_version": null
+ },
+ "shipping_cost": null,
+ "shipping_details": null,
+ "starting_balance": 0,
+ "statement_descriptor": "Zulip Cloud Standard",
+ "status": "draft",
+ "status_transitions": {
+ "finalized_at": null,
+ "marked_uncollectible_at": null,
+ "paid_at": null,
+ "voided_at": null
+ },
+ "subtotal": 48000,
+ "subtotal_excluding_tax": 48000,
+ "test_clock": null,
+ "total": 48000,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 48000,
+ "total_pretax_credit_amounts": [],
+ "total_taxes": [],
+ "webhooks_delivered_at": 1000000000
+ },
+ "previous_attributes": {
+ "amount_due": 0,
+ "amount_remaining": 0,
+ "lines": {
+ "data": [],
+ "total_count": 0
+ },
+ "subtotal": 0,
+ "subtotal_excluding_tax": 0,
+ "total": 0,
+ "total_excluding_tax": 0
+ }
+ },
+ "id": "invoice_plan_bundle_additional_licenses--Event.list.2.json",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "invoice_plan_bundle_additional_licenses--Event.list.2.json",
+ "idempotency_key": "00000000-0000-0000-0000-000000000000"
+ },
+ "type": "invoice.updated"
+ },
+ {
+ "api_version": "2025-10-29.clover",
+ "created": 1000000000,
+ "data": {
+ "object": {
+ "amount": 48000,
+ "currency": "usd",
+ "customer": "invoice_plan_bundle_additional_licenses--Customer.create.1.json",
+ "date": 1000000000,
+ "description": "Zulip Cloud Standard",
+ "discountable": false,
+ "discounts": [],
+ "id": "invoice_plan_bundle_additional_licenses--Event.list.2.json",
+ "invoice": "invoice_plan_bundle_additional_licenses--Event.list.2.json",
+ "livemode": false,
+ "metadata": {},
+ "net_amount": 48000,
+ "object": "invoiceitem",
+ "parent": null,
+ "period": {
+ "end": 1357095845,
+ "start": 1325473445
+ },
+ "pricing": {
+ "price_details": {
+ "price": "price_NORMALIZED",
+ "product": "prod_NORMALIZED"
+ },
+ "type": "price_details",
+ "unit_amount_decimal": "8000"
+ },
+ "proration": false,
+ "quantity": 6,
+ "tax_rates": [],
+ "test_clock": null
+ }
+ },
+ "id": "invoice_plan_bundle_additional_licenses--Event.list.2.json",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "invoice_plan_bundle_additional_licenses--Event.list.2.json",
+ "idempotency_key": "00000000-0000-0000-0000-000000000000"
+ },
+ "type": "invoiceitem.created"
+ },
+ {
+ "api_version": "2025-10-29.clover",
+ "created": 1000000000,
+ "data": {
+ "object": {
+ "account_country": "US",
+ "account_name": "NORMALIZED",
+ "account_tax_ids": null,
+ "amount_due": 0,
+ "amount_overpaid": 0,
+ "amount_paid": 0,
+ "amount_remaining": 0,
+ "amount_shipping": 0,
+ "application": null,
+ "attempt_count": 0,
+ "attempted": false,
+ "auto_advance": false,
+ "automatic_tax": {
+ "disabled_reason": null,
+ "enabled": false,
+ "liability": null,
+ "provider": null,
+ "status": null
+ },
+ "automatically_finalizes_at": null,
+ "billing_reason": "manual",
+ "collection_method": "charge_automatically",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "invoice_plan_bundle_additional_licenses--Customer.create.1.json",
+ "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": "If paying by bank transfer outside of the US, use the OUR option for who should pay bank transfer fees, to make sure that your invoice is paid in full.",
+ "discounts": [],
+ "due_date": null,
+ "effective_at": null,
+ "ending_balance": null,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": null,
+ "id": "invoice_plan_bundle_additional_licenses--Event.list.2.json",
+ "invoice_pdf": null,
+ "issuer": {
+ "type": "self"
+ },
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [],
+ "has_more": false,
+ "object": "list",
+ "total_count": 0,
+ "url": "/v1/invoices/invoice_plan_bundle_additional_licenses--Event.list.2.json/lines"
+ },
+ "livemode": false,
+ "metadata": {
+ "billing_schedule": "1",
+ "current_plan_id": "None",
+ "license_management": "automatic",
+ "licenses": "6",
+ "on_free_trial": "False",
+ "plan_tier": "1",
+ "user_id": "10"
+ },
+ "next_payment_attempt": null,
+ "number": null,
+ "object": "invoice",
+ "on_behalf_of": null,
+ "parent": null,
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1000000000,
+ "period_start": 1000000000,
+ "post_payment_credit_notes_amount": 0,
+ "pre_payment_credit_notes_amount": 0,
+ "receipt_number": null,
+ "rendering": {
+ "amount_tax_display": null,
+ "pdf": {
+ "page_size": "auto"
+ },
+ "template": null,
+ "template_version": null
+ },
+ "shipping_cost": null,
+ "shipping_details": null,
+ "starting_balance": 0,
+ "statement_descriptor": "Zulip Cloud Standard",
+ "status": "draft",
+ "status_transitions": {
+ "finalized_at": null,
+ "marked_uncollectible_at": null,
+ "paid_at": null,
+ "voided_at": null
+ },
+ "subtotal": 0,
+ "subtotal_excluding_tax": 0,
+ "test_clock": null,
+ "total": 0,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 0,
+ "total_pretax_credit_amounts": [],
+ "total_taxes": [],
+ "webhooks_delivered_at": 1000000000
+ }
+ },
+ "id": "invoice_plan_bundle_additional_licenses--Event.list.2.json",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "invoice_plan_bundle_additional_licenses--Event.list.2.json",
+ "idempotency_key": "00000000-0000-0000-0000-000000000000"
+ },
+ "type": "invoice.created"
+ },
+ {
+ "api_version": "2025-10-29.clover",
+ "created": 1000000000,
+ "data": {
+ "object": {
+ "address": null,
+ "balance": 0,
+ "created": 1000000000,
+ "currency": "usd",
+ "default_source": null,
+ "delinquent": false,
+ "description": "zulip (Zulip Dev)",
+ "discount": null,
+ "email": "[email protected]",
+ "id": "invoice_plan_bundle_additional_licenses--Customer.create.1.json",
+ "invoice_prefix": "NORMALIZED",
+ "invoice_settings": {
+ "custom_fields": null,
+ "default_payment_method": "pm_NORMALIZED",
+ "footer": null,
+ "rendering_options": null
+ },
+ "livemode": false,
+ "metadata": {
+ "realm_id": "1",
+ "realm_str": "zulip"
+ },
+ "name": null,
+ "next_invoice_sequence": 1,
+ "object": "customer",
+ "phone": null,
+ "preferred_locales": [],
+ "shipping": null,
+ "tax_exempt": "none",
+ "test_clock": null
+ },
+ "previous_attributes": {
+ "currency": null
+ }
+ },
+ "id": "invoice_plan_bundle_additional_licenses--Event.list.2.json",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "invoice_plan_bundle_additional_licenses--Event.list.2.json",
+ "idempotency_key": "00000000-0000-0000-0000-000000000000"
+ },
+ "type": "customer.updated"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "url": "/v1/events"
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--Event.list.3.json b/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--Event.list.3.json
new file mode 100644
index 00000000000..dd875e04bd6
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--Event.list.3.json
@@ -0,0 +1,524 @@
+{
+ "data": [
+ {
+ "api_version": "2025-10-29.clover",
+ "created": 1000000000,
+ "data": {
+ "object": {
+ "account_country": "US",
+ "account_name": "NORMALIZED",
+ "account_tax_ids": null,
+ "amount_due": 48000,
+ "amount_overpaid": 0,
+ "amount_paid": 48000,
+ "amount_remaining": 0,
+ "amount_shipping": 0,
+ "application": null,
+ "attempt_count": 1,
+ "attempted": true,
+ "auto_advance": false,
+ "automatic_tax": {
+ "disabled_reason": null,
+ "enabled": false,
+ "liability": null,
+ "provider": null,
+ "status": null
+ },
+ "automatically_finalizes_at": null,
+ "billing_reason": "manual",
+ "collection_method": "charge_automatically",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_NORMALIZED",
+ "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": "If paying by bank transfer outside of the US, use the OUR option for who should pay bank transfer fees, to make sure that your invoice is paid in full.",
+ "discounts": [],
+ "due_date": null,
+ "effective_at": 1000000000,
+ "ending_balance": 0,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED/test_NORMALIZED?s=ap",
+ "id": "invoice_plan_bundle_additional_licenses--Event.list.2.json",
+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED/test_NORMALIZED/pdf?s=ap",
+ "issuer": {
+ "type": "self"
+ },
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": 48000,
+ "currency": "usd",
+ "description": "Zulip Cloud Standard",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "invoice_plan_bundle_additional_licenses--Event.list.2.json",
+ "invoice": "invoice_plan_bundle_additional_licenses--Event.list.2.json",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "parent": {
+ "invoice_item_details": {
+ "invoice_item": "ii_NORMALIZED",
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "subscription": null
+ },
+ "subscription_item_details": null,
+ "type": "invoice_item_details"
+ },
+ "period": {
+ "end": 1357095845,
+ "start": 1325473445
+ },
+ "pretax_credit_amounts": [],
+ "pricing": {
+ "price_details": {
+ "price": "price_NORMALIZED",
+ "product": "prod_NORMALIZED"
+ },
+ "type": "price_details",
+ "unit_amount_decimal": "8000"
+ },
+ "quantity": 6,
+ "taxes": []
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 1,
+ "url": "/v1/invoices/invoice_plan_bundle_additional_licenses--Event.list.2.json/lines"
+ },
+ "livemode": false,
+ "metadata": {
+ "billing_schedule": "1",
+ "current_plan_id": "None",
+ "license_management": "automatic",
+ "licenses": "6",
+ "on_free_trial": "False",
+ "plan_tier": "1",
+ "user_id": "10"
+ },
+ "next_payment_attempt": null,
+ "number": "NORMALIZED",
+ "object": "invoice",
+ "on_behalf_of": null,
+ "parent": null,
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1000000000,
+ "period_start": 1000000000,
+ "post_payment_credit_notes_amount": 0,
+ "pre_payment_credit_notes_amount": 0,
+ "receipt_number": null,
+ "rendering": {
+ "amount_tax_display": null,
+ "pdf": {
+ "page_size": "letter"
+ },
+ "template": null,
+ "template_version": null
+ },
+ "shipping_cost": null,
+ "shipping_details": null,
+ "starting_balance": 0,
+ "statement_descriptor": "Zulip Cloud Standard",
+ "status": "paid",
+ "status_transitions": {
+ "finalized_at": 1000000000,
+ "marked_uncollectible_at": null,
+ "paid_at": 1000000000,
+ "voided_at": null
+ },
+ "subtotal": 48000,
+ "subtotal_excluding_tax": 48000,
+ "test_clock": null,
+ "total": 48000,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 48000,
+ "total_pretax_credit_amounts": [],
+ "total_taxes": [],
+ "webhooks_delivered_at": 1000000000
+ }
+ },
+ "id": "invoice_plan_bundle_additional_licenses--Event.list.3.json",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "invoice_plan_bundle_additional_licenses--Event.list.2.json",
+ "idempotency_key": "00000000-0000-0000-0000-000000000000"
+ },
+ "type": "invoice.payment_succeeded"
+ },
+ {
+ "api_version": "2025-10-29.clover",
+ "created": 1000000000,
+ "data": {
+ "object": {
+ "account_country": "US",
+ "account_name": "NORMALIZED",
+ "account_tax_ids": null,
+ "amount_due": 48000,
+ "amount_overpaid": 0,
+ "amount_paid": 48000,
+ "amount_remaining": 0,
+ "amount_shipping": 0,
+ "application": null,
+ "attempt_count": 1,
+ "attempted": true,
+ "auto_advance": false,
+ "automatic_tax": {
+ "disabled_reason": null,
+ "enabled": false,
+ "liability": null,
+ "provider": null,
+ "status": null
+ },
+ "automatically_finalizes_at": null,
+ "billing_reason": "manual",
+ "collection_method": "charge_automatically",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_NORMALIZED",
+ "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": "If paying by bank transfer outside of the US, use the OUR option for who should pay bank transfer fees, to make sure that your invoice is paid in full.",
+ "discounts": [],
+ "due_date": null,
+ "effective_at": 1000000000,
+ "ending_balance": 0,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED/test_NORMALIZED?s=ap",
+ "id": "invoice_plan_bundle_additional_licenses--Event.list.2.json",
+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED/test_NORMALIZED/pdf?s=ap",
+ "issuer": {
+ "type": "self"
+ },
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": 48000,
+ "currency": "usd",
+ "description": "Zulip Cloud Standard",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "invoice_plan_bundle_additional_licenses--Event.list.2.json",
+ "invoice": "invoice_plan_bundle_additional_licenses--Event.list.2.json",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "parent": {
+ "invoice_item_details": {
+ "invoice_item": "ii_NORMALIZED",
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "subscription": null
+ },
+ "subscription_item_details": null,
+ "type": "invoice_item_details"
+ },
+ "period": {
+ "end": 1357095845,
+ "start": 1325473445
+ },
+ "pretax_credit_amounts": [],
+ "pricing": {
+ "price_details": {
+ "price": "price_NORMALIZED",
+ "product": "prod_NORMALIZED"
+ },
+ "type": "price_details",
+ "unit_amount_decimal": "8000"
+ },
+ "quantity": 6,
+ "taxes": []
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 1,
+ "url": "/v1/invoices/invoice_plan_bundle_additional_licenses--Event.list.2.json/lines"
+ },
+ "livemode": false,
+ "metadata": {
+ "billing_schedule": "1",
+ "current_plan_id": "None",
+ "license_management": "automatic",
+ "licenses": "6",
+ "on_free_trial": "False",
+ "plan_tier": "1",
+ "user_id": "10"
+ },
+ "next_payment_attempt": null,
+ "number": "NORMALIZED",
+ "object": "invoice",
+ "on_behalf_of": null,
+ "parent": null,
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1000000000,
+ "period_start": 1000000000,
+ "post_payment_credit_notes_amount": 0,
+ "pre_payment_credit_notes_amount": 0,
+ "receipt_number": null,
+ "rendering": {
+ "amount_tax_display": null,
+ "pdf": {
+ "page_size": "letter"
+ },
+ "template": null,
+ "template_version": null
+ },
+ "shipping_cost": null,
+ "shipping_details": null,
+ "starting_balance": 0,
+ "statement_descriptor": "Zulip Cloud Standard",
+ "status": "paid",
+ "status_transitions": {
+ "finalized_at": 1000000000,
+ "marked_uncollectible_at": null,
+ "paid_at": 1000000000,
+ "voided_at": null
+ },
+ "subtotal": 48000,
+ "subtotal_excluding_tax": 48000,
+ "test_clock": null,
+ "total": 48000,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 48000,
+ "total_pretax_credit_amounts": [],
+ "total_taxes": [],
+ "webhooks_delivered_at": 1000000000
+ }
+ },
+ "id": "invoice_plan_bundle_additional_licenses--Event.list.3.json",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "invoice_plan_bundle_additional_licenses--Event.list.2.json",
+ "idempotency_key": "00000000-0000-0000-0000-000000000000"
+ },
+ "type": "invoice.paid"
+ },
+ {
+ "api_version": "2025-10-29.clover",
+ "created": 1000000000,
+ "data": {
+ "object": {
+ "account_country": "US",
+ "account_name": "NORMALIZED",
+ "account_tax_ids": null,
+ "amount_due": 48000,
+ "amount_overpaid": 0,
+ "amount_paid": 48000,
+ "amount_remaining": 0,
+ "amount_shipping": 0,
+ "application": null,
+ "attempt_count": 1,
+ "attempted": true,
+ "auto_advance": false,
+ "automatic_tax": {
+ "disabled_reason": null,
+ "enabled": false,
+ "liability": null,
+ "provider": null,
+ "status": null
+ },
+ "automatically_finalizes_at": null,
+ "billing_reason": "manual",
+ "collection_method": "charge_automatically",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_NORMALIZED",
+ "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": "If paying by bank transfer outside of the US, use the OUR option for who should pay bank transfer fees, to make sure that your invoice is paid in full.",
+ "discounts": [],
+ "due_date": null,
+ "effective_at": 1000000000,
+ "ending_balance": 0,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED/test_NORMALIZED?s=ap",
+ "id": "invoice_plan_bundle_additional_licenses--Event.list.2.json",
+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED/test_NORMALIZED/pdf?s=ap",
+ "issuer": {
+ "type": "self"
+ },
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": 48000,
+ "currency": "usd",
+ "description": "Zulip Cloud Standard",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "invoice_plan_bundle_additional_licenses--Event.list.2.json",
+ "invoice": "invoice_plan_bundle_additional_licenses--Event.list.2.json",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "parent": {
+ "invoice_item_details": {
+ "invoice_item": "ii_NORMALIZED",
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "subscription": null
+ },
+ "subscription_item_details": null,
+ "type": "invoice_item_details"
+ },
+ "period": {
+ "end": 1357095845,
+ "start": 1325473445
+ },
+ "pretax_credit_amounts": [],
+ "pricing": {
+ "price_details": {
+ "price": "price_NORMALIZED",
+ "product": "prod_NORMALIZED"
+ },
+ "type": "price_details",
+ "unit_amount_decimal": "8000"
+ },
+ "quantity": 6,
+ "taxes": []
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 1,
+ "url": "/v1/invoices/invoice_plan_bundle_additional_licenses--Event.list.2.json/lines"
+ },
+ "livemode": false,
+ "metadata": {
+ "billing_schedule": "1",
+ "current_plan_id": "None",
+ "license_management": "automatic",
+ "licenses": "6",
+ "on_free_trial": "False",
+ "plan_tier": "1",
+ "user_id": "10"
+ },
+ "next_payment_attempt": null,
+ "number": "NORMALIZED",
+ "object": "invoice",
+ "on_behalf_of": null,
+ "parent": null,
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1000000000,
+ "period_start": 1000000000,
+ "post_payment_credit_notes_amount": 0,
+ "pre_payment_credit_notes_amount": 0,
+ "receipt_number": null,
+ "rendering": {
+ "amount_tax_display": null,
+ "pdf": {
+ "page_size": "letter"
+ },
+ "template": null,
+ "template_version": null
+ },
+ "shipping_cost": null,
+ "shipping_details": null,
+ "starting_balance": 0,
+ "statement_descriptor": "Zulip Cloud Standard",
+ "status": "paid",
+ "status_transitions": {
+ "finalized_at": 1000000000,
+ "marked_uncollectible_at": null,
+ "paid_at": 1000000000,
+ "voided_at": null
+ },
+ "subtotal": 48000,
+ "subtotal_excluding_tax": 48000,
+ "test_clock": null,
+ "total": 48000,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 48000,
+ "total_pretax_credit_amounts": [],
+ "total_taxes": [],
+ "webhooks_delivered_at": 1000000000
+ },
+ "previous_attributes": {
+ "amount_paid": 0,
+ "amount_remaining": 48000,
+ "attempt_count": 0,
+ "attempted": false,
+ "status": "open",
+ "status_transitions": {
+ "paid_at": null
+ }
+ }
+ },
+ "id": "invoice_plan_bundle_additional_licenses--Event.list.3.json",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "invoice_plan_bundle_additional_licenses--Event.list.2.json",
+ "idempotency_key": "00000000-0000-0000-0000-000000000000"
+ },
+ "type": "invoice.updated"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "url": "/v1/events"
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--Event.list.4.json b/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--Event.list.4.json
new file mode 100644
index 00000000000..6d922067afe
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--Event.list.4.json
@@ -0,0 +1,6 @@
+{
+ "data": [],
+ "has_more": false,
+ "object": "list",
+ "url": "/v1/events"
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--Invoice.create.1.json b/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--Invoice.create.1.json
new file mode 100644
index 00000000000..c9343006362
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--Invoice.create.1.json
@@ -0,0 +1,113 @@
+{
+ "account_country": "US",
+ "account_name": "NORMALIZED",
+ "account_tax_ids": null,
+ "amount_due": 0,
+ "amount_overpaid": 0,
+ "amount_paid": 0,
+ "amount_remaining": 0,
+ "amount_shipping": 0,
+ "application": null,
+ "attempt_count": 0,
+ "attempted": false,
+ "auto_advance": false,
+ "automatic_tax": {
+ "disabled_reason": null,
+ "enabled": false,
+ "liability": null,
+ "provider": null,
+ "status": null
+ },
+ "automatically_finalizes_at": null,
+ "billing_reason": "manual",
+ "collection_method": "charge_automatically",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_NORMALIZED",
+ "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": "If paying by bank transfer outside of the US, use the OUR option for who should pay bank transfer fees, to make sure that your invoice is paid in full.",
+ "discounts": [],
+ "due_date": null,
+ "effective_at": null,
+ "ending_balance": null,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": null,
+ "id": "invoice_plan_bundle_additional_licenses--Event.list.2.json",
+ "invoice_pdf": null,
+ "issuer": {
+ "type": "self"
+ },
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [],
+ "has_more": false,
+ "object": "list",
+ "total_count": 0,
+ "url": "/v1/invoices/invoice_plan_bundle_additional_licenses--Event.list.2.json/lines"
+ },
+ "livemode": false,
+ "metadata": {
+ "billing_schedule": "1",
+ "current_plan_id": "None",
+ "license_management": "automatic",
+ "licenses": "6",
+ "on_free_trial": "False",
+ "plan_tier": "1",
+ "user_id": "10"
+ },
+ "next_payment_attempt": null,
+ "number": null,
+ "object": "invoice",
+ "on_behalf_of": null,
+ "parent": null,
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1000000000,
+ "period_start": 1000000000,
+ "post_payment_credit_notes_amount": 0,
+ "pre_payment_credit_notes_amount": 0,
+ "receipt_number": null,
+ "rendering": {
+ "amount_tax_display": null,
+ "pdf": {
+ "page_size": "auto"
+ },
+ "template": null,
+ "template_version": null
+ },
+ "shipping_cost": null,
+ "shipping_details": null,
+ "starting_balance": 0,
+ "statement_descriptor": "Zulip Cloud Standard",
+ "status": "draft",
+ "status_transitions": {
+ "finalized_at": null,
+ "marked_uncollectible_at": null,
+ "paid_at": null,
+ "voided_at": null
+ },
+ "subtotal": 0,
+ "subtotal_excluding_tax": 0,
+ "test_clock": null,
+ "total": 0,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 0,
+ "total_pretax_credit_amounts": [],
+ "total_taxes": [],
+ "webhooks_delivered_at": 1000000000
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--Invoice.create.2.json b/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--Invoice.create.2.json
new file mode 100644
index 00000000000..8ec93a1318c
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--Invoice.create.2.json
@@ -0,0 +1,105 @@
+{
+ "account_country": "US",
+ "account_name": "NORMALIZED",
+ "account_tax_ids": null,
+ "amount_due": 0,
+ "amount_overpaid": 0,
+ "amount_paid": 0,
+ "amount_remaining": 0,
+ "amount_shipping": 0,
+ "application": null,
+ "attempt_count": 0,
+ "attempted": false,
+ "auto_advance": true,
+ "automatic_tax": {
+ "disabled_reason": null,
+ "enabled": false,
+ "liability": null,
+ "provider": null,
+ "status": null
+ },
+ "automatically_finalizes_at": 1000000000,
+ "billing_reason": "manual",
+ "collection_method": "charge_automatically",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_NORMALIZED",
+ "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": "If paying by bank transfer outside of the US, use the OUR option for who should pay bank transfer fees, to make sure that your invoice is paid in full.",
+ "discounts": [],
+ "due_date": null,
+ "effective_at": null,
+ "ending_balance": null,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": null,
+ "id": "invoice_plan_bundle_additional_licenses--Invoice.create.2.json",
+ "invoice_pdf": null,
+ "issuer": {
+ "type": "self"
+ },
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [],
+ "has_more": false,
+ "object": "list",
+ "total_count": 0,
+ "url": "/v1/invoices/invoice_plan_bundle_additional_licenses--Invoice.create.2.json/lines"
+ },
+ "livemode": false,
+ "metadata": {},
+ "next_payment_attempt": 1000000000,
+ "number": null,
+ "object": "invoice",
+ "on_behalf_of": null,
+ "parent": null,
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1000000000,
+ "period_start": 1000000000,
+ "post_payment_credit_notes_amount": 0,
+ "pre_payment_credit_notes_amount": 0,
+ "receipt_number": null,
+ "rendering": {
+ "amount_tax_display": null,
+ "pdf": {
+ "page_size": "auto"
+ },
+ "template": null,
+ "template_version": null
+ },
+ "shipping_cost": null,
+ "shipping_details": null,
+ "starting_balance": 0,
+ "statement_descriptor": "Zulip Cloud Standard",
+ "status": "draft",
+ "status_transitions": {
+ "finalized_at": null,
+ "marked_uncollectible_at": null,
+ "paid_at": null,
+ "voided_at": null
+ },
+ "subtotal": 0,
+ "subtotal_excluding_tax": 0,
+ "test_clock": null,
+ "total": 0,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 0,
+ "total_pretax_credit_amounts": [],
+ "total_taxes": [],
+ "webhooks_delivered_at": 1000000000
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--Invoice.finalize_invoice.1.json b/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--Invoice.finalize_invoice.1.json
new file mode 100644
index 00000000000..50dd0262a5c
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--Invoice.finalize_invoice.1.json
@@ -0,0 +1,154 @@
+{
+ "account_country": "US",
+ "account_name": "NORMALIZED",
+ "account_tax_ids": null,
+ "amount_due": 48000,
+ "amount_overpaid": 0,
+ "amount_paid": 0,
+ "amount_remaining": 48000,
+ "amount_shipping": 0,
+ "application": null,
+ "attempt_count": 0,
+ "attempted": false,
+ "auto_advance": false,
+ "automatic_tax": {
+ "disabled_reason": null,
+ "enabled": false,
+ "liability": null,
+ "provider": null,
+ "status": null
+ },
+ "automatically_finalizes_at": null,
+ "billing_reason": "manual",
+ "collection_method": "charge_automatically",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_NORMALIZED",
+ "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": "If paying by bank transfer outside of the US, use the OUR option for who should pay bank transfer fees, to make sure that your invoice is paid in full.",
+ "discounts": [],
+ "due_date": null,
+ "effective_at": 1000000000,
+ "ending_balance": 0,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED/test_NORMALIZED?s=ap",
+ "id": "invoice_plan_bundle_additional_licenses--Event.list.2.json",
+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED/test_NORMALIZED/pdf?s=ap",
+ "issuer": {
+ "type": "self"
+ },
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": 48000,
+ "currency": "usd",
+ "description": "Zulip Cloud Standard",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "invoice_plan_bundle_additional_licenses--Event.list.2.json",
+ "invoice": "invoice_plan_bundle_additional_licenses--Event.list.2.json",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "parent": {
+ "invoice_item_details": {
+ "invoice_item": "ii_NORMALIZED",
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "subscription": null
+ },
+ "subscription_item_details": null,
+ "type": "invoice_item_details"
+ },
+ "period": {
+ "end": 1357095845,
+ "start": 1325473445
+ },
+ "pretax_credit_amounts": [],
+ "pricing": {
+ "price_details": {
+ "price": "price_NORMALIZED",
+ "product": "prod_NORMALIZED"
+ },
+ "type": "price_details",
+ "unit_amount_decimal": "8000"
+ },
+ "quantity": 6,
+ "taxes": []
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 1,
+ "url": "/v1/invoices/invoice_plan_bundle_additional_licenses--Event.list.2.json/lines"
+ },
+ "livemode": false,
+ "metadata": {
+ "billing_schedule": "1",
+ "current_plan_id": "None",
+ "license_management": "automatic",
+ "licenses": "6",
+ "on_free_trial": "False",
+ "plan_tier": "1",
+ "user_id": "10"
+ },
+ "next_payment_attempt": null,
+ "number": "NORMALIZED",
+ "object": "invoice",
+ "on_behalf_of": null,
+ "parent": null,
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1000000000,
+ "period_start": 1000000000,
+ "post_payment_credit_notes_amount": 0,
+ "pre_payment_credit_notes_amount": 0,
+ "receipt_number": null,
+ "rendering": {
+ "amount_tax_display": null,
+ "pdf": {
+ "page_size": "letter"
+ },
+ "template": null,
+ "template_version": null
+ },
+ "shipping_cost": null,
+ "shipping_details": null,
+ "starting_balance": 0,
+ "statement_descriptor": "Zulip Cloud Standard",
+ "status": "open",
+ "status_transitions": {
+ "finalized_at": 1000000000,
+ "marked_uncollectible_at": null,
+ "paid_at": null,
+ "voided_at": null
+ },
+ "subtotal": 48000,
+ "subtotal_excluding_tax": 48000,
+ "test_clock": null,
+ "total": 48000,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 48000,
+ "total_pretax_credit_amounts": [],
+ "total_taxes": [],
+ "webhooks_delivered_at": 1000000000
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--Invoice.finalize_invoice.2.json b/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--Invoice.finalize_invoice.2.json
new file mode 100644
index 00000000000..679e845060f
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--Invoice.finalize_invoice.2.json
@@ -0,0 +1,266 @@
+{
+ "account_country": "US",
+ "account_name": "NORMALIZED",
+ "account_tax_ids": null,
+ "amount_due": 2285250,
+ "amount_overpaid": 0,
+ "amount_paid": 0,
+ "amount_remaining": 2285250,
+ "amount_shipping": 0,
+ "application": null,
+ "attempt_count": 0,
+ "attempted": false,
+ "auto_advance": true,
+ "automatic_tax": {
+ "disabled_reason": null,
+ "enabled": false,
+ "liability": null,
+ "provider": null,
+ "status": null
+ },
+ "automatically_finalizes_at": null,
+ "billing_reason": "manual",
+ "collection_method": "charge_automatically",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_NORMALIZED",
+ "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": "If paying by bank transfer outside of the US, use the OUR option for who should pay bank transfer fees, to make sure that your invoice is paid in full.",
+ "discounts": [],
+ "due_date": null,
+ "effective_at": 1000000000,
+ "ending_balance": 0,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED/test_NORMALIZED?s=ap",
+ "id": "invoice_plan_bundle_additional_licenses--Invoice.create.2.json",
+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED/test_NORMALIZED/pdf?s=ap",
+ "issuer": {
+ "type": "self"
+ },
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": 372700,
+ "currency": "usd",
+ "description": "Additional license (Jan 27, 2012 - Jan 2, 2013)",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "invoice_plan_bundle_additional_licenses--Invoice.finalize_invoice.2.json",
+ "invoice": "invoice_plan_bundle_additional_licenses--Invoice.create.2.json",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "parent": {
+ "invoice_item_details": {
+ "invoice_item": "ii_NORMALIZED",
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "subscription": null
+ },
+ "subscription_item_details": null,
+ "type": "invoice_item_details"
+ },
+ "period": {
+ "end": 1357095845,
+ "start": 1327633465
+ },
+ "pretax_credit_amounts": [],
+ "pricing": {
+ "price_details": {
+ "price": "price_NORMALIZED",
+ "product": "prod_NORMALIZED"
+ },
+ "type": "price_details",
+ "unit_amount_decimal": "7454"
+ },
+ "quantity": 50,
+ "taxes": []
+ },
+ {
+ "amount": 756300,
+ "currency": "usd",
+ "description": "Additional license (Jan 22, 2012 - Jan 2, 2013)",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "invoice_plan_bundle_additional_licenses--Invoice.finalize_invoice.2.json",
+ "invoice": "invoice_plan_bundle_additional_licenses--Invoice.create.2.json",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "parent": {
+ "invoice_item_details": {
+ "invoice_item": "ii_NORMALIZED",
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "subscription": null
+ },
+ "subscription_item_details": null,
+ "type": "invoice_item_details"
+ },
+ "period": {
+ "end": 1357095845,
+ "start": 1327201445
+ },
+ "pretax_credit_amounts": [],
+ "pricing": {
+ "price_details": {
+ "price": "price_NORMALIZED",
+ "product": "prod_NORMALIZED"
+ },
+ "type": "price_details",
+ "unit_amount_decimal": "7563"
+ },
+ "quantity": 100,
+ "taxes": []
+ },
+ {
+ "amount": 767200,
+ "currency": "usd",
+ "description": "Additional license (Jan 17, 2012 - Jan 2, 2013)",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "invoice_plan_bundle_additional_licenses--Invoice.finalize_invoice.2.json",
+ "invoice": "invoice_plan_bundle_additional_licenses--Invoice.create.2.json",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "parent": {
+ "invoice_item_details": {
+ "invoice_item": "ii_NORMALIZED",
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "subscription": null
+ },
+ "subscription_item_details": null,
+ "type": "invoice_item_details"
+ },
+ "period": {
+ "end": 1357095845,
+ "start": 1326769445
+ },
+ "pretax_credit_amounts": [],
+ "pricing": {
+ "price_details": {
+ "price": "price_NORMALIZED",
+ "product": "prod_NORMALIZED"
+ },
+ "type": "price_details",
+ "unit_amount_decimal": "7672"
+ },
+ "quantity": 100,
+ "taxes": []
+ },
+ {
+ "amount": 389050,
+ "currency": "usd",
+ "description": "Additional license (Jan 12, 2012 - Jan 2, 2013)",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "invoice_plan_bundle_additional_licenses--Invoice.finalize_invoice.2.json",
+ "invoice": "invoice_plan_bundle_additional_licenses--Invoice.create.2.json",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "parent": {
+ "invoice_item_details": {
+ "invoice_item": "ii_NORMALIZED",
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "subscription": null
+ },
+ "subscription_item_details": null,
+ "type": "invoice_item_details"
+ },
+ "period": {
+ "end": 1357095845,
+ "start": 1326337445
+ },
+ "pretax_credit_amounts": [],
+ "pricing": {
+ "price_details": {
+ "price": "price_NORMALIZED",
+ "product": "prod_NORMALIZED"
+ },
+ "type": "price_details",
+ "unit_amount_decimal": "7781"
+ },
+ "quantity": 50,
+ "taxes": []
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 4,
+ "url": "/v1/invoices/invoice_plan_bundle_additional_licenses--Invoice.create.2.json/lines"
+ },
+ "livemode": false,
+ "metadata": {},
+ "next_payment_attempt": 1000000000,
+ "number": "NORMALIZED",
+ "object": "invoice",
+ "on_behalf_of": null,
+ "parent": null,
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1000000000,
+ "period_start": 1000000000,
+ "post_payment_credit_notes_amount": 0,
+ "pre_payment_credit_notes_amount": 0,
+ "receipt_number": null,
+ "rendering": {
+ "amount_tax_display": null,
+ "pdf": {
+ "page_size": "letter"
+ },
+ "template": null,
+ "template_version": null
+ },
+ "shipping_cost": null,
+ "shipping_details": null,
+ "starting_balance": 0,
+ "statement_descriptor": "Zulip Cloud Standard",
+ "status": "open",
+ "status_transitions": {
+ "finalized_at": 1000000000,
+ "marked_uncollectible_at": null,
+ "paid_at": null,
+ "voided_at": null
+ },
+ "subtotal": 2285250,
+ "subtotal_excluding_tax": 2285250,
+ "test_clock": null,
+ "total": 2285250,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 2285250,
+ "total_pretax_credit_amounts": [],
+ "total_taxes": [],
+ "webhooks_delivered_at": 1000000000
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--Invoice.list.1.json b/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--Invoice.list.1.json
new file mode 100644
index 00000000000..e39960ab725
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--Invoice.list.1.json
@@ -0,0 +1,6 @@
+{
+ "data": [],
+ "has_more": false,
+ "object": "list",
+ "url": "/v1/invoices"
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--Invoice.list.2.json b/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--Invoice.list.2.json
new file mode 100644
index 00000000000..666a6f7fe7f
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--Invoice.list.2.json
@@ -0,0 +1,427 @@
+{
+ "data": [
+ {
+ "account_country": "US",
+ "account_name": "NORMALIZED",
+ "account_tax_ids": null,
+ "amount_due": 2285250,
+ "amount_overpaid": 0,
+ "amount_paid": 0,
+ "amount_remaining": 2285250,
+ "amount_shipping": 0,
+ "application": null,
+ "attempt_count": 0,
+ "attempted": false,
+ "auto_advance": true,
+ "automatic_tax": {
+ "disabled_reason": null,
+ "enabled": false,
+ "liability": null,
+ "provider": null,
+ "status": null
+ },
+ "automatically_finalizes_at": null,
+ "billing_reason": "manual",
+ "collection_method": "charge_automatically",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_NORMALIZED",
+ "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": "If paying by bank transfer outside of the US, use the OUR option for who should pay bank transfer fees, to make sure that your invoice is paid in full.",
+ "discounts": [],
+ "due_date": null,
+ "effective_at": 1000000000,
+ "ending_balance": 0,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED/test_NORMALIZED?s=ap",
+ "id": "invoice_plan_bundle_additional_licenses--Invoice.create.2.json",
+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED/test_NORMALIZED/pdf?s=ap",
+ "issuer": {
+ "type": "self"
+ },
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": 372700,
+ "currency": "usd",
+ "description": "Additional license (Jan 27, 2012 - Jan 2, 2013)",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "invoice_plan_bundle_additional_licenses--Invoice.finalize_invoice.2.json",
+ "invoice": "invoice_plan_bundle_additional_licenses--Invoice.create.2.json",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "parent": {
+ "invoice_item_details": {
+ "invoice_item": "ii_NORMALIZED",
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "subscription": null
+ },
+ "subscription_item_details": null,
+ "type": "invoice_item_details"
+ },
+ "period": {
+ "end": 1357095845,
+ "start": 1327633465
+ },
+ "pretax_credit_amounts": [],
+ "pricing": {
+ "price_details": {
+ "price": "price_NORMALIZED",
+ "product": "prod_NORMALIZED"
+ },
+ "type": "price_details",
+ "unit_amount_decimal": "7454"
+ },
+ "quantity": 50,
+ "taxes": []
+ },
+ {
+ "amount": 756300,
+ "currency": "usd",
+ "description": "Additional license (Jan 22, 2012 - Jan 2, 2013)",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "invoice_plan_bundle_additional_licenses--Invoice.finalize_invoice.2.json",
+ "invoice": "invoice_plan_bundle_additional_licenses--Invoice.create.2.json",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "parent": {
+ "invoice_item_details": {
+ "invoice_item": "ii_NORMALIZED",
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "subscription": null
+ },
+ "subscription_item_details": null,
+ "type": "invoice_item_details"
+ },
+ "period": {
+ "end": 1357095845,
+ "start": 1327201445
+ },
+ "pretax_credit_amounts": [],
+ "pricing": {
+ "price_details": {
+ "price": "price_NORMALIZED",
+ "product": "prod_NORMALIZED"
+ },
+ "type": "price_details",
+ "unit_amount_decimal": "7563"
+ },
+ "quantity": 100,
+ "taxes": []
+ },
+ {
+ "amount": 767200,
+ "currency": "usd",
+ "description": "Additional license (Jan 17, 2012 - Jan 2, 2013)",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "invoice_plan_bundle_additional_licenses--Invoice.finalize_invoice.2.json",
+ "invoice": "invoice_plan_bundle_additional_licenses--Invoice.create.2.json",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "parent": {
+ "invoice_item_details": {
+ "invoice_item": "ii_NORMALIZED",
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "subscription": null
+ },
+ "subscription_item_details": null,
+ "type": "invoice_item_details"
+ },
+ "period": {
+ "end": 1357095845,
+ "start": 1326769445
+ },
+ "pretax_credit_amounts": [],
+ "pricing": {
+ "price_details": {
+ "price": "price_NORMALIZED",
+ "product": "prod_NORMALIZED"
+ },
+ "type": "price_details",
+ "unit_amount_decimal": "7672"
+ },
+ "quantity": 100,
+ "taxes": []
+ },
+ {
+ "amount": 389050,
+ "currency": "usd",
+ "description": "Additional license (Jan 12, 2012 - Jan 2, 2013)",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "invoice_plan_bundle_additional_licenses--Invoice.finalize_invoice.2.json",
+ "invoice": "invoice_plan_bundle_additional_licenses--Invoice.create.2.json",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "parent": {
+ "invoice_item_details": {
+ "invoice_item": "ii_NORMALIZED",
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "subscription": null
+ },
+ "subscription_item_details": null,
+ "type": "invoice_item_details"
+ },
+ "period": {
+ "end": 1357095845,
+ "start": 1326337445
+ },
+ "pretax_credit_amounts": [],
+ "pricing": {
+ "price_details": {
+ "price": "price_NORMALIZED",
+ "product": "prod_NORMALIZED"
+ },
+ "type": "price_details",
+ "unit_amount_decimal": "7781"
+ },
+ "quantity": 50,
+ "taxes": []
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 4,
+ "url": "/v1/invoices/invoice_plan_bundle_additional_licenses--Invoice.create.2.json/lines"
+ },
+ "livemode": false,
+ "metadata": {},
+ "next_payment_attempt": 1000000000,
+ "number": "NORMALIZED",
+ "object": "invoice",
+ "on_behalf_of": null,
+ "parent": null,
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1000000000,
+ "period_start": 1000000000,
+ "post_payment_credit_notes_amount": 0,
+ "pre_payment_credit_notes_amount": 0,
+ "receipt_number": null,
+ "rendering": {
+ "amount_tax_display": null,
+ "pdf": {
+ "page_size": "letter"
+ },
+ "template": null,
+ "template_version": null
+ },
+ "shipping_cost": null,
+ "shipping_details": null,
+ "starting_balance": 0,
+ "statement_descriptor": "Zulip Cloud Standard",
+ "status": "open",
+ "status_transitions": {
+ "finalized_at": 1000000000,
+ "marked_uncollectible_at": null,
+ "paid_at": null,
+ "voided_at": null
+ },
+ "subtotal": 2285250,
+ "subtotal_excluding_tax": 2285250,
+ "test_clock": null,
+ "total": 2285250,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 2285250,
+ "total_pretax_credit_amounts": [],
+ "total_taxes": [],
+ "webhooks_delivered_at": 1000000000
+ },
+ {
+ "account_country": "US",
+ "account_name": "NORMALIZED",
+ "account_tax_ids": null,
+ "amount_due": 48000,
+ "amount_overpaid": 0,
+ "amount_paid": 48000,
+ "amount_remaining": 0,
+ "amount_shipping": 0,
+ "application": null,
+ "attempt_count": 1,
+ "attempted": true,
+ "auto_advance": false,
+ "automatic_tax": {
+ "disabled_reason": null,
+ "enabled": false,
+ "liability": null,
+ "provider": null,
+ "status": null
+ },
+ "automatically_finalizes_at": null,
+ "billing_reason": "manual",
+ "collection_method": "charge_automatically",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_NORMALIZED",
+ "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": "If paying by bank transfer outside of the US, use the OUR option for who should pay bank transfer fees, to make sure that your invoice is paid in full.",
+ "discounts": [],
+ "due_date": null,
+ "effective_at": 1000000000,
+ "ending_balance": 0,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED/test_NORMALIZED?s=ap",
+ "id": "invoice_plan_bundle_additional_licenses--Event.list.2.json",
+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED/test_NORMALIZED/pdf?s=ap",
+ "issuer": {
+ "type": "self"
+ },
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": 48000,
+ "currency": "usd",
+ "description": "Zulip Cloud Standard",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "invoice_plan_bundle_additional_licenses--Event.list.2.json",
+ "invoice": "invoice_plan_bundle_additional_licenses--Event.list.2.json",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "parent": {
+ "invoice_item_details": {
+ "invoice_item": "ii_NORMALIZED",
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "subscription": null
+ },
+ "subscription_item_details": null,
+ "type": "invoice_item_details"
+ },
+ "period": {
+ "end": 1357095845,
+ "start": 1325473445
+ },
+ "pretax_credit_amounts": [],
+ "pricing": {
+ "price_details": {
+ "price": "price_NORMALIZED",
+ "product": "prod_NORMALIZED"
+ },
+ "type": "price_details",
+ "unit_amount_decimal": "8000"
+ },
+ "quantity": 6,
+ "taxes": []
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 1,
+ "url": "/v1/invoices/invoice_plan_bundle_additional_licenses--Event.list.2.json/lines"
+ },
+ "livemode": false,
+ "metadata": {
+ "billing_schedule": "1",
+ "current_plan_id": "None",
+ "license_management": "automatic",
+ "licenses": "6",
+ "on_free_trial": "False",
+ "plan_tier": "1",
+ "user_id": "10"
+ },
+ "next_payment_attempt": null,
+ "number": "NORMALIZED",
+ "object": "invoice",
+ "on_behalf_of": null,
+ "parent": null,
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1000000000,
+ "period_start": 1000000000,
+ "post_payment_credit_notes_amount": 0,
+ "pre_payment_credit_notes_amount": 0,
+ "receipt_number": null,
+ "rendering": {
+ "amount_tax_display": null,
+ "pdf": {
+ "page_size": "letter"
+ },
+ "template": null,
+ "template_version": null
+ },
+ "shipping_cost": null,
+ "shipping_details": null,
+ "starting_balance": 0,
+ "statement_descriptor": "Zulip Cloud Standard",
+ "status": "paid",
+ "status_transitions": {
+ "finalized_at": 1000000000,
+ "marked_uncollectible_at": null,
+ "paid_at": 1000000000,
+ "voided_at": null
+ },
+ "subtotal": 48000,
+ "subtotal_excluding_tax": 48000,
+ "test_clock": null,
+ "total": 48000,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 48000,
+ "total_pretax_credit_amounts": [],
+ "total_taxes": [],
+ "webhooks_delivered_at": 1000000000
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "url": "/v1/invoices"
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--Invoice.pay.1.json b/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--Invoice.pay.1.json
new file mode 100644
index 00000000000..bf339d11b75
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--Invoice.pay.1.json
@@ -0,0 +1,154 @@
+{
+ "account_country": "US",
+ "account_name": "NORMALIZED",
+ "account_tax_ids": null,
+ "amount_due": 48000,
+ "amount_overpaid": 0,
+ "amount_paid": 48000,
+ "amount_remaining": 0,
+ "amount_shipping": 0,
+ "application": null,
+ "attempt_count": 1,
+ "attempted": true,
+ "auto_advance": false,
+ "automatic_tax": {
+ "disabled_reason": null,
+ "enabled": false,
+ "liability": null,
+ "provider": null,
+ "status": null
+ },
+ "automatically_finalizes_at": null,
+ "billing_reason": "manual",
+ "collection_method": "charge_automatically",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_NORMALIZED",
+ "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": "If paying by bank transfer outside of the US, use the OUR option for who should pay bank transfer fees, to make sure that your invoice is paid in full.",
+ "discounts": [],
+ "due_date": null,
+ "effective_at": 1000000000,
+ "ending_balance": 0,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED/test_NORMALIZED?s=ap",
+ "id": "invoice_plan_bundle_additional_licenses--Event.list.2.json",
+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED/test_NORMALIZED/pdf?s=ap",
+ "issuer": {
+ "type": "self"
+ },
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": 48000,
+ "currency": "usd",
+ "description": "Zulip Cloud Standard",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "invoice_plan_bundle_additional_licenses--Event.list.2.json",
+ "invoice": "invoice_plan_bundle_additional_licenses--Event.list.2.json",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "parent": {
+ "invoice_item_details": {
+ "invoice_item": "ii_NORMALIZED",
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "subscription": null
+ },
+ "subscription_item_details": null,
+ "type": "invoice_item_details"
+ },
+ "period": {
+ "end": 1357095845,
+ "start": 1325473445
+ },
+ "pretax_credit_amounts": [],
+ "pricing": {
+ "price_details": {
+ "price": "price_NORMALIZED",
+ "product": "prod_NORMALIZED"
+ },
+ "type": "price_details",
+ "unit_amount_decimal": "8000"
+ },
+ "quantity": 6,
+ "taxes": []
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 1,
+ "url": "/v1/invoices/invoice_plan_bundle_additional_licenses--Event.list.2.json/lines"
+ },
+ "livemode": false,
+ "metadata": {
+ "billing_schedule": "1",
+ "current_plan_id": "None",
+ "license_management": "automatic",
+ "licenses": "6",
+ "on_free_trial": "False",
+ "plan_tier": "1",
+ "user_id": "10"
+ },
+ "next_payment_attempt": null,
+ "number": "NORMALIZED",
+ "object": "invoice",
+ "on_behalf_of": null,
+ "parent": null,
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1000000000,
+ "period_start": 1000000000,
+ "post_payment_credit_notes_amount": 0,
+ "pre_payment_credit_notes_amount": 0,
+ "receipt_number": null,
+ "rendering": {
+ "amount_tax_display": null,
+ "pdf": {
+ "page_size": "letter"
+ },
+ "template": null,
+ "template_version": null
+ },
+ "shipping_cost": null,
+ "shipping_details": null,
+ "starting_balance": 0,
+ "statement_descriptor": "Zulip Cloud Standard",
+ "status": "paid",
+ "status_transitions": {
+ "finalized_at": 1000000000,
+ "marked_uncollectible_at": null,
+ "paid_at": 1000000000,
+ "voided_at": null
+ },
+ "subtotal": 48000,
+ "subtotal_excluding_tax": 48000,
+ "test_clock": null,
+ "total": 48000,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 48000,
+ "total_pretax_credit_amounts": [],
+ "total_taxes": [],
+ "webhooks_delivered_at": 1000000000
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--InvoiceItem.create.1.json b/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--InvoiceItem.create.1.json
new file mode 100644
index 00000000000..95d590d9704
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--InvoiceItem.create.1.json
@@ -0,0 +1,32 @@
+{
+ "amount": 48000,
+ "currency": "usd",
+ "customer": "cus_NORMALIZED",
+ "date": 1000000000,
+ "description": "Zulip Cloud Standard",
+ "discountable": false,
+ "discounts": [],
+ "id": "invoice_plan_bundle_additional_licenses--Event.list.2.json",
+ "invoice": "in_NORMALIZED",
+ "livemode": false,
+ "metadata": {},
+ "net_amount": 48000,
+ "object": "invoiceitem",
+ "parent": null,
+ "period": {
+ "end": 1357095845,
+ "start": 1325473445
+ },
+ "pricing": {
+ "price_details": {
+ "price": "price_NORMALIZED",
+ "product": "prod_NORMALIZED"
+ },
+ "type": "price_details",
+ "unit_amount_decimal": "8000"
+ },
+ "proration": false,
+ "quantity": 6,
+ "tax_rates": [],
+ "test_clock": null
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--InvoiceItem.create.2.json b/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--InvoiceItem.create.2.json
new file mode 100644
index 00000000000..97a2d2034b4
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--InvoiceItem.create.2.json
@@ -0,0 +1,32 @@
+{
+ "amount": 389050,
+ "currency": "usd",
+ "customer": "cus_NORMALIZED",
+ "date": 1000000000,
+ "description": "Additional license (Jan 12, 2012 - Jan 2, 2013)",
+ "discountable": false,
+ "discounts": [],
+ "id": "invoice_plan_bundle_additional_licenses--InvoiceItem.create.2.json",
+ "invoice": "in_NORMALIZED",
+ "livemode": false,
+ "metadata": {},
+ "net_amount": 389050,
+ "object": "invoiceitem",
+ "parent": null,
+ "period": {
+ "end": 1357095845,
+ "start": 1326337445
+ },
+ "pricing": {
+ "price_details": {
+ "price": "price_NORMALIZED",
+ "product": "prod_NORMALIZED"
+ },
+ "type": "price_details",
+ "unit_amount_decimal": "7781"
+ },
+ "proration": false,
+ "quantity": 50,
+ "tax_rates": [],
+ "test_clock": null
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--InvoiceItem.create.3.json b/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--InvoiceItem.create.3.json
new file mode 100644
index 00000000000..92e26b3fa18
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--InvoiceItem.create.3.json
@@ -0,0 +1,32 @@
+{
+ "amount": 767200,
+ "currency": "usd",
+ "customer": "cus_NORMALIZED",
+ "date": 1000000000,
+ "description": "Additional license (Jan 17, 2012 - Jan 2, 2013)",
+ "discountable": false,
+ "discounts": [],
+ "id": "invoice_plan_bundle_additional_licenses--InvoiceItem.create.3.json",
+ "invoice": "in_NORMALIZED",
+ "livemode": false,
+ "metadata": {},
+ "net_amount": 767200,
+ "object": "invoiceitem",
+ "parent": null,
+ "period": {
+ "end": 1357095845,
+ "start": 1326769445
+ },
+ "pricing": {
+ "price_details": {
+ "price": "price_NORMALIZED",
+ "product": "prod_NORMALIZED"
+ },
+ "type": "price_details",
+ "unit_amount_decimal": "7672"
+ },
+ "proration": false,
+ "quantity": 100,
+ "tax_rates": [],
+ "test_clock": null
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--InvoiceItem.create.4.json b/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--InvoiceItem.create.4.json
new file mode 100644
index 00000000000..dab7f4e33eb
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--InvoiceItem.create.4.json
@@ -0,0 +1,32 @@
+{
+ "amount": 756300,
+ "currency": "usd",
+ "customer": "cus_NORMALIZED",
+ "date": 1000000000,
+ "description": "Additional license (Jan 22, 2012 - Jan 2, 2013)",
+ "discountable": false,
+ "discounts": [],
+ "id": "invoice_plan_bundle_additional_licenses--InvoiceItem.create.4.json",
+ "invoice": "in_NORMALIZED",
+ "livemode": false,
+ "metadata": {},
+ "net_amount": 756300,
+ "object": "invoiceitem",
+ "parent": null,
+ "period": {
+ "end": 1357095845,
+ "start": 1327201445
+ },
+ "pricing": {
+ "price_details": {
+ "price": "price_NORMALIZED",
+ "product": "prod_NORMALIZED"
+ },
+ "type": "price_details",
+ "unit_amount_decimal": "7563"
+ },
+ "proration": false,
+ "quantity": 100,
+ "tax_rates": [],
+ "test_clock": null
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--InvoiceItem.create.5.json b/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--InvoiceItem.create.5.json
new file mode 100644
index 00000000000..0b1a4dcb01e
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--InvoiceItem.create.5.json
@@ -0,0 +1,32 @@
+{
+ "amount": 372700,
+ "currency": "usd",
+ "customer": "cus_NORMALIZED",
+ "date": 1000000000,
+ "description": "Additional license (Jan 27, 2012 - Jan 2, 2013)",
+ "discountable": false,
+ "discounts": [],
+ "id": "invoice_plan_bundle_additional_licenses--InvoiceItem.create.5.json",
+ "invoice": "in_NORMALIZED",
+ "livemode": false,
+ "metadata": {},
+ "net_amount": 372700,
+ "object": "invoiceitem",
+ "parent": null,
+ "period": {
+ "end": 1357095845,
+ "start": 1327633465
+ },
+ "pricing": {
+ "price_details": {
+ "price": "price_NORMALIZED",
+ "product": "prod_NORMALIZED"
+ },
+ "type": "price_details",
+ "unit_amount_decimal": "7454"
+ },
+ "proration": false,
+ "quantity": 50,
+ "tax_rates": [],
+ "test_clock": null
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--PaymentMethod.create.1.json b/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--PaymentMethod.create.1.json
new file mode 100644
index 00000000000..cacb9bd2bfa
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--PaymentMethod.create.1.json
@@ -0,0 +1,51 @@
+{
+ "allow_redisplay": "unspecified",
+ "billing_details": {
+ "address": {
+ "city": "San Francisco",
+ "country": "US",
+ "line1": "123 Main St",
+ "line2": null,
+ "postal_code": "12345",
+ "state": "CA"
+ },
+ "email": null,
+ "name": "John Doe",
+ "phone": null,
+ "tax_id": null
+ },
+ "card": {
+ "brand": "visa",
+ "checks": {
+ "address_line1_check": "unchecked",
+ "address_postal_code_check": "unchecked",
+ "cvc_check": "unchecked"
+ },
+ "country": "US",
+ "display_brand": "visa",
+ "exp_month": 1,
+ "exp_year": 9999,
+ "fingerprint": "NORMALIZED",
+ "funding": "credit",
+ "generated_from": null,
+ "last4": "4242",
+ "networks": {
+ "available": [
+ "visa"
+ ],
+ "preferred": null
+ },
+ "regulated_status": "unregulated",
+ "three_d_secure_usage": {
+ "supported": true
+ },
+ "wallet": null
+ },
+ "created": 1000000000,
+ "customer": null,
+ "id": "invoice_plan_bundle_additional_licenses--Customer.retrieve.1.json",
+ "livemode": false,
+ "metadata": {},
+ "object": "payment_method",
+ "type": "card"
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--SetupIntent.create.1.json b/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--SetupIntent.create.1.json
new file mode 100644
index 00000000000..c7eba1c5821
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--SetupIntent.create.1.json
@@ -0,0 +1,35 @@
+{
+ "application": null,
+ "automatic_payment_methods": null,
+ "cancellation_reason": null,
+ "client_secret": "NORMALIZED",
+ "created": 1000000000,
+ "customer": "cus_NORMALIZED",
+ "description": null,
+ "excluded_payment_method_types": null,
+ "flow_directions": null,
+ "id": "invoice_plan_bundle_additional_licenses--SetupIntent.create.1.json",
+ "last_setup_error": null,
+ "latest_attempt": "setatt_NORMALIZED",
+ "livemode": false,
+ "mandate": null,
+ "metadata": {},
+ "next_action": null,
+ "object": "setup_intent",
+ "on_behalf_of": null,
+ "payment_method": "pm_NORMALIZED",
+ "payment_method_configuration_details": null,
+ "payment_method_options": {
+ "card": {
+ "mandate_options": null,
+ "network": null,
+ "request_three_d_secure": "automatic"
+ }
+ },
+ "payment_method_types": [
+ "card"
+ ],
+ "single_use_mandate": null,
+ "status": "succeeded",
+ "usage": "off_session"
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--SetupIntent.list.1.json b/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--SetupIntent.list.1.json
new file mode 100644
index 00000000000..a4db216cad1
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--SetupIntent.list.1.json
@@ -0,0 +1,42 @@
+{
+ "data": [
+ {
+ "application": null,
+ "automatic_payment_methods": null,
+ "cancellation_reason": null,
+ "client_secret": "NORMALIZED",
+ "created": 1000000000,
+ "customer": "cus_NORMALIZED",
+ "description": null,
+ "excluded_payment_method_types": null,
+ "flow_directions": null,
+ "id": "invoice_plan_bundle_additional_licenses--SetupIntent.list.1.json",
+ "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": false,
+ "object": "list",
+ "url": "/v1/setup_intents"
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--SetupIntent.retrieve.1.json b/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--SetupIntent.retrieve.1.json
new file mode 100644
index 00000000000..c7eba1c5821
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--SetupIntent.retrieve.1.json
@@ -0,0 +1,35 @@
+{
+ "application": null,
+ "automatic_payment_methods": null,
+ "cancellation_reason": null,
+ "client_secret": "NORMALIZED",
+ "created": 1000000000,
+ "customer": "cus_NORMALIZED",
+ "description": null,
+ "excluded_payment_method_types": null,
+ "flow_directions": null,
+ "id": "invoice_plan_bundle_additional_licenses--SetupIntent.create.1.json",
+ "last_setup_error": null,
+ "latest_attempt": "setatt_NORMALIZED",
+ "livemode": false,
+ "mandate": null,
+ "metadata": {},
+ "next_action": null,
+ "object": "setup_intent",
+ "on_behalf_of": null,
+ "payment_method": "pm_NORMALIZED",
+ "payment_method_configuration_details": null,
+ "payment_method_options": {
+ "card": {
+ "mandate_options": null,
+ "network": null,
+ "request_three_d_secure": "automatic"
+ }
+ },
+ "payment_method_types": [
+ "card"
+ ],
+ "single_use_mandate": null,
+ "status": "succeeded",
+ "usage": "off_session"
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--checkout.Session.create.1.json b/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--checkout.Session.create.1.json
new file mode 100644
index 00000000000..d8f60336c45
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--checkout.Session.create.1.json
@@ -0,0 +1,109 @@
+{
+ "adaptive_pricing": {
+ "enabled": false
+ },
+ "after_expiration": null,
+ "allow_promotion_codes": null,
+ "amount_subtotal": null,
+ "amount_total": null,
+ "automatic_tax": {
+ "enabled": false,
+ "liability": null,
+ "provider": null,
+ "status": null
+ },
+ "billing_address_collection": "required",
+ "branding_settings": {
+ "background_color": "#dbedff",
+ "border_style": "rounded",
+ "button_color": "#3e6bfe",
+ "display_name": "Violet Beam",
+ "font_family": "source_sans_pro",
+ "icon": {
+ "file": "file_1RxpnoDwzgQ85STgf3bBl5KY",
+ "type": "file"
+ },
+ "logo": {
+ "file": "file_1RxpnoDwzgQ85STgvEm4ntJu",
+ "type": "file"
+ }
+ },
+ "cancel_url": "http://zulip.testserver/upgrade/?manual_license_management=false&tier=1",
+ "client_reference_id": null,
+ "client_secret": null,
+ "collected_information": {
+ "business_name": null,
+ "individual_name": null,
+ "shipping_details": null
+ },
+ "consent": null,
+ "consent_collection": null,
+ "created": 1000000000,
+ "currency": null,
+ "currency_conversion": null,
+ "custom_fields": [],
+ "custom_text": {
+ "after_submit": null,
+ "shipping_address": null,
+ "submit": null,
+ "terms_of_service_acceptance": null
+ },
+ "customer": "cus_NORMALIZED",
+ "customer_creation": null,
+ "customer_details": {
+ "address": null,
+ "business_name": null,
+ "email": "[email protected]",
+ "individual_name": null,
+ "name": null,
+ "phone": null,
+ "tax_exempt": null,
+ "tax_ids": null
+ },
+ "customer_email": null,
+ "discounts": null,
+ "expires_at": 1000000000,
+ "id": "invoice_plan_bundle_additional_licenses--checkout.Session.create.1.json",
+ "invoice": null,
+ "invoice_creation": null,
+ "livemode": false,
+ "locale": null,
+ "metadata": {
+ "type": "card_update",
+ "user_id": "10"
+ },
+ "mode": "setup",
+ "object": "checkout.session",
+ "origin_context": null,
+ "payment_intent": null,
+ "payment_link": null,
+ "payment_method_collection": "always",
+ "payment_method_configuration_details": null,
+ "payment_method_options": {
+ "card": {
+ "request_three_d_secure": "automatic"
+ }
+ },
+ "payment_method_types": [
+ "card"
+ ],
+ "payment_status": "no_payment_required",
+ "permissions": null,
+ "phone_number_collection": {
+ "enabled": false
+ },
+ "recovered_from": null,
+ "saved_payment_method_options": null,
+ "setup_intent": "seti_NORMALIZED",
+ "shipping_address_collection": null,
+ "shipping_cost": null,
+ "shipping_options": [],
+ "status": "open",
+ "submit_type": null,
+ "subscription": null,
+ "success_url": "http://zulip.testserver/billing/event_status/?stripe_session_id={CHECKOUT_SESSION_ID}",
+ "total_details": null,
+ "ui_mode": "hosted",
+ "url": "https://checkout.stripe.com/c/pay/cs_test_NORMALIZED",
+ "wallet_options": null
+}
diff --git a/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--checkout.Session.list.1.json b/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--checkout.Session.list.1.json
new file mode 100644
index 00000000000..1b315d09f97
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/invoice_plan_bundle_additional_licenses--checkout.Session.list.1.json
@@ -0,0 +1,116 @@
+{
+ "data": [
+ {
+ "adaptive_pricing": {
+ "enabled": false
+ },
+ "after_expiration": null,
+ "allow_promotion_codes": null,
+ "amount_subtotal": null,
+ "amount_total": null,
+ "automatic_tax": {
+ "enabled": false,
+ "liability": null,
+ "provider": null,
+ "status": null
+ },
+ "billing_address_collection": "required",
+ "branding_settings": {
+ "background_color": "#dbedff",
+ "border_style": "rounded",
+ "button_color": "#3e6bfe",
+ "display_name": "Violet Beam",
+ "font_family": "source_sans_pro",
+ "icon": {
+ "file": "file_1RxpnoDwzgQ85STgf3bBl5KY",
+ "type": "file"
+ },
+ "logo": {
+ "file": "file_1RxpnoDwzgQ85STgvEm4ntJu",
+ "type": "file"
+ }
+ },
+ "cancel_url": "http://zulip.testserver/upgrade/?manual_license_management=false&tier=1",
+ "client_reference_id": null,
+ "client_secret": null,
+ "collected_information": {
+ "business_name": null,
+ "individual_name": null,
+ "shipping_details": null
+ },
+ "consent": null,
+ "consent_collection": null,
+ "created": 1000000000,
+ "currency": null,
+ "currency_conversion": null,
+ "custom_fields": [],
+ "custom_text": {
+ "after_submit": null,
+ "shipping_address": null,
+ "submit": null,
+ "terms_of_service_acceptance": null
+ },
+ "customer": "cus_NORMALIZED",
+ "customer_creation": null,
+ "customer_details": {
+ "address": null,
+ "business_name": null,
+ "email": "[email protected]",
+ "individual_name": null,
+ "name": null,
+ "phone": null,
+ "tax_exempt": null,
+ "tax_ids": null
+ },
+ "customer_email": null,
+ "discounts": null,
+ "expires_at": 1000000000,
+ "id": "invoice_plan_bundle_additional_licenses--checkout.Session.create.1.json",
+ "invoice": null,
+ "invoice_creation": null,
+ "livemode": false,
+ "locale": null,
+ "metadata": {
+ "type": "card_update",
+ "user_id": "10"
+ },
+ "mode": "setup",
+ "object": "checkout.session",
+ "origin_context": null,
+ "payment_intent": null,
+ "payment_link": null,
+ "payment_method_collection": "always",
+ "payment_method_configuration_details": null,
+ "payment_method_options": {
+ "card": {
+ "request_three_d_secure": "automatic"
+ }
+ },
+ "payment_method_types": [
+ "card"
+ ],
+ "payment_status": "no_payment_required",
+ "permissions": null,
+ "phone_number_collection": {
+ "enabled": false
+ },
+ "recovered_from": null,
+ "saved_payment_method_options": null,
+ "setup_intent": "seti_NORMALIZED",
+ "shipping_address_collection": null,
+ "shipping_cost": null,
+ "shipping_options": [],
+ "status": "open",
+ "submit_type": null,
+ "subscription": null,
+ "success_url": "http://zulip.testserver/billing/event_status/?stripe_session_id={CHECKOUT_SESSION_ID}",
+ "total_details": null,
+ "ui_mode": "hosted",
+ "url": "https://checkout.stripe.com/c/pay/cs_test_NORMALIZED",
+ "wallet_options": null
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "url": "/v1/checkout/sessions"
+}
diff --git a/corporate/tests/test_stripe.py b/corporate/tests/test_stripe.py
index cf292f7a161..1e050253be9 100644
--- a/corporate/tests/test_stripe.py
+++ b/corporate/tests/test_stripe.py
@@ -6301,6 +6301,18 @@ class InvoiceTest(StripeTestCase):
}
for key, value in line_item_params.items():
self.assertEqual(item0.get(key), value)
+ line_item_params = {
+ "amount": 3 * int(8000 * (366 - 100) / 366 + 0.5),
+ "description": "Additional license (Apr 11, 2012 - Jan 2, 2013)",
+ "discountable": False,
+ "period": {
+ "start": datetime_to_timestamp(self.now + timedelta(days=100)),
+ "end": datetime_to_timestamp(self.now + timedelta(days=366)),
+ },
+ "quantity": 3,
+ }
+ for key, value in line_item_params.items():
+ self.assertEqual(item1.get(key), value)
line_item_params = {
"amount": 8000 * (self.seat_count + 1),
"description": "Zulip Cloud Standard - renewal",
@@ -6311,20 +6323,121 @@ class InvoiceTest(StripeTestCase):
},
"quantity": self.seat_count + 1,
}
+ for key, value in line_item_params.items():
+ self.assertEqual(item2.get(key), value)
+
+ @mock_stripe()
+ def test_invoice_plan_bundle_additional_licenses(self, *mocks: Mock) -> None:
+ user = self.example_user("hamlet")
+ self.login_user(user)
+ with time_machine.travel(self.now, tick=False):
+ self.add_card_and_upgrade(user)
+ realm = get_realm("zulip")
+ billing_session = RealmBillingSession(user=user, realm=realm)
+ # Increase by 300 additional licenses in the first month of the
+ # annual plan.
+ updated_seat_count = self.seat_count
+ for i in range(50):
+ updated_seat_count += 1
+ with patch(
+ "corporate.lib.stripe.get_latest_seat_count", return_value=updated_seat_count
+ ):
+ billing_session.update_license_ledger_if_needed(
+ self.now + timedelta(days=10, seconds=i)
+ )
+ for i in range(100):
+ updated_seat_count += 1
+ with patch(
+ "corporate.lib.stripe.get_latest_seat_count", return_value=updated_seat_count
+ ):
+ billing_session.update_license_ledger_if_needed(
+ self.now + timedelta(days=15, seconds=i)
+ )
+ for i in range(100):
+ updated_seat_count += 1
+ with patch(
+ "corporate.lib.stripe.get_latest_seat_count", return_value=updated_seat_count
+ ):
+ billing_session.update_license_ledger_if_needed(
+ self.now + timedelta(days=20, seconds=i)
+ )
+ # Remove 20 active licenses to confirm we're still handling these ledger entries
+ # correctly when bundling.
+ for i in range(20):
+ updated_seat_count -= 1
+ with patch(
+ "corporate.lib.stripe.get_latest_seat_count", return_value=updated_seat_count
+ ):
+ billing_session.update_license_ledger_if_needed(
+ self.now + timedelta(days=22, seconds=i)
+ )
+ for i in range(70):
+ updated_seat_count += 1
+ with patch(
+ "corporate.lib.stripe.get_latest_seat_count", return_value=updated_seat_count
+ ):
+ billing_session.update_license_ledger_if_needed(
+ self.now + timedelta(days=25, seconds=i)
+ )
+ plan = CustomerPlan.objects.first()
+ assert plan is not None
+ billing_session.invoice_plan(plan, self.next_month)
+ stripe_customer_id = plan.customer.stripe_customer_id
+ assert stripe_customer_id is not None
+ [invoice0, _invoice1] = iter(stripe.Invoice.list(customer=stripe_customer_id))
+ self.assertIsNotNone(invoice0.status_transitions.finalized_at)
+ [item0, item1, item2, item3] = iter(invoice0.lines.data)
+ # We have to adjust the start datetime for the 20 license ledger
+ # entries (by 20 seconds) that were for licenses that were already
+ # paid for in the billing period.
+ line_item_params = {
+ "amount": 50 * int(8000 * (366 - 25) / 366 + 0.5),
+ "description": "Additional license (Jan 27, 2012 - Jan 2, 2013)",
+ "discountable": False,
+ "period": {
+ "start": datetime_to_timestamp(self.now + timedelta(days=25, seconds=20)),
+ "end": datetime_to_timestamp(self.next_year),
+ },
+ "quantity": 50,
+ }
+ for key, value in line_item_params.items():
+ self.assertEqual(item0.get(key), value)
+ line_item_params = {
+ "amount": 100 * int(8000 * (366 - 20) / 366 + 0.5),
+ "description": "Additional license (Jan 22, 2012 - Jan 2, 2013)",
+ "discountable": False,
+ "period": {
+ "start": datetime_to_timestamp(self.now + timedelta(days=20)),
+ "end": datetime_to_timestamp(self.next_year),
+ },
+ "quantity": 100,
+ }
for key, value in line_item_params.items():
self.assertEqual(item1.get(key), value)
line_item_params = {
- "amount": 3 * int(8000 * (366 - 100) / 366 + 0.5),
- "description": "Additional license (Apr 11, 2012 - Jan 2, 2013)",
+ "amount": 100 * int(8000 * (366 - 15) / 366 + 0.5),
+ "description": "Additional license (Jan 17, 2012 - Jan 2, 2013)",
"discountable": False,
"period": {
- "start": datetime_to_timestamp(self.now + timedelta(days=100)),
- "end": datetime_to_timestamp(self.now + timedelta(days=366)),
+ "start": datetime_to_timestamp(self.now + timedelta(days=15)),
+ "end": datetime_to_timestamp(self.next_year),
},
- "quantity": 3,
+ "quantity": 100,
}
for key, value in line_item_params.items():
self.assertEqual(item2.get(key), value)
+ line_item_params = {
+ "amount": 50 * int(8000 * (366 - 10) / 366 + 0.5),
+ "description": "Additional license (Jan 12, 2012 - Jan 2, 2013)",
+ "discountable": False,
+ "period": {
+ "start": datetime_to_timestamp(self.now + timedelta(days=10)),
+ "end": datetime_to_timestamp(self.next_year),
+ },
+ "quantity": 50,
+ }
+ for key, value in line_item_params.items():
+ self.assertEqual(item3.get(key), value)
@mock_stripe()
def test_fixed_price_plans(self, *mocks: Mock) -> None: