corporate: Add additional licenses in one invoice item.

So that we don't exceed the limit of 250 invoice items for a Stripe
invoice, we bundle additional license ledger entries into a single
invoice item when we invoice the plan.
This commit is contained in:
Lauryn Menard
2025-11-03 14:41:43 +01:00
committed by Tim Abbott
parent e73955c313
commit c273669203
44 changed files with 4232 additions and 160 deletions

View File

@@ -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.

View File

@@ -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"

View File

@@ -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"
}

View File

@@ -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,

View File

@@ -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
}

View File

@@ -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
}

View File

@@ -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
}

View File

@@ -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,
@@ -92,46 +92,6 @@
"quantity": 1,
"taxes": []
},
{
"amount": 56000,
"currency": "usd",
"description": "Zulip Cloud Standard - renewal",
"discount_amounts": [],
"discountable": false,
"discounts": [],
"id": "invoice_plan--Invoice.finalize_invoice.2.json",
"invoice": "invoice_plan--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": 1388631845,
"start": 1357095845
},
"pretax_credit_amounts": [],
"pricing": {
"price_details": {
"price": "price_NORMALIZED",
"product": "prod_NORMALIZED"
},
"type": "price_details",
"unit_amount_decimal": "8000"
},
"quantity": 7,
"taxes": []
},
{
"amount": 17442,
"currency": "usd",
@@ -171,6 +131,46 @@
},
"quantity": 3,
"taxes": []
},
{
"amount": 56000,
"currency": "usd",
"description": "Zulip Cloud Standard - renewal",
"discount_amounts": [],
"discountable": false,
"discounts": [],
"id": "invoice_plan--Invoice.finalize_invoice.2.json",
"invoice": "invoice_plan--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": 1388631845,
"start": 1357095845
},
"pretax_credit_amounts": [],
"pricing": {
"price_details": {
"price": "price_NORMALIZED",
"product": "prod_NORMALIZED"
},
"type": "price_details",
"unit_amount_decimal": "8000"
},
"quantity": 7,
"taxes": []
}
],
"has_more": false,

View File

@@ -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,
@@ -94,46 +94,6 @@
"quantity": 1,
"taxes": []
},
{
"amount": 56000,
"currency": "usd",
"description": "Zulip Cloud Standard - renewal",
"discount_amounts": [],
"discountable": false,
"discounts": [],
"id": "invoice_plan--Invoice.finalize_invoice.2.json",
"invoice": "invoice_plan--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": 1388631845,
"start": 1357095845
},
"pretax_credit_amounts": [],
"pricing": {
"price_details": {
"price": "price_NORMALIZED",
"product": "prod_NORMALIZED"
},
"type": "price_details",
"unit_amount_decimal": "8000"
},
"quantity": 7,
"taxes": []
},
{
"amount": 17442,
"currency": "usd",
@@ -173,6 +133,46 @@
},
"quantity": 3,
"taxes": []
},
{
"amount": 56000,
"currency": "usd",
"description": "Zulip Cloud Standard - renewal",
"discount_amounts": [],
"discountable": false,
"discounts": [],
"id": "invoice_plan--Invoice.finalize_invoice.2.json",
"invoice": "invoice_plan--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": 1388631845,
"start": 1357095845
},
"pretax_credit_amounts": [],
"pricing": {
"price_details": {
"price": "price_NORMALIZED",
"product": "prod_NORMALIZED"
},
"type": "price_details",
"unit_amount_decimal": "8000"
},
"quantity": 7,
"taxes": []
}
],
"has_more": false,
@@ -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,

View File

@@ -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
}

View File

@@ -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
}

View File

@@ -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
}

View File

@@ -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"
}
},

View File

@@ -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"
}
},

View File

@@ -0,0 +1,32 @@
{
"address": null,
"balance": 0,
"created": 1000000000,
"currency": null,
"default_source": null,
"delinquent": false,
"description": "zulip (Zulip Dev)",
"discount": null,
"email": "hamlet@zulip.com",
"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
}

View File

@@ -0,0 +1,32 @@
{
"address": null,
"balance": 0,
"created": 1000000000,
"currency": null,
"default_source": null,
"delinquent": false,
"description": "zulip (Zulip Dev)",
"discount": null,
"email": "hamlet@zulip.com",
"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
}

View File

@@ -0,0 +1,82 @@
{
"address": null,
"balance": 0,
"created": 1000000000,
"currency": null,
"default_source": null,
"delinquent": false,
"description": "zulip (Zulip Dev)",
"discount": null,
"email": "hamlet@zulip.com",
"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
}

View File

@@ -0,0 +1,82 @@
{
"address": null,
"balance": 0,
"created": 1000000000,
"currency": null,
"default_source": null,
"delinquent": false,
"description": "zulip (Zulip Dev)",
"discount": null,
"email": "hamlet@zulip.com",
"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
}

View File

@@ -0,0 +1,82 @@
{
"address": null,
"balance": 0,
"created": 1000000000,
"currency": null,
"default_source": null,
"delinquent": false,
"description": "zulip (Zulip Dev)",
"discount": null,
"email": "hamlet@zulip.com",
"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
}

View File

@@ -0,0 +1,82 @@
{
"address": null,
"balance": 0,
"created": 1000000000,
"currency": null,
"default_source": null,
"delinquent": false,
"description": "zulip (Zulip Dev)",
"discount": null,
"email": "hamlet@zulip.com",
"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
}

View File

@@ -0,0 +1,82 @@
{
"address": null,
"balance": 0,
"created": 1000000000,
"currency": null,
"default_source": null,
"delinquent": false,
"description": "zulip (Zulip Dev)",
"discount": null,
"email": "hamlet@zulip.com",
"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
}

View File

@@ -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": "hamlet@zulip.com",
"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"
}

View File

@@ -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": "hamlet@zulip.com",
"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": "hamlet@zulip.com",
"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": "hamlet@zulip.com",
"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"
}

View File

@@ -0,0 +1,6 @@
{
"data": [],
"has_more": false,
"object": "list",
"url": "/v1/events"
}

View File

@@ -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": "hamlet@zulip.com",
"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
}

View File

@@ -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": "hamlet@zulip.com",
"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
}

View File

@@ -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": "hamlet@zulip.com",
"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
}

View File

@@ -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": "hamlet@zulip.com",
"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
}

View File

@@ -0,0 +1,6 @@
{
"data": [],
"has_more": false,
"object": "list",
"url": "/v1/invoices"
}

View File

@@ -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": "hamlet@zulip.com",
"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": "hamlet@zulip.com",
"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"
}

View File

@@ -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": "hamlet@zulip.com",
"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
}

View File

@@ -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
}

View File

@@ -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
}

View File

@@ -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
}

View File

@@ -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
}

View File

@@ -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
}

View File

@@ -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"
}

View File

@@ -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"
}

View File

@@ -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"
}

View File

@@ -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"
}

View File

@@ -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": "hamlet@zulip.com",
"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
}

View File

@@ -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": "hamlet@zulip.com",
"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"
}

View File

@@ -6301,18 +6301,6 @@ class InvoiceTest(StripeTestCase):
}
for key, value in line_item_params.items():
self.assertEqual(item0.get(key), value)
line_item_params = {
"amount": 8000 * (self.seat_count + 1),
"description": "Zulip Cloud Standard - renewal",
"discountable": False,
"period": {
"start": datetime_to_timestamp(self.now + timedelta(days=366)),
"end": datetime_to_timestamp(self.now + timedelta(days=2 * 365 + 1)),
},
"quantity": self.seat_count + 1,
}
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)",
@@ -6323,9 +6311,134 @@ class InvoiceTest(StripeTestCase):
},
"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",
"discountable": False,
"period": {
"start": datetime_to_timestamp(self.now + timedelta(days=366)),
"end": datetime_to_timestamp(self.now + timedelta(days=2 * 365 + 1)),
},
"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": 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=15)),
"end": datetime_to_timestamp(self.next_year),
},
"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:
# Also tests charge_automatically=False