Skip to content

armgit / zulip

Public Imported from GitHub
0

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

stripe: Disable free trial for legacy customer with ended plan.

Aman Agrawalbddb44eebfed
diff --git a/corporate/lib/stripe.py b/corporate/lib/stripe.py
index b4057093a5a..0b4a3a10ad4 100644
--- a/corporate/lib/stripe.py
+++ b/corporate/lib/stripe.py
@@ -51,6 +51,7 @@ from corporate.models import (
get_customer_by_realm,
get_customer_by_remote_realm,
get_customer_by_remote_server,
+ is_legacy_customer,
)
from zerver.lib.exceptions import JsonableError
from zerver.lib.logging_util import log_to_file
@@ -1847,10 +1848,11 @@ class BillingSession(ABC):
if fixed_price_plan_offer is not None:
free_trial = False
+ if is_legacy_customer(customer):
+ # Free trial is not available for legacy customers.
+ free_trial = False
+
remote_server_legacy_plan = self.get_remote_server_legacy_plan(customer)
- if remote_server_legacy_plan is not None:
- # Free trial is not available for legacy customers.
- free_trial = False
should_schedule_upgrade_for_legacy_remote_server = (
remote_server_legacy_plan is not None
and upgrade_request.remote_server_plan_start_date == "billing_cycle_end_date"
@@ -2420,6 +2422,9 @@ class BillingSession(ABC):
is_self_hosted_billing = not isinstance(self, RealmBillingSession)
if fixed_price is None and remote_server_legacy_plan_end_date is None:
free_trial_days = get_free_trial_days(is_self_hosted_billing, tier)
+ if customer is not None and is_legacy_customer(customer):
+ # Free trial is not available for legacy customers.
+ free_trial_days = None
if free_trial_days is not None:
_, _, free_trial_end, _ = compute_plan_parameters(
tier,
diff --git a/corporate/models.py b/corporate/models.py
index 262b8691019..7d680d35098 100644
--- a/corporate/models.py
+++ b/corporate/models.py
@@ -473,6 +473,12 @@ def get_current_plan_by_customer(customer: Customer) -> Optional[CustomerPlan]:
).first()
+def is_legacy_customer(customer: Customer) -> bool:
+ return CustomerPlan.objects.filter(
+ customer=customer, tier=CustomerPlan.TIER_SELF_HOSTED_LEGACY
+ ).exists()
+
+
def get_current_plan_by_realm(realm: Realm) -> Optional[CustomerPlan]:
customer = get_customer_by_realm(realm)
if customer is None:
diff --git a/corporate/tests/stripe_fixtures/free_trial_not_available_for_active_legacy_customer--Customer.create.1.json b/corporate/tests/stripe_fixtures/free_trial_not_available_for_active_legacy_customer--Customer.create.1.json
new file mode 100644
index 00000000000..f9f5cb63813
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/free_trial_not_available_for_active_legacy_customer--Customer.create.1.json
@@ -0,0 +1,33 @@
+{
+ "address": null,
+ "balance": 0,
+ "created": 1708574643,
+ "currency": null,
+ "default_currency": null,
+ "default_source": null,
+ "delinquent": false,
+ "description": "demo.example.com 6cde5f7a-1f7",
+ "discount": null,
+ "email": "[email protected]",
+ "id": "cus_PbgtpRvLU7dw2y",
+ "invoice_prefix": "CE82FB85",
+ "invoice_settings": {
+ "custom_fields": null,
+ "default_payment_method": null,
+ "footer": null,
+ "rendering_options": null
+ },
+ "livemode": false,
+ "metadata": {
+ "remote_server_str": "demo.example.com 6cde5f7a-1f7",
+ "remote_server_uuid": "6cde5f7a-1f7e-4978-9716-49f69ebfc9fe"
+ },
+ "name": null,
+ "next_invoice_sequence": 1,
+ "object": "customer",
+ "phone": null,
+ "preferred_locales": [],
+ "shipping": null,
+ "tax_exempt": "none",
+ "test_clock": null
+}
diff --git a/corporate/tests/stripe_fixtures/free_trial_not_available_for_active_legacy_customer--Customer.modify.1.json b/corporate/tests/stripe_fixtures/free_trial_not_available_for_active_legacy_customer--Customer.modify.1.json
new file mode 100644
index 00000000000..f24ad729207
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/free_trial_not_available_for_active_legacy_customer--Customer.modify.1.json
@@ -0,0 +1,33 @@
+{
+ "address": null,
+ "balance": 0,
+ "created": 1708574643,
+ "currency": null,
+ "default_currency": null,
+ "default_source": null,
+ "delinquent": false,
+ "description": "demo.example.com 6cde5f7a-1f7",
+ "discount": null,
+ "email": "[email protected]",
+ "id": "cus_PbgtpRvLU7dw2y",
+ "invoice_prefix": "CE82FB85",
+ "invoice_settings": {
+ "custom_fields": null,
+ "default_payment_method": "pm_1OmTVwDEQaroqDjsJyP28EtN",
+ "footer": null,
+ "rendering_options": null
+ },
+ "livemode": false,
+ "metadata": {
+ "remote_server_str": "demo.example.com 6cde5f7a-1f7",
+ "remote_server_uuid": "6cde5f7a-1f7e-4978-9716-49f69ebfc9fe"
+ },
+ "name": null,
+ "next_invoice_sequence": 1,
+ "object": "customer",
+ "phone": null,
+ "preferred_locales": [],
+ "shipping": null,
+ "tax_exempt": "none",
+ "test_clock": null
+}
diff --git a/corporate/tests/stripe_fixtures/free_trial_not_available_for_active_legacy_customer--Customer.retrieve.1.json b/corporate/tests/stripe_fixtures/free_trial_not_available_for_active_legacy_customer--Customer.retrieve.1.json
new file mode 100644
index 00000000000..ff8e652ab1f
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/free_trial_not_available_for_active_legacy_customer--Customer.retrieve.1.json
@@ -0,0 +1,80 @@
+{
+ "address": null,
+ "balance": 0,
+ "created": 1708574643,
+ "currency": null,
+ "default_currency": null,
+ "default_source": null,
+ "delinquent": false,
+ "description": "demo.example.com 6cde5f7a-1f7",
+ "discount": null,
+ "email": "[email protected]",
+ "id": "cus_PbgtpRvLU7dw2y",
+ "invoice_prefix": "CE82FB85",
+ "invoice_settings": {
+ "custom_fields": null,
+ "default_payment_method": {
+ "billing_details": {
+ "address": {
+ "city": null,
+ "country": null,
+ "line1": null,
+ "line2": null,
+ "postal_code": null,
+ "state": null
+ },
+ "email": null,
+ "name": null,
+ "phone": null
+ },
+ "card": {
+ "brand": "visa",
+ "checks": {
+ "address_line1_check": null,
+ "address_postal_code_check": null,
+ "cvc_check": "pass"
+ },
+ "country": "US",
+ "display_brand": "visa",
+ "exp_month": 2,
+ "exp_year": 2025,
+ "fingerprint": "9XKsMixKBi6kIIzd",
+ "funding": "credit",
+ "generated_from": null,
+ "last4": "4242",
+ "networks": {
+ "available": [
+ "visa"
+ ],
+ "preferred": null
+ },
+ "three_d_secure_usage": {
+ "supported": true
+ },
+ "wallet": null
+ },
+ "created": 1708574645,
+ "customer": "cus_PbgtpRvLU7dw2y",
+ "id": "pm_1OmTVwDEQaroqDjsJyP28EtN",
+ "livemode": false,
+ "metadata": {},
+ "object": "payment_method",
+ "type": "card"
+ },
+ "footer": null,
+ "rendering_options": null
+ },
+ "livemode": false,
+ "metadata": {
+ "remote_server_str": "demo.example.com 6cde5f7a-1f7",
+ "remote_server_uuid": "6cde5f7a-1f7e-4978-9716-49f69ebfc9fe"
+ },
+ "name": null,
+ "next_invoice_sequence": 1,
+ "object": "customer",
+ "phone": null,
+ "preferred_locales": [],
+ "shipping": null,
+ "tax_exempt": "none",
+ "test_clock": null
+}
diff --git a/corporate/tests/stripe_fixtures/free_trial_not_available_for_active_legacy_customer--Customer.retrieve.2.json b/corporate/tests/stripe_fixtures/free_trial_not_available_for_active_legacy_customer--Customer.retrieve.2.json
new file mode 100644
index 00000000000..ff8e652ab1f
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/free_trial_not_available_for_active_legacy_customer--Customer.retrieve.2.json
@@ -0,0 +1,80 @@
+{
+ "address": null,
+ "balance": 0,
+ "created": 1708574643,
+ "currency": null,
+ "default_currency": null,
+ "default_source": null,
+ "delinquent": false,
+ "description": "demo.example.com 6cde5f7a-1f7",
+ "discount": null,
+ "email": "[email protected]",
+ "id": "cus_PbgtpRvLU7dw2y",
+ "invoice_prefix": "CE82FB85",
+ "invoice_settings": {
+ "custom_fields": null,
+ "default_payment_method": {
+ "billing_details": {
+ "address": {
+ "city": null,
+ "country": null,
+ "line1": null,
+ "line2": null,
+ "postal_code": null,
+ "state": null
+ },
+ "email": null,
+ "name": null,
+ "phone": null
+ },
+ "card": {
+ "brand": "visa",
+ "checks": {
+ "address_line1_check": null,
+ "address_postal_code_check": null,
+ "cvc_check": "pass"
+ },
+ "country": "US",
+ "display_brand": "visa",
+ "exp_month": 2,
+ "exp_year": 2025,
+ "fingerprint": "9XKsMixKBi6kIIzd",
+ "funding": "credit",
+ "generated_from": null,
+ "last4": "4242",
+ "networks": {
+ "available": [
+ "visa"
+ ],
+ "preferred": null
+ },
+ "three_d_secure_usage": {
+ "supported": true
+ },
+ "wallet": null
+ },
+ "created": 1708574645,
+ "customer": "cus_PbgtpRvLU7dw2y",
+ "id": "pm_1OmTVwDEQaroqDjsJyP28EtN",
+ "livemode": false,
+ "metadata": {},
+ "object": "payment_method",
+ "type": "card"
+ },
+ "footer": null,
+ "rendering_options": null
+ },
+ "livemode": false,
+ "metadata": {
+ "remote_server_str": "demo.example.com 6cde5f7a-1f7",
+ "remote_server_uuid": "6cde5f7a-1f7e-4978-9716-49f69ebfc9fe"
+ },
+ "name": null,
+ "next_invoice_sequence": 1,
+ "object": "customer",
+ "phone": null,
+ "preferred_locales": [],
+ "shipping": null,
+ "tax_exempt": "none",
+ "test_clock": null
+}
diff --git a/corporate/tests/stripe_fixtures/free_trial_not_available_for_active_legacy_customer--Customer.retrieve.3.json b/corporate/tests/stripe_fixtures/free_trial_not_available_for_active_legacy_customer--Customer.retrieve.3.json
new file mode 100644
index 00000000000..ff8e652ab1f
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/free_trial_not_available_for_active_legacy_customer--Customer.retrieve.3.json
@@ -0,0 +1,80 @@
+{
+ "address": null,
+ "balance": 0,
+ "created": 1708574643,
+ "currency": null,
+ "default_currency": null,
+ "default_source": null,
+ "delinquent": false,
+ "description": "demo.example.com 6cde5f7a-1f7",
+ "discount": null,
+ "email": "[email protected]",
+ "id": "cus_PbgtpRvLU7dw2y",
+ "invoice_prefix": "CE82FB85",
+ "invoice_settings": {
+ "custom_fields": null,
+ "default_payment_method": {
+ "billing_details": {
+ "address": {
+ "city": null,
+ "country": null,
+ "line1": null,
+ "line2": null,
+ "postal_code": null,
+ "state": null
+ },
+ "email": null,
+ "name": null,
+ "phone": null
+ },
+ "card": {
+ "brand": "visa",
+ "checks": {
+ "address_line1_check": null,
+ "address_postal_code_check": null,
+ "cvc_check": "pass"
+ },
+ "country": "US",
+ "display_brand": "visa",
+ "exp_month": 2,
+ "exp_year": 2025,
+ "fingerprint": "9XKsMixKBi6kIIzd",
+ "funding": "credit",
+ "generated_from": null,
+ "last4": "4242",
+ "networks": {
+ "available": [
+ "visa"
+ ],
+ "preferred": null
+ },
+ "three_d_secure_usage": {
+ "supported": true
+ },
+ "wallet": null
+ },
+ "created": 1708574645,
+ "customer": "cus_PbgtpRvLU7dw2y",
+ "id": "pm_1OmTVwDEQaroqDjsJyP28EtN",
+ "livemode": false,
+ "metadata": {},
+ "object": "payment_method",
+ "type": "card"
+ },
+ "footer": null,
+ "rendering_options": null
+ },
+ "livemode": false,
+ "metadata": {
+ "remote_server_str": "demo.example.com 6cde5f7a-1f7",
+ "remote_server_uuid": "6cde5f7a-1f7e-4978-9716-49f69ebfc9fe"
+ },
+ "name": null,
+ "next_invoice_sequence": 1,
+ "object": "customer",
+ "phone": null,
+ "preferred_locales": [],
+ "shipping": null,
+ "tax_exempt": "none",
+ "test_clock": null
+}
diff --git a/corporate/tests/stripe_fixtures/free_trial_not_available_for_active_legacy_customer--Customer.retrieve.4.json b/corporate/tests/stripe_fixtures/free_trial_not_available_for_active_legacy_customer--Customer.retrieve.4.json
new file mode 100644
index 00000000000..ff8e652ab1f
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/free_trial_not_available_for_active_legacy_customer--Customer.retrieve.4.json
@@ -0,0 +1,80 @@
+{
+ "address": null,
+ "balance": 0,
+ "created": 1708574643,
+ "currency": null,
+ "default_currency": null,
+ "default_source": null,
+ "delinquent": false,
+ "description": "demo.example.com 6cde5f7a-1f7",
+ "discount": null,
+ "email": "[email protected]",
+ "id": "cus_PbgtpRvLU7dw2y",
+ "invoice_prefix": "CE82FB85",
+ "invoice_settings": {
+ "custom_fields": null,
+ "default_payment_method": {
+ "billing_details": {
+ "address": {
+ "city": null,
+ "country": null,
+ "line1": null,
+ "line2": null,
+ "postal_code": null,
+ "state": null
+ },
+ "email": null,
+ "name": null,
+ "phone": null
+ },
+ "card": {
+ "brand": "visa",
+ "checks": {
+ "address_line1_check": null,
+ "address_postal_code_check": null,
+ "cvc_check": "pass"
+ },
+ "country": "US",
+ "display_brand": "visa",
+ "exp_month": 2,
+ "exp_year": 2025,
+ "fingerprint": "9XKsMixKBi6kIIzd",
+ "funding": "credit",
+ "generated_from": null,
+ "last4": "4242",
+ "networks": {
+ "available": [
+ "visa"
+ ],
+ "preferred": null
+ },
+ "three_d_secure_usage": {
+ "supported": true
+ },
+ "wallet": null
+ },
+ "created": 1708574645,
+ "customer": "cus_PbgtpRvLU7dw2y",
+ "id": "pm_1OmTVwDEQaroqDjsJyP28EtN",
+ "livemode": false,
+ "metadata": {},
+ "object": "payment_method",
+ "type": "card"
+ },
+ "footer": null,
+ "rendering_options": null
+ },
+ "livemode": false,
+ "metadata": {
+ "remote_server_str": "demo.example.com 6cde5f7a-1f7",
+ "remote_server_uuid": "6cde5f7a-1f7e-4978-9716-49f69ebfc9fe"
+ },
+ "name": null,
+ "next_invoice_sequence": 1,
+ "object": "customer",
+ "phone": null,
+ "preferred_locales": [],
+ "shipping": null,
+ "tax_exempt": "none",
+ "test_clock": null
+}
diff --git a/corporate/tests/stripe_fixtures/free_trial_not_available_for_active_legacy_customer--Customer.retrieve.5.json b/corporate/tests/stripe_fixtures/free_trial_not_available_for_active_legacy_customer--Customer.retrieve.5.json
new file mode 100644
index 00000000000..9589e51048f
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/free_trial_not_available_for_active_legacy_customer--Customer.retrieve.5.json
@@ -0,0 +1,80 @@
+{
+ "address": null,
+ "balance": 0,
+ "created": 1708574643,
+ "currency": "usd",
+ "default_currency": "usd",
+ "default_source": null,
+ "delinquent": false,
+ "description": "demo.example.com 6cde5f7a-1f7",
+ "discount": null,
+ "email": "[email protected]",
+ "id": "cus_PbgtpRvLU7dw2y",
+ "invoice_prefix": "CE82FB85",
+ "invoice_settings": {
+ "custom_fields": null,
+ "default_payment_method": {
+ "billing_details": {
+ "address": {
+ "city": null,
+ "country": null,
+ "line1": null,
+ "line2": null,
+ "postal_code": null,
+ "state": null
+ },
+ "email": null,
+ "name": null,
+ "phone": null
+ },
+ "card": {
+ "brand": "visa",
+ "checks": {
+ "address_line1_check": null,
+ "address_postal_code_check": null,
+ "cvc_check": "pass"
+ },
+ "country": "US",
+ "display_brand": "visa",
+ "exp_month": 2,
+ "exp_year": 2025,
+ "fingerprint": "9XKsMixKBi6kIIzd",
+ "funding": "credit",
+ "generated_from": null,
+ "last4": "4242",
+ "networks": {
+ "available": [
+ "visa"
+ ],
+ "preferred": null
+ },
+ "three_d_secure_usage": {
+ "supported": true
+ },
+ "wallet": null
+ },
+ "created": 1708574645,
+ "customer": "cus_PbgtpRvLU7dw2y",
+ "id": "pm_1OmTVwDEQaroqDjsJyP28EtN",
+ "livemode": false,
+ "metadata": {},
+ "object": "payment_method",
+ "type": "card"
+ },
+ "footer": null,
+ "rendering_options": null
+ },
+ "livemode": false,
+ "metadata": {
+ "remote_server_str": "demo.example.com 6cde5f7a-1f7",
+ "remote_server_uuid": "6cde5f7a-1f7e-4978-9716-49f69ebfc9fe"
+ },
+ "name": null,
+ "next_invoice_sequence": 2,
+ "object": "customer",
+ "phone": null,
+ "preferred_locales": [],
+ "shipping": null,
+ "tax_exempt": "none",
+ "test_clock": null
+}
diff --git a/corporate/tests/stripe_fixtures/free_trial_not_available_for_active_legacy_customer--Event.list.1.json b/corporate/tests/stripe_fixtures/free_trial_not_available_for_active_legacy_customer--Event.list.1.json
new file mode 100644
index 00000000000..cc07d736e64
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/free_trial_not_available_for_active_legacy_customer--Event.list.1.json
@@ -0,0 +1,60 @@
+{
+ "data": [
+ {
+ "api_version": "2020-08-27",
+ "created": 1708574646,
+ "data": {
+ "object": {
+ "address": null,
+ "balance": 0,
+ "created": 1708574643,
+ "currency": null,
+ "default_currency": null,
+ "default_source": null,
+ "delinquent": false,
+ "description": "demo.example.com 6cde5f7a-1f7",
+ "discount": null,
+ "email": "[email protected]",
+ "id": "cus_PbgtpRvLU7dw2y",
+ "invoice_prefix": "CE82FB85",
+ "invoice_settings": {
+ "custom_fields": null,
+ "default_payment_method": "pm_1OmTVwDEQaroqDjsJyP28EtN",
+ "footer": null,
+ "rendering_options": null
+ },
+ "livemode": false,
+ "metadata": {
+ "remote_server_str": "demo.example.com 6cde5f7a-1f7",
+ "remote_server_uuid": "6cde5f7a-1f7e-4978-9716-49f69ebfc9fe"
+ },
+ "name": null,
+ "next_invoice_sequence": 1,
+ "object": "customer",
+ "phone": null,
+ "preferred_locales": [],
+ "shipping": null,
+ "tax_exempt": "none",
+ "test_clock": null
+ },
+ "previous_attributes": {
+ "invoice_settings": {
+ "default_payment_method": null
+ }
+ }
+ },
+ "id": "evt_1OmTVyDEQaroqDjs0kzvdGzA",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_NUorH7PLSlHBBY",
+ "idempotency_key": "260de422-5ad7-42f4-b4a7-5882696a655f"
+ },
+ "type": "customer.updated"
+ }
+ ],
+ "has_more": true,
+ "object": "list",
+ "url": "/v1/events"
+}
diff --git a/corporate/tests/stripe_fixtures/free_trial_not_available_for_active_legacy_customer--Event.list.2.json b/corporate/tests/stripe_fixtures/free_trial_not_available_for_active_legacy_customer--Event.list.2.json
new file mode 100644
index 00000000000..4a4ef298ac7
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/free_trial_not_available_for_active_legacy_customer--Event.list.2.json
@@ -0,0 +1,1170 @@
+{
+ "data": [
+ {
+ "api_version": "2020-08-27",
+ "created": 1708574653,
+ "data": {
+ "object": {
+ "amount": 4300,
+ "amount_capturable": 0,
+ "amount_details": {
+ "tip": {}
+ },
+ "amount_received": 4300,
+ "application": null,
+ "application_fee_amount": null,
+ "automatic_payment_methods": null,
+ "canceled_at": null,
+ "cancellation_reason": null,
+ "capture_method": "automatic",
+ "charges": {
+ "data": [
+ {
+ "amount": 4300,
+ "amount_captured": 4300,
+ "amount_refunded": 0,
+ "application": null,
+ "application_fee": null,
+ "application_fee_amount": null,
+ "balance_transaction": "txn_3OmTW2DEQaroqDjs0q8IIZDA",
+ "billing_details": {
+ "address": {
+ "city": null,
+ "country": null,
+ "line1": null,
+ "line2": null,
+ "postal_code": null,
+ "state": null
+ },
+ "email": null,
+ "name": null,
+ "phone": null
+ },
+ "calculated_statement_descriptor": "ZULIP BASIC",
+ "captured": true,
+ "created": 1708574652,
+ "currency": "usd",
+ "customer": "cus_PbgtpRvLU7dw2y",
+ "description": "Payment for Invoice",
+ "destination": null,
+ "dispute": null,
+ "disputed": false,
+ "failure_balance_transaction": null,
+ "failure_code": null,
+ "failure_message": null,
+ "fraud_details": {},
+ "id": "ch_3OmTW2DEQaroqDjs0JhLZpBZ",
+ "invoice": "in_1OmTW1DEQaroqDjspHLgWNFX",
+ "livemode": false,
+ "metadata": {},
+ "object": "charge",
+ "on_behalf_of": null,
+ "order": null,
+ "outcome": {
+ "network_status": "approved_by_network",
+ "reason": null,
+ "risk_level": "normal",
+ "risk_score": 50,
+ "seller_message": "Payment complete.",
+ "type": "authorized"
+ },
+ "paid": true,
+ "payment_intent": "pi_3OmTW2DEQaroqDjs06cY7wx8",
+ "payment_method": "pm_1OmTVwDEQaroqDjsJyP28EtN",
+ "payment_method_details": {
+ "card": {
+ "amount_authorized": 4300,
+ "brand": "visa",
+ "checks": {
+ "address_line1_check": null,
+ "address_postal_code_check": null,
+ "cvc_check": "pass"
+ },
+ "country": "US",
+ "exp_month": 2,
+ "exp_year": 2025,
+ "extended_authorization": {
+ "status": "disabled"
+ },
+ "fingerprint": "9XKsMixKBi6kIIzd",
+ "funding": "credit",
+ "incremental_authorization": {
+ "status": "unavailable"
+ },
+ "installments": null,
+ "last4": "4242",
+ "mandate": null,
+ "multicapture": {
+ "status": "unavailable"
+ },
+ "network": "visa",
+ "network_token": {
+ "used": false
+ },
+ "overcapture": {
+ "maximum_amount_capturable": 4300,
+ "status": "unavailable"
+ },
+ "three_d_secure": null,
+ "wallet": null
+ },
+ "type": "card"
+ },
+ "radar_options": {},
+ "receipt_email": "[email protected]",
+ "receipt_number": null,
+ "receipt_url": "https://pay.stripe.com/receipts/invoices/CAcaFwoVYWNjdF8xN3ZUa3dERVFhcm9xRGpzKL2P264GMgbnCVcM0YU6LBa3Z-u0eDoKXCA8Caz9OMr1QAmBM2nMpQUYdA170RudshYisr3kmcov1ciL?s=ap",
+ "refunded": false,
+ "refunds": {
+ "data": [],
+ "has_more": false,
+ "object": "list",
+ "total_count": 0,
+ "url": "/v1/charges/ch_3OmTW2DEQaroqDjs0JhLZpBZ/refunds"
+ },
+ "review": null,
+ "shipping": null,
+ "source": null,
+ "source_transfer": null,
+ "statement_descriptor": "Zulip Basic",
+ "statement_descriptor_suffix": null,
+ "status": "succeeded",
+ "transfer_data": null,
+ "transfer_group": null
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 1,
+ "url": "/v1/charges?payment_intent=pi_3OmTW2DEQaroqDjs06cY7wx8"
+ },
+ "client_secret": "pi_3OmTW2DEQaroqDjs06cY7wx8_secret_cCYl984T16p3RocGv0CR4L4hr",
+ "confirmation_method": "automatic",
+ "created": 1708574650,
+ "currency": "usd",
+ "customer": "cus_PbgtpRvLU7dw2y",
+ "description": "Payment for Invoice",
+ "id": "pi_3OmTW2DEQaroqDjs06cY7wx8",
+ "invoice": "in_1OmTW1DEQaroqDjspHLgWNFX",
+ "last_payment_error": null,
+ "latest_charge": "ch_3OmTW2DEQaroqDjs0JhLZpBZ",
+ "livemode": false,
+ "metadata": {},
+ "next_action": null,
+ "object": "payment_intent",
+ "on_behalf_of": null,
+ "payment_method": "pm_1OmTVwDEQaroqDjsJyP28EtN",
+ "payment_method_configuration_details": null,
+ "payment_method_options": {
+ "card": {
+ "installments": null,
+ "mandate_options": null,
+ "network": null,
+ "request_three_d_secure": "automatic"
+ },
+ "cashapp": {}
+ },
+ "payment_method_types": [
+ "card",
+ "cashapp"
+ ],
+ "processing": null,
+ "receipt_email": "[email protected]",
+ "review": null,
+ "setup_future_usage": null,
+ "shipping": null,
+ "source": null,
+ "statement_descriptor": "Zulip Basic",
+ "statement_descriptor_suffix": null,
+ "status": "succeeded",
+ "transfer_data": null,
+ "transfer_group": null
+ }
+ },
+ "id": "evt_3OmTW2DEQaroqDjs0Dbd1Q5W",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 2,
+ "request": {
+ "id": "req_IRkeaSVXnoyEy6",
+ "idempotency_key": "e5794a90-7ce9-4b61-ab21-2b1b12f9bf5f"
+ },
+ "type": "payment_intent.succeeded"
+ },
+ {
+ "api_version": "2020-08-27",
+ "created": 1708574650,
+ "data": {
+ "object": {
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 4300,
+ "amount_paid": 0,
+ "amount_remaining": 4300,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 0,
+ "attempted": false,
+ "auto_advance": false,
+ "automatic_tax": {
+ "enabled": false,
+ "liability": null,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": null,
+ "collection_method": "charge_automatically",
+ "created": 1708574649,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_PbgtpRvLU7dw2y",
+ "customer_address": null,
+ "customer_email": "[email protected]",
+ "customer_name": null,
+ "customer_phone": null,
+ "customer_shipping": null,
+ "customer_tax_exempt": "none",
+ "customer_tax_ids": [],
+ "default_payment_method": null,
+ "default_source": null,
+ "default_tax_rates": [],
+ "description": null,
+ "discount": null,
+ "discounts": [],
+ "due_date": null,
+ "effective_at": 1708574650,
+ "ending_balance": 0,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QYmd0NURPMDcwMkVvRGk5VTY2dmFPQUYwSkV3NkZ2LDk5MTE1NDUx02009heDswuh?s=ap",
+ "id": "in_1OmTW1DEQaroqDjspHLgWNFX",
+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QYmd0NURPMDcwMkVvRGk5VTY2dmFPQUYwSkV3NkZ2LDk5MTE1NDUx02009heDswuh/pdf?s=ap",
+ "issuer": {
+ "type": "self"
+ },
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": -2000,
+ "amount_excluding_tax": -2000,
+ "currency": "usd",
+ "description": "$20.00/month new customer discount",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1OmTW1DEQaroqDjsC6oWJTrH",
+ "invoice": "in_1OmTW1DEQaroqDjspHLgWNFX",
+ "invoice_item": "ii_1OmTW1DEQaroqDjsD0TgVZRd",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1708574649,
+ "start": 1708574649
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1704886320,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OX00qDEQaroqDjst0aTUdZR",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PLhPbuhP0lDy6A",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -2000,
+ "unit_amount_decimal": "-2000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-2000"
+ },
+ {
+ "amount": 6300,
+ "amount_excluding_tax": 6300,
+ "currency": "usd",
+ "description": "Zulip Basic",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1OmTW2DEQaroqDjsKycfOgbF",
+ "invoice": "in_1OmTW1DEQaroqDjspHLgWNFX",
+ "invoice_item": "ii_1OmTW1DEQaroqDjsWpzVeBTI",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1708574649,
+ "start": 1708574649
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1702995208,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OP432DEQaroqDjsMeew3eg5",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PDUwJ9ZgTQzjad",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 350,
+ "unit_amount_decimal": "350"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 18,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "350"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 2,
+ "url": "/v1/invoices/in_1OmTW1DEQaroqDjspHLgWNFX/lines"
+ },
+ "livemode": false,
+ "metadata": {
+ "billing_schedule": "2",
+ "license_management": "automatic",
+ "licenses": "18",
+ "plan_tier": "103"
+ },
+ "next_payment_attempt": null,
+ "number": "CE82FB85-0001",
+ "object": "invoice",
+ "on_behalf_of": null,
+ "paid": false,
+ "paid_out_of_band": false,
+ "payment_intent": "pi_3OmTW2DEQaroqDjs06cY7wx8",
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1708574649,
+ "period_start": 1708574649,
+ "post_payment_credit_notes_amount": 0,
+ "pre_payment_credit_notes_amount": 0,
+ "quote": null,
+ "receipt_number": null,
+ "rendering": {
+ "amount_tax_display": null,
+ "pdf": {
+ "page_size": "letter"
+ }
+ },
+ "rendering_options": null,
+ "shipping_cost": null,
+ "shipping_details": null,
+ "starting_balance": 0,
+ "statement_descriptor": "Zulip Basic",
+ "status": "open",
+ "status_transitions": {
+ "finalized_at": 1708574650,
+ "marked_uncollectible_at": null,
+ "paid_at": null,
+ "voided_at": null
+ },
+ "subscription": null,
+ "subscription_details": {
+ "metadata": null
+ },
+ "subtotal": 4300,
+ "subtotal_excluding_tax": 4300,
+ "tax": null,
+ "test_clock": null,
+ "total": 4300,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 4300,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": null
+ }
+ },
+ "id": "evt_1OmTW3DEQaroqDjs3MQXpk1m",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_bpTTnLloxTSXrj",
+ "idempotency_key": "3fe1f219-8245-4621-879a-8df4eb51ec18"
+ },
+ "type": "invoice.finalized"
+ },
+ {
+ "api_version": "2020-08-27",
+ "created": 1708574650,
+ "data": {
+ "object": {
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 4300,
+ "amount_paid": 0,
+ "amount_remaining": 4300,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 0,
+ "attempted": false,
+ "auto_advance": false,
+ "automatic_tax": {
+ "enabled": false,
+ "liability": null,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": null,
+ "collection_method": "charge_automatically",
+ "created": 1708574649,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_PbgtpRvLU7dw2y",
+ "customer_address": null,
+ "customer_email": "[email protected]",
+ "customer_name": null,
+ "customer_phone": null,
+ "customer_shipping": null,
+ "customer_tax_exempt": "none",
+ "customer_tax_ids": [],
+ "default_payment_method": null,
+ "default_source": null,
+ "default_tax_rates": [],
+ "description": null,
+ "discount": null,
+ "discounts": [],
+ "due_date": null,
+ "effective_at": 1708574650,
+ "ending_balance": 0,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QYmd0NURPMDcwMkVvRGk5VTY2dmFPQUYwSkV3NkZ2LDk5MTE1NDUx02009heDswuh?s=ap",
+ "id": "in_1OmTW1DEQaroqDjspHLgWNFX",
+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QYmd0NURPMDcwMkVvRGk5VTY2dmFPQUYwSkV3NkZ2LDk5MTE1NDUx02009heDswuh/pdf?s=ap",
+ "issuer": {
+ "type": "self"
+ },
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": -2000,
+ "amount_excluding_tax": -2000,
+ "currency": "usd",
+ "description": "$20.00/month new customer discount",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1OmTW1DEQaroqDjsC6oWJTrH",
+ "invoice": "in_1OmTW1DEQaroqDjspHLgWNFX",
+ "invoice_item": "ii_1OmTW1DEQaroqDjsD0TgVZRd",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1708574649,
+ "start": 1708574649
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1704886320,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OX00qDEQaroqDjst0aTUdZR",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PLhPbuhP0lDy6A",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -2000,
+ "unit_amount_decimal": "-2000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-2000"
+ },
+ {
+ "amount": 6300,
+ "amount_excluding_tax": 6300,
+ "currency": "usd",
+ "description": "Zulip Basic",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1OmTW2DEQaroqDjsKycfOgbF",
+ "invoice": "in_1OmTW1DEQaroqDjspHLgWNFX",
+ "invoice_item": "ii_1OmTW1DEQaroqDjsWpzVeBTI",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1708574649,
+ "start": 1708574649
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1702995208,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OP432DEQaroqDjsMeew3eg5",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PDUwJ9ZgTQzjad",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 350,
+ "unit_amount_decimal": "350"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 18,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "350"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 2,
+ "url": "/v1/invoices/in_1OmTW1DEQaroqDjspHLgWNFX/lines"
+ },
+ "livemode": false,
+ "metadata": {
+ "billing_schedule": "2",
+ "license_management": "automatic",
+ "licenses": "18",
+ "plan_tier": "103"
+ },
+ "next_payment_attempt": null,
+ "number": "CE82FB85-0001",
+ "object": "invoice",
+ "on_behalf_of": null,
+ "paid": false,
+ "paid_out_of_band": false,
+ "payment_intent": "pi_3OmTW2DEQaroqDjs06cY7wx8",
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1708574649,
+ "period_start": 1708574649,
+ "post_payment_credit_notes_amount": 0,
+ "pre_payment_credit_notes_amount": 0,
+ "quote": null,
+ "receipt_number": null,
+ "rendering": {
+ "amount_tax_display": null,
+ "pdf": {
+ "page_size": "letter"
+ }
+ },
+ "rendering_options": null,
+ "shipping_cost": null,
+ "shipping_details": null,
+ "starting_balance": 0,
+ "statement_descriptor": "Zulip Basic",
+ "status": "open",
+ "status_transitions": {
+ "finalized_at": 1708574650,
+ "marked_uncollectible_at": null,
+ "paid_at": null,
+ "voided_at": null
+ },
+ "subscription": null,
+ "subscription_details": {
+ "metadata": null
+ },
+ "subtotal": 4300,
+ "subtotal_excluding_tax": 4300,
+ "tax": null,
+ "test_clock": null,
+ "total": 4300,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 4300,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": null
+ },
+ "previous_attributes": {
+ "effective_at": null,
+ "ending_balance": null,
+ "hosted_invoice_url": null,
+ "invoice_pdf": null,
+ "number": null,
+ "payment_intent": null,
+ "rendering": {
+ "pdf": {
+ "page_size": "auto"
+ }
+ },
+ "status": "draft",
+ "status_transitions": {
+ "finalized_at": null
+ }
+ }
+ },
+ "id": "evt_1OmTW3DEQaroqDjsGPan8tQ6",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_bpTTnLloxTSXrj",
+ "idempotency_key": "3fe1f219-8245-4621-879a-8df4eb51ec18"
+ },
+ "type": "invoice.updated"
+ },
+ {
+ "api_version": "2020-08-27",
+ "created": 1708574650,
+ "data": {
+ "object": {
+ "amount": 4300,
+ "amount_capturable": 0,
+ "amount_details": {
+ "tip": {}
+ },
+ "amount_received": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "automatic_payment_methods": null,
+ "canceled_at": null,
+ "cancellation_reason": null,
+ "capture_method": "automatic",
+ "charges": {
+ "data": [],
+ "has_more": false,
+ "object": "list",
+ "total_count": 0,
+ "url": "/v1/charges?payment_intent=pi_3OmTW2DEQaroqDjs06cY7wx8"
+ },
+ "client_secret": "pi_3OmTW2DEQaroqDjs06cY7wx8_secret_cCYl984T16p3RocGv0CR4L4hr",
+ "confirmation_method": "automatic",
+ "created": 1708574650,
+ "currency": "usd",
+ "customer": "cus_PbgtpRvLU7dw2y",
+ "description": "Payment for Invoice",
+ "id": "pi_3OmTW2DEQaroqDjs06cY7wx8",
+ "invoice": "in_1OmTW1DEQaroqDjspHLgWNFX",
+ "last_payment_error": null,
+ "latest_charge": null,
+ "livemode": false,
+ "metadata": {},
+ "next_action": null,
+ "object": "payment_intent",
+ "on_behalf_of": null,
+ "payment_method": null,
+ "payment_method_configuration_details": null,
+ "payment_method_options": {
+ "card": {
+ "installments": null,
+ "mandate_options": null,
+ "network": null,
+ "request_three_d_secure": "automatic"
+ },
+ "cashapp": {}
+ },
+ "payment_method_types": [
+ "card",
+ "cashapp"
+ ],
+ "processing": null,
+ "receipt_email": "[email protected]",
+ "review": null,
+ "setup_future_usage": null,
+ "shipping": null,
+ "source": null,
+ "statement_descriptor": "Zulip Basic",
+ "statement_descriptor_suffix": null,
+ "status": "requires_payment_method",
+ "transfer_data": null,
+ "transfer_group": null
+ }
+ },
+ "id": "evt_3OmTW2DEQaroqDjs0WY2U9va",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_bpTTnLloxTSXrj",
+ "idempotency_key": "3fe1f219-8245-4621-879a-8df4eb51ec18"
+ },
+ "type": "payment_intent.created"
+ },
+ {
+ "api_version": "2020-08-27",
+ "created": 1708574650,
+ "data": {
+ "object": {
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 4300,
+ "amount_paid": 0,
+ "amount_remaining": 4300,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 0,
+ "attempted": false,
+ "auto_advance": false,
+ "automatic_tax": {
+ "enabled": false,
+ "liability": null,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": null,
+ "collection_method": "charge_automatically",
+ "created": 1708574649,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_PbgtpRvLU7dw2y",
+ "customer_address": null,
+ "customer_email": "[email protected]",
+ "customer_name": null,
+ "customer_phone": null,
+ "customer_shipping": null,
+ "customer_tax_exempt": "none",
+ "customer_tax_ids": [],
+ "default_payment_method": null,
+ "default_source": null,
+ "default_tax_rates": [],
+ "description": null,
+ "discount": null,
+ "discounts": [],
+ "due_date": null,
+ "effective_at": null,
+ "ending_balance": null,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": null,
+ "id": "in_1OmTW1DEQaroqDjspHLgWNFX",
+ "invoice_pdf": null,
+ "issuer": {
+ "type": "self"
+ },
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": -2000,
+ "amount_excluding_tax": -2000,
+ "currency": "usd",
+ "description": "$20.00/month new customer discount",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1OmTW1DEQaroqDjsC6oWJTrH",
+ "invoice": "in_1OmTW1DEQaroqDjspHLgWNFX",
+ "invoice_item": "ii_1OmTW1DEQaroqDjsD0TgVZRd",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1708574649,
+ "start": 1708574649
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1704886320,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OX00qDEQaroqDjst0aTUdZR",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PLhPbuhP0lDy6A",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -2000,
+ "unit_amount_decimal": "-2000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-2000"
+ },
+ {
+ "amount": 6300,
+ "amount_excluding_tax": 6300,
+ "currency": "usd",
+ "description": "Zulip Basic",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1OmTW2DEQaroqDjsKycfOgbF",
+ "invoice": "in_1OmTW1DEQaroqDjspHLgWNFX",
+ "invoice_item": "ii_1OmTW1DEQaroqDjsWpzVeBTI",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1708574649,
+ "start": 1708574649
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1702995208,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OP432DEQaroqDjsMeew3eg5",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PDUwJ9ZgTQzjad",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 350,
+ "unit_amount_decimal": "350"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 18,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "350"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 2,
+ "url": "/v1/invoices/in_1OmTW1DEQaroqDjspHLgWNFX/lines"
+ },
+ "livemode": false,
+ "metadata": {
+ "billing_schedule": "2",
+ "license_management": "automatic",
+ "licenses": "18",
+ "plan_tier": "103"
+ },
+ "next_payment_attempt": null,
+ "number": null,
+ "object": "invoice",
+ "on_behalf_of": null,
+ "paid": false,
+ "paid_out_of_band": false,
+ "payment_intent": null,
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1708574649,
+ "period_start": 1708574649,
+ "post_payment_credit_notes_amount": 0,
+ "pre_payment_credit_notes_amount": 0,
+ "quote": null,
+ "receipt_number": null,
+ "rendering": {
+ "amount_tax_display": null,
+ "pdf": {
+ "page_size": "auto"
+ }
+ },
+ "rendering_options": null,
+ "shipping_cost": null,
+ "shipping_details": null,
+ "starting_balance": 0,
+ "statement_descriptor": "Zulip Basic",
+ "status": "draft",
+ "status_transitions": {
+ "finalized_at": null,
+ "marked_uncollectible_at": null,
+ "paid_at": null,
+ "voided_at": null
+ },
+ "subscription": null,
+ "subscription_details": {
+ "metadata": null
+ },
+ "subtotal": 4300,
+ "subtotal_excluding_tax": 4300,
+ "tax": null,
+ "test_clock": null,
+ "total": 4300,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 4300,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": null
+ }
+ },
+ "id": "evt_1OmTW2DEQaroqDjstAdcSpYl",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_YiRGgSs1veUiuK",
+ "idempotency_key": "d3476951-1dd4-48f0-b936-4eded769120c"
+ },
+ "type": "invoice.created"
+ },
+ {
+ "api_version": "2020-08-27",
+ "created": 1708574649,
+ "data": {
+ "object": {
+ "amount": -2000,
+ "currency": "usd",
+ "customer": "cus_PbgtpRvLU7dw2y",
+ "date": 1708574649,
+ "description": "$20.00/month new customer discount",
+ "discountable": false,
+ "discounts": [],
+ "id": "ii_1OmTW1DEQaroqDjsD0TgVZRd",
+ "invoice": null,
+ "livemode": false,
+ "metadata": {},
+ "object": "invoiceitem",
+ "period": {
+ "end": 1708574649,
+ "start": 1708574649
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1704886320,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OX00qDEQaroqDjst0aTUdZR",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PLhPbuhP0lDy6A",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -2000,
+ "unit_amount_decimal": "-2000"
+ },
+ "proration": false,
+ "quantity": 1,
+ "subscription": null,
+ "tax_rates": [],
+ "test_clock": null,
+ "unit_amount": -2000,
+ "unit_amount_decimal": "-2000"
+ }
+ },
+ "id": "evt_1OmTW1DEQaroqDjswMxTLizE",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_2g4EYkB2vggL8e",
+ "idempotency_key": "17c05851-c9fd-4742-a1ea-2e0611da1037"
+ },
+ "type": "invoiceitem.created"
+ },
+ {
+ "api_version": "2020-08-27",
+ "created": 1708574649,
+ "data": {
+ "object": {
+ "amount": 6300,
+ "currency": "usd",
+ "customer": "cus_PbgtpRvLU7dw2y",
+ "date": 1708574649,
+ "description": "Zulip Basic",
+ "discountable": false,
+ "discounts": [],
+ "id": "ii_1OmTW1DEQaroqDjsWpzVeBTI",
+ "invoice": null,
+ "livemode": false,
+ "metadata": {},
+ "object": "invoiceitem",
+ "period": {
+ "end": 1708574649,
+ "start": 1708574649
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1702995208,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OP432DEQaroqDjsMeew3eg5",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PDUwJ9ZgTQzjad",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 350,
+ "unit_amount_decimal": "350"
+ },
+ "proration": false,
+ "quantity": 18,
+ "subscription": null,
+ "tax_rates": [],
+ "test_clock": null,
+ "unit_amount": 350,
+ "unit_amount_decimal": "350"
+ }
+ },
+ "id": "evt_1OmTW1DEQaroqDjsY8TtM7UK",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_3WOtOqqt0MrSx9",
+ "idempotency_key": "9f7d495e-c787-402e-a904-6af779480714"
+ },
+ "type": "invoiceitem.created"
+ },
+ {
+ "api_version": "2020-08-27",
+ "created": 1708574649,
+ "data": {
+ "object": {
+ "address": null,
+ "balance": 0,
+ "created": 1708574643,
+ "currency": "usd",
+ "default_currency": "usd",
+ "default_source": null,
+ "delinquent": false,
+ "description": "demo.example.com 6cde5f7a-1f7",
+ "discount": null,
+ "email": "[email protected]",
+ "id": "cus_PbgtpRvLU7dw2y",
+ "invoice_prefix": "CE82FB85",
+ "invoice_settings": {
+ "custom_fields": null,
+ "default_payment_method": "pm_1OmTVwDEQaroqDjsJyP28EtN",
+ "footer": null,
+ "rendering_options": null
+ },
+ "livemode": false,
+ "metadata": {
+ "remote_server_str": "demo.example.com 6cde5f7a-1f7",
+ "remote_server_uuid": "6cde5f7a-1f7e-4978-9716-49f69ebfc9fe"
+ },
+ "name": null,
+ "next_invoice_sequence": 1,
+ "object": "customer",
+ "phone": null,
+ "preferred_locales": [],
+ "shipping": null,
+ "tax_exempt": "none",
+ "test_clock": null
+ },
+ "previous_attributes": {
+ "currency": null,
+ "default_currency": null
+ }
+ },
+ "id": "evt_1OmTW1DEQaroqDjsoaB9Otk8",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_3WOtOqqt0MrSx9",
+ "idempotency_key": "9f7d495e-c787-402e-a904-6af779480714"
+ },
+ "type": "customer.updated"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "url": "/v1/events"
+}
diff --git a/corporate/tests/stripe_fixtures/free_trial_not_available_for_active_legacy_customer--Event.list.3.json b/corporate/tests/stripe_fixtures/free_trial_not_available_for_active_legacy_customer--Event.list.3.json
new file mode 100644
index 00000000000..8ed630ad583
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/free_trial_not_available_for_active_legacy_customer--Event.list.3.json
@@ -0,0 +1,487 @@
+{
+ "data": [
+ {
+ "api_version": "2020-08-27",
+ "created": 1708574653,
+ "data": {
+ "object": {
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 4300,
+ "amount_paid": 4300,
+ "amount_remaining": 0,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 1,
+ "attempted": true,
+ "auto_advance": false,
+ "automatic_tax": {
+ "enabled": false,
+ "liability": null,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": "ch_3OmTW2DEQaroqDjs0JhLZpBZ",
+ "collection_method": "charge_automatically",
+ "created": 1708574649,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_PbgtpRvLU7dw2y",
+ "customer_address": null,
+ "customer_email": "[email protected]",
+ "customer_name": null,
+ "customer_phone": null,
+ "customer_shipping": null,
+ "customer_tax_exempt": "none",
+ "customer_tax_ids": [],
+ "default_payment_method": null,
+ "default_source": null,
+ "default_tax_rates": [],
+ "description": null,
+ "discount": null,
+ "discounts": [],
+ "due_date": null,
+ "effective_at": 1708574650,
+ "ending_balance": 0,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QYmd0NURPMDcwMkVvRGk5VTY2dmFPQUYwSkV3NkZ2LDk5MTE1NDU00200cu8gv92d?s=ap",
+ "id": "in_1OmTW1DEQaroqDjspHLgWNFX",
+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QYmd0NURPMDcwMkVvRGk5VTY2dmFPQUYwSkV3NkZ2LDk5MTE1NDU00200cu8gv92d/pdf?s=ap",
+ "issuer": {
+ "type": "self"
+ },
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": -2000,
+ "amount_excluding_tax": -2000,
+ "currency": "usd",
+ "description": "$20.00/month new customer discount",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1OmTW1DEQaroqDjsC6oWJTrH",
+ "invoice": "in_1OmTW1DEQaroqDjspHLgWNFX",
+ "invoice_item": "ii_1OmTW1DEQaroqDjsD0TgVZRd",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1708574649,
+ "start": 1708574649
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1704886320,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OX00qDEQaroqDjst0aTUdZR",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PLhPbuhP0lDy6A",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -2000,
+ "unit_amount_decimal": "-2000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-2000"
+ },
+ {
+ "amount": 6300,
+ "amount_excluding_tax": 6300,
+ "currency": "usd",
+ "description": "Zulip Basic",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1OmTW2DEQaroqDjsKycfOgbF",
+ "invoice": "in_1OmTW1DEQaroqDjspHLgWNFX",
+ "invoice_item": "ii_1OmTW1DEQaroqDjsWpzVeBTI",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1708574649,
+ "start": 1708574649
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1702995208,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OP432DEQaroqDjsMeew3eg5",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PDUwJ9ZgTQzjad",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 350,
+ "unit_amount_decimal": "350"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 18,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "350"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 2,
+ "url": "/v1/invoices/in_1OmTW1DEQaroqDjspHLgWNFX/lines"
+ },
+ "livemode": false,
+ "metadata": {
+ "billing_schedule": "2",
+ "license_management": "automatic",
+ "licenses": "18",
+ "plan_tier": "103"
+ },
+ "next_payment_attempt": null,
+ "number": "CE82FB85-0001",
+ "object": "invoice",
+ "on_behalf_of": null,
+ "paid": true,
+ "paid_out_of_band": false,
+ "payment_intent": "pi_3OmTW2DEQaroqDjs06cY7wx8",
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1708574649,
+ "period_start": 1708574649,
+ "post_payment_credit_notes_amount": 0,
+ "pre_payment_credit_notes_amount": 0,
+ "quote": null,
+ "receipt_number": null,
+ "rendering": {
+ "amount_tax_display": null,
+ "pdf": {
+ "page_size": "letter"
+ }
+ },
+ "rendering_options": null,
+ "shipping_cost": null,
+ "shipping_details": null,
+ "starting_balance": 0,
+ "statement_descriptor": "Zulip Basic",
+ "status": "paid",
+ "status_transitions": {
+ "finalized_at": 1708574650,
+ "marked_uncollectible_at": null,
+ "paid_at": 1708574652,
+ "voided_at": null
+ },
+ "subscription": null,
+ "subscription_details": {
+ "metadata": null
+ },
+ "subtotal": 4300,
+ "subtotal_excluding_tax": 4300,
+ "tax": null,
+ "test_clock": null,
+ "total": 4300,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 4300,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": 1708574650
+ }
+ },
+ "id": "evt_1OmTW6DEQaroqDjsqzcK4Khs",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 2,
+ "request": {
+ "id": "req_IRkeaSVXnoyEy6",
+ "idempotency_key": "e5794a90-7ce9-4b61-ab21-2b1b12f9bf5f"
+ },
+ "type": "invoice.paid"
+ },
+ {
+ "api_version": "2020-08-27",
+ "created": 1708574653,
+ "data": {
+ "object": {
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 4300,
+ "amount_paid": 4300,
+ "amount_remaining": 0,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 1,
+ "attempted": true,
+ "auto_advance": false,
+ "automatic_tax": {
+ "enabled": false,
+ "liability": null,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": "ch_3OmTW2DEQaroqDjs0JhLZpBZ",
+ "collection_method": "charge_automatically",
+ "created": 1708574649,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_PbgtpRvLU7dw2y",
+ "customer_address": null,
+ "customer_email": "[email protected]",
+ "customer_name": null,
+ "customer_phone": null,
+ "customer_shipping": null,
+ "customer_tax_exempt": "none",
+ "customer_tax_ids": [],
+ "default_payment_method": null,
+ "default_source": null,
+ "default_tax_rates": [],
+ "description": null,
+ "discount": null,
+ "discounts": [],
+ "due_date": null,
+ "effective_at": 1708574650,
+ "ending_balance": 0,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QYmd0NURPMDcwMkVvRGk5VTY2dmFPQUYwSkV3NkZ2LDk5MTE1NDU00200cu8gv92d?s=ap",
+ "id": "in_1OmTW1DEQaroqDjspHLgWNFX",
+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QYmd0NURPMDcwMkVvRGk5VTY2dmFPQUYwSkV3NkZ2LDk5MTE1NDU00200cu8gv92d/pdf?s=ap",
+ "issuer": {
+ "type": "self"
+ },
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": -2000,
+ "amount_excluding_tax": -2000,
+ "currency": "usd",
+ "description": "$20.00/month new customer discount",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1OmTW1DEQaroqDjsC6oWJTrH",
+ "invoice": "in_1OmTW1DEQaroqDjspHLgWNFX",
+ "invoice_item": "ii_1OmTW1DEQaroqDjsD0TgVZRd",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1708574649,
+ "start": 1708574649
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1704886320,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OX00qDEQaroqDjst0aTUdZR",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PLhPbuhP0lDy6A",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -2000,
+ "unit_amount_decimal": "-2000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-2000"
+ },
+ {
+ "amount": 6300,
+ "amount_excluding_tax": 6300,
+ "currency": "usd",
+ "description": "Zulip Basic",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1OmTW2DEQaroqDjsKycfOgbF",
+ "invoice": "in_1OmTW1DEQaroqDjspHLgWNFX",
+ "invoice_item": "ii_1OmTW1DEQaroqDjsWpzVeBTI",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1708574649,
+ "start": 1708574649
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1702995208,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OP432DEQaroqDjsMeew3eg5",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PDUwJ9ZgTQzjad",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 350,
+ "unit_amount_decimal": "350"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 18,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "350"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 2,
+ "url": "/v1/invoices/in_1OmTW1DEQaroqDjspHLgWNFX/lines"
+ },
+ "livemode": false,
+ "metadata": {
+ "billing_schedule": "2",
+ "license_management": "automatic",
+ "licenses": "18",
+ "plan_tier": "103"
+ },
+ "next_payment_attempt": null,
+ "number": "CE82FB85-0001",
+ "object": "invoice",
+ "on_behalf_of": null,
+ "paid": true,
+ "paid_out_of_band": false,
+ "payment_intent": "pi_3OmTW2DEQaroqDjs06cY7wx8",
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1708574649,
+ "period_start": 1708574649,
+ "post_payment_credit_notes_amount": 0,
+ "pre_payment_credit_notes_amount": 0,
+ "quote": null,
+ "receipt_number": null,
+ "rendering": {
+ "amount_tax_display": null,
+ "pdf": {
+ "page_size": "letter"
+ }
+ },
+ "rendering_options": null,
+ "shipping_cost": null,
+ "shipping_details": null,
+ "starting_balance": 0,
+ "statement_descriptor": "Zulip Basic",
+ "status": "paid",
+ "status_transitions": {
+ "finalized_at": 1708574650,
+ "marked_uncollectible_at": null,
+ "paid_at": 1708574652,
+ "voided_at": null
+ },
+ "subscription": null,
+ "subscription_details": {
+ "metadata": null
+ },
+ "subtotal": 4300,
+ "subtotal_excluding_tax": 4300,
+ "tax": null,
+ "test_clock": null,
+ "total": 4300,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 4300,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": 1708574650
+ },
+ "previous_attributes": {
+ "amount_paid": 0,
+ "amount_remaining": 4300,
+ "attempt_count": 0,
+ "attempted": false,
+ "charge": null,
+ "paid": false,
+ "status": "open",
+ "status_transitions": {
+ "paid_at": null
+ }
+ }
+ },
+ "id": "evt_1OmTW6DEQaroqDjszIxPnptf",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_IRkeaSVXnoyEy6",
+ "idempotency_key": "e5794a90-7ce9-4b61-ab21-2b1b12f9bf5f"
+ },
+ "type": "invoice.updated"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "url": "/v1/events"
+}
diff --git a/corporate/tests/stripe_fixtures/free_trial_not_available_for_active_legacy_customer--Event.list.4.json b/corporate/tests/stripe_fixtures/free_trial_not_available_for_active_legacy_customer--Event.list.4.json
new file mode 100644
index 00000000000..8fcbc7d4b8e
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/free_trial_not_available_for_active_legacy_customer--Event.list.4.json
@@ -0,0 +1,241 @@
+{
+ "data": [
+ {
+ "api_version": "2020-08-27",
+ "created": 1708574653,
+ "data": {
+ "object": {
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 4300,
+ "amount_paid": 4300,
+ "amount_remaining": 0,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 1,
+ "attempted": true,
+ "auto_advance": false,
+ "automatic_tax": {
+ "enabled": false,
+ "liability": null,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": "ch_3OmTW2DEQaroqDjs0JhLZpBZ",
+ "collection_method": "charge_automatically",
+ "created": 1708574649,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_PbgtpRvLU7dw2y",
+ "customer_address": null,
+ "customer_email": "[email protected]",
+ "customer_name": null,
+ "customer_phone": null,
+ "customer_shipping": null,
+ "customer_tax_exempt": "none",
+ "customer_tax_ids": [],
+ "default_payment_method": null,
+ "default_source": null,
+ "default_tax_rates": [],
+ "description": null,
+ "discount": null,
+ "discounts": [],
+ "due_date": null,
+ "effective_at": 1708574650,
+ "ending_balance": 0,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QYmd0NURPMDcwMkVvRGk5VTY2dmFPQUYwSkV3NkZ2LDk5MTE1NDU00200cu8gv92d?s=ap",
+ "id": "in_1OmTW1DEQaroqDjspHLgWNFX",
+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QYmd0NURPMDcwMkVvRGk5VTY2dmFPQUYwSkV3NkZ2LDk5MTE1NDU00200cu8gv92d/pdf?s=ap",
+ "issuer": {
+ "type": "self"
+ },
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": -2000,
+ "amount_excluding_tax": -2000,
+ "currency": "usd",
+ "description": "$20.00/month new customer discount",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1OmTW1DEQaroqDjsC6oWJTrH",
+ "invoice": "in_1OmTW1DEQaroqDjspHLgWNFX",
+ "invoice_item": "ii_1OmTW1DEQaroqDjsD0TgVZRd",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1708574649,
+ "start": 1708574649
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1704886320,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OX00qDEQaroqDjst0aTUdZR",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PLhPbuhP0lDy6A",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -2000,
+ "unit_amount_decimal": "-2000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-2000"
+ },
+ {
+ "amount": 6300,
+ "amount_excluding_tax": 6300,
+ "currency": "usd",
+ "description": "Zulip Basic",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1OmTW2DEQaroqDjsKycfOgbF",
+ "invoice": "in_1OmTW1DEQaroqDjspHLgWNFX",
+ "invoice_item": "ii_1OmTW1DEQaroqDjsWpzVeBTI",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1708574649,
+ "start": 1708574649
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1702995208,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OP432DEQaroqDjsMeew3eg5",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PDUwJ9ZgTQzjad",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 350,
+ "unit_amount_decimal": "350"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 18,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "350"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 2,
+ "url": "/v1/invoices/in_1OmTW1DEQaroqDjspHLgWNFX/lines"
+ },
+ "livemode": false,
+ "metadata": {
+ "billing_schedule": "2",
+ "license_management": "automatic",
+ "licenses": "18",
+ "plan_tier": "103"
+ },
+ "next_payment_attempt": null,
+ "number": "CE82FB85-0001",
+ "object": "invoice",
+ "on_behalf_of": null,
+ "paid": true,
+ "paid_out_of_band": false,
+ "payment_intent": "pi_3OmTW2DEQaroqDjs06cY7wx8",
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1708574649,
+ "period_start": 1708574649,
+ "post_payment_credit_notes_amount": 0,
+ "pre_payment_credit_notes_amount": 0,
+ "quote": null,
+ "receipt_number": null,
+ "rendering": {
+ "amount_tax_display": null,
+ "pdf": {
+ "page_size": "letter"
+ }
+ },
+ "rendering_options": null,
+ "shipping_cost": null,
+ "shipping_details": null,
+ "starting_balance": 0,
+ "statement_descriptor": "Zulip Basic",
+ "status": "paid",
+ "status_transitions": {
+ "finalized_at": 1708574650,
+ "marked_uncollectible_at": null,
+ "paid_at": 1708574652,
+ "voided_at": null
+ },
+ "subscription": null,
+ "subscription_details": {
+ "metadata": null
+ },
+ "subtotal": 4300,
+ "subtotal_excluding_tax": 4300,
+ "tax": null,
+ "test_clock": null,
+ "total": 4300,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 4300,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": 1708574650
+ }
+ },
+ "id": "evt_1OmTW6DEQaroqDjsrBga4vLT",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_IRkeaSVXnoyEy6",
+ "idempotency_key": "e5794a90-7ce9-4b61-ab21-2b1b12f9bf5f"
+ },
+ "type": "invoice.payment_succeeded"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "url": "/v1/events"
+}
diff --git a/corporate/tests/stripe_fixtures/free_trial_not_available_for_active_legacy_customer--Event.list.5.json b/corporate/tests/stripe_fixtures/free_trial_not_available_for_active_legacy_customer--Event.list.5.json
new file mode 100644
index 00000000000..6d922067afe
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/free_trial_not_available_for_active_legacy_customer--Event.list.5.json
@@ -0,0 +1,6 @@
+{
+ "data": [],
+ "has_more": false,
+ "object": "list",
+ "url": "/v1/events"
+}
diff --git a/corporate/tests/stripe_fixtures/free_trial_not_available_for_active_legacy_customer--Invoice.create.1.json b/corporate/tests/stripe_fixtures/free_trial_not_available_for_active_legacy_customer--Invoice.create.1.json
new file mode 100644
index 00000000000..0b30b9a339b
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/free_trial_not_available_for_active_legacy_customer--Invoice.create.1.json
@@ -0,0 +1,219 @@
+{
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 4300,
+ "amount_paid": 0,
+ "amount_remaining": 4300,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 0,
+ "attempted": false,
+ "auto_advance": false,
+ "automatic_tax": {
+ "enabled": false,
+ "liability": null,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": null,
+ "collection_method": "charge_automatically",
+ "created": 1708574649,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_PbgtpRvLU7dw2y",
+ "customer_address": null,
+ "customer_email": "[email protected]",
+ "customer_name": null,
+ "customer_phone": null,
+ "customer_shipping": null,
+ "customer_tax_exempt": "none",
+ "customer_tax_ids": [],
+ "default_payment_method": null,
+ "default_source": null,
+ "default_tax_rates": [],
+ "description": null,
+ "discount": null,
+ "discounts": [],
+ "due_date": null,
+ "effective_at": null,
+ "ending_balance": null,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": null,
+ "id": "in_1OmTW1DEQaroqDjspHLgWNFX",
+ "invoice_pdf": null,
+ "issuer": {
+ "type": "self"
+ },
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": -2000,
+ "amount_excluding_tax": -2000,
+ "currency": "usd",
+ "description": "$20.00/month new customer discount",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1OmTW1DEQaroqDjsC6oWJTrH",
+ "invoice": "in_1OmTW1DEQaroqDjspHLgWNFX",
+ "invoice_item": "ii_1OmTW1DEQaroqDjsD0TgVZRd",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1708574649,
+ "start": 1708574649
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1704886320,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OX00qDEQaroqDjst0aTUdZR",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PLhPbuhP0lDy6A",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -2000,
+ "unit_amount_decimal": "-2000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-2000"
+ },
+ {
+ "amount": 6300,
+ "amount_excluding_tax": 6300,
+ "currency": "usd",
+ "description": "Zulip Basic",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1OmTW2DEQaroqDjsKycfOgbF",
+ "invoice": "in_1OmTW1DEQaroqDjspHLgWNFX",
+ "invoice_item": "ii_1OmTW1DEQaroqDjsWpzVeBTI",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1708574649,
+ "start": 1708574649
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1702995208,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OP432DEQaroqDjsMeew3eg5",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PDUwJ9ZgTQzjad",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 350,
+ "unit_amount_decimal": "350"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 18,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "350"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 2,
+ "url": "/v1/invoices/in_1OmTW1DEQaroqDjspHLgWNFX/lines"
+ },
+ "livemode": false,
+ "metadata": {
+ "billing_schedule": "2",
+ "license_management": "automatic",
+ "licenses": "18",
+ "plan_tier": "103"
+ },
+ "next_payment_attempt": null,
+ "number": null,
+ "object": "invoice",
+ "on_behalf_of": null,
+ "paid": false,
+ "paid_out_of_band": false,
+ "payment_intent": null,
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1708574649,
+ "period_start": 1708574649,
+ "post_payment_credit_notes_amount": 0,
+ "pre_payment_credit_notes_amount": 0,
+ "quote": null,
+ "receipt_number": null,
+ "rendering": {
+ "amount_tax_display": null,
+ "pdf": {
+ "page_size": "auto"
+ }
+ },
+ "rendering_options": null,
+ "shipping_cost": null,
+ "shipping_details": null,
+ "starting_balance": 0,
+ "statement_descriptor": "Zulip Basic",
+ "status": "draft",
+ "status_transitions": {
+ "finalized_at": null,
+ "marked_uncollectible_at": null,
+ "paid_at": null,
+ "voided_at": null
+ },
+ "subscription": null,
+ "subscription_details": {
+ "metadata": null
+ },
+ "subtotal": 4300,
+ "subtotal_excluding_tax": 4300,
+ "tax": null,
+ "test_clock": null,
+ "total": 4300,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 4300,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": null
+}
diff --git a/corporate/tests/stripe_fixtures/free_trial_not_available_for_active_legacy_customer--Invoice.finalize_invoice.1.json b/corporate/tests/stripe_fixtures/free_trial_not_available_for_active_legacy_customer--Invoice.finalize_invoice.1.json
new file mode 100644
index 00000000000..39f18ce4ce7
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/free_trial_not_available_for_active_legacy_customer--Invoice.finalize_invoice.1.json
@@ -0,0 +1,219 @@
+{
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 4300,
+ "amount_paid": 0,
+ "amount_remaining": 4300,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 0,
+ "attempted": false,
+ "auto_advance": false,
+ "automatic_tax": {
+ "enabled": false,
+ "liability": null,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": null,
+ "collection_method": "charge_automatically",
+ "created": 1708574649,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_PbgtpRvLU7dw2y",
+ "customer_address": null,
+ "customer_email": "[email protected]",
+ "customer_name": null,
+ "customer_phone": null,
+ "customer_shipping": null,
+ "customer_tax_exempt": "none",
+ "customer_tax_ids": [],
+ "default_payment_method": null,
+ "default_source": null,
+ "default_tax_rates": [],
+ "description": null,
+ "discount": null,
+ "discounts": [],
+ "due_date": null,
+ "effective_at": 1708574650,
+ "ending_balance": 0,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QYmd0NURPMDcwMkVvRGk5VTY2dmFPQUYwSkV3NkZ2LDk5MTE1NDUx02009heDswuh?s=ap",
+ "id": "in_1OmTW1DEQaroqDjspHLgWNFX",
+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QYmd0NURPMDcwMkVvRGk5VTY2dmFPQUYwSkV3NkZ2LDk5MTE1NDUx02009heDswuh/pdf?s=ap",
+ "issuer": {
+ "type": "self"
+ },
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": -2000,
+ "amount_excluding_tax": -2000,
+ "currency": "usd",
+ "description": "$20.00/month new customer discount",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1OmTW1DEQaroqDjsC6oWJTrH",
+ "invoice": "in_1OmTW1DEQaroqDjspHLgWNFX",
+ "invoice_item": "ii_1OmTW1DEQaroqDjsD0TgVZRd",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1708574649,
+ "start": 1708574649
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1704886320,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OX00qDEQaroqDjst0aTUdZR",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PLhPbuhP0lDy6A",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -2000,
+ "unit_amount_decimal": "-2000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-2000"
+ },
+ {
+ "amount": 6300,
+ "amount_excluding_tax": 6300,
+ "currency": "usd",
+ "description": "Zulip Basic",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1OmTW2DEQaroqDjsKycfOgbF",
+ "invoice": "in_1OmTW1DEQaroqDjspHLgWNFX",
+ "invoice_item": "ii_1OmTW1DEQaroqDjsWpzVeBTI",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1708574649,
+ "start": 1708574649
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1702995208,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OP432DEQaroqDjsMeew3eg5",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PDUwJ9ZgTQzjad",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 350,
+ "unit_amount_decimal": "350"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 18,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "350"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 2,
+ "url": "/v1/invoices/in_1OmTW1DEQaroqDjspHLgWNFX/lines"
+ },
+ "livemode": false,
+ "metadata": {
+ "billing_schedule": "2",
+ "license_management": "automatic",
+ "licenses": "18",
+ "plan_tier": "103"
+ },
+ "next_payment_attempt": null,
+ "number": "CE82FB85-0001",
+ "object": "invoice",
+ "on_behalf_of": null,
+ "paid": false,
+ "paid_out_of_band": false,
+ "payment_intent": "pi_3OmTW2DEQaroqDjs06cY7wx8",
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1708574649,
+ "period_start": 1708574649,
+ "post_payment_credit_notes_amount": 0,
+ "pre_payment_credit_notes_amount": 0,
+ "quote": null,
+ "receipt_number": null,
+ "rendering": {
+ "amount_tax_display": null,
+ "pdf": {
+ "page_size": "letter"
+ }
+ },
+ "rendering_options": null,
+ "shipping_cost": null,
+ "shipping_details": null,
+ "starting_balance": 0,
+ "statement_descriptor": "Zulip Basic",
+ "status": "open",
+ "status_transitions": {
+ "finalized_at": 1708574650,
+ "marked_uncollectible_at": null,
+ "paid_at": null,
+ "voided_at": null
+ },
+ "subscription": null,
+ "subscription_details": {
+ "metadata": null
+ },
+ "subtotal": 4300,
+ "subtotal_excluding_tax": 4300,
+ "tax": null,
+ "test_clock": null,
+ "total": 4300,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 4300,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": null
+}
diff --git a/corporate/tests/stripe_fixtures/free_trial_not_available_for_active_legacy_customer--Invoice.list.1.json b/corporate/tests/stripe_fixtures/free_trial_not_available_for_active_legacy_customer--Invoice.list.1.json
new file mode 100644
index 00000000000..e39960ab725
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/free_trial_not_available_for_active_legacy_customer--Invoice.list.1.json
@@ -0,0 +1,6 @@
+{
+ "data": [],
+ "has_more": false,
+ "object": "list",
+ "url": "/v1/invoices"
+}
diff --git a/corporate/tests/stripe_fixtures/free_trial_not_available_for_active_legacy_customer--Invoice.pay.1.json b/corporate/tests/stripe_fixtures/free_trial_not_available_for_active_legacy_customer--Invoice.pay.1.json
new file mode 100644
index 00000000000..74a6e0055d1
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/free_trial_not_available_for_active_legacy_customer--Invoice.pay.1.json
@@ -0,0 +1,219 @@
+{
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 4300,
+ "amount_paid": 4300,
+ "amount_remaining": 0,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 1,
+ "attempted": true,
+ "auto_advance": false,
+ "automatic_tax": {
+ "enabled": false,
+ "liability": null,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": "ch_3OmTW2DEQaroqDjs0JhLZpBZ",
+ "collection_method": "charge_automatically",
+ "created": 1708574649,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_PbgtpRvLU7dw2y",
+ "customer_address": null,
+ "customer_email": "[email protected]",
+ "customer_name": null,
+ "customer_phone": null,
+ "customer_shipping": null,
+ "customer_tax_exempt": "none",
+ "customer_tax_ids": [],
+ "default_payment_method": null,
+ "default_source": null,
+ "default_tax_rates": [],
+ "description": null,
+ "discount": null,
+ "discounts": [],
+ "due_date": null,
+ "effective_at": 1708574650,
+ "ending_balance": 0,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QYmd0NURPMDcwMkVvRGk5VTY2dmFPQUYwSkV3NkZ2LDk5MTE1NDUz0200Zlz7cHI6?s=ap",
+ "id": "in_1OmTW1DEQaroqDjspHLgWNFX",
+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_17vTkwDEQaroqDjs/test_YWNjdF8xN3ZUa3dERVFhcm9xRGpzLF9QYmd0NURPMDcwMkVvRGk5VTY2dmFPQUYwSkV3NkZ2LDk5MTE1NDUz0200Zlz7cHI6/pdf?s=ap",
+ "issuer": {
+ "type": "self"
+ },
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": -2000,
+ "amount_excluding_tax": -2000,
+ "currency": "usd",
+ "description": "$20.00/month new customer discount",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1OmTW1DEQaroqDjsC6oWJTrH",
+ "invoice": "in_1OmTW1DEQaroqDjspHLgWNFX",
+ "invoice_item": "ii_1OmTW1DEQaroqDjsD0TgVZRd",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1708574649,
+ "start": 1708574649
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1704886320,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OX00qDEQaroqDjst0aTUdZR",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PLhPbuhP0lDy6A",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -2000,
+ "unit_amount_decimal": "-2000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-2000"
+ },
+ {
+ "amount": 6300,
+ "amount_excluding_tax": 6300,
+ "currency": "usd",
+ "description": "Zulip Basic",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_1OmTW2DEQaroqDjsKycfOgbF",
+ "invoice": "in_1OmTW1DEQaroqDjspHLgWNFX",
+ "invoice_item": "ii_1OmTW1DEQaroqDjsWpzVeBTI",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1708574649,
+ "start": 1708574649
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1702995208,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OP432DEQaroqDjsMeew3eg5",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PDUwJ9ZgTQzjad",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 350,
+ "unit_amount_decimal": "350"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 18,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "350"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 2,
+ "url": "/v1/invoices/in_1OmTW1DEQaroqDjspHLgWNFX/lines"
+ },
+ "livemode": false,
+ "metadata": {
+ "billing_schedule": "2",
+ "license_management": "automatic",
+ "licenses": "18",
+ "plan_tier": "103"
+ },
+ "next_payment_attempt": null,
+ "number": "CE82FB85-0001",
+ "object": "invoice",
+ "on_behalf_of": null,
+ "paid": true,
+ "paid_out_of_band": false,
+ "payment_intent": "pi_3OmTW2DEQaroqDjs06cY7wx8",
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1708574649,
+ "period_start": 1708574649,
+ "post_payment_credit_notes_amount": 0,
+ "pre_payment_credit_notes_amount": 0,
+ "quote": null,
+ "receipt_number": null,
+ "rendering": {
+ "amount_tax_display": null,
+ "pdf": {
+ "page_size": "letter"
+ }
+ },
+ "rendering_options": null,
+ "shipping_cost": null,
+ "shipping_details": null,
+ "starting_balance": 0,
+ "statement_descriptor": "Zulip Basic",
+ "status": "paid",
+ "status_transitions": {
+ "finalized_at": 1708574650,
+ "marked_uncollectible_at": null,
+ "paid_at": 1708574652,
+ "voided_at": null
+ },
+ "subscription": null,
+ "subscription_details": {
+ "metadata": null
+ },
+ "subtotal": 4300,
+ "subtotal_excluding_tax": 4300,
+ "tax": null,
+ "test_clock": null,
+ "total": 4300,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 4300,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": 1708574650
+}
diff --git a/corporate/tests/stripe_fixtures/free_trial_not_available_for_active_legacy_customer--InvoiceItem.create.1.json b/corporate/tests/stripe_fixtures/free_trial_not_available_for_active_legacy_customer--InvoiceItem.create.1.json
new file mode 100644
index 00000000000..a1d4d901a3a
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/free_trial_not_available_for_active_legacy_customer--InvoiceItem.create.1.json
@@ -0,0 +1,47 @@
+{
+ "amount": 6300,
+ "currency": "usd",
+ "customer": "cus_PbgtpRvLU7dw2y",
+ "date": 1708574649,
+ "description": "Zulip Basic",
+ "discountable": false,
+ "discounts": [],
+ "id": "ii_1OmTW1DEQaroqDjsWpzVeBTI",
+ "invoice": null,
+ "livemode": false,
+ "metadata": {},
+ "object": "invoiceitem",
+ "period": {
+ "end": 1708574649,
+ "start": 1708574649
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1702995208,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OP432DEQaroqDjsMeew3eg5",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PDUwJ9ZgTQzjad",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 350,
+ "unit_amount_decimal": "350"
+ },
+ "proration": false,
+ "quantity": 18,
+ "subscription": null,
+ "tax_rates": [],
+ "test_clock": null,
+ "unit_amount": 350,
+ "unit_amount_decimal": "350"
+}
diff --git a/corporate/tests/stripe_fixtures/free_trial_not_available_for_active_legacy_customer--InvoiceItem.create.2.json b/corporate/tests/stripe_fixtures/free_trial_not_available_for_active_legacy_customer--InvoiceItem.create.2.json
new file mode 100644
index 00000000000..bfcae2e1faa
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/free_trial_not_available_for_active_legacy_customer--InvoiceItem.create.2.json
@@ -0,0 +1,47 @@
+{
+ "amount": -2000,
+ "currency": "usd",
+ "customer": "cus_PbgtpRvLU7dw2y",
+ "date": 1708574649,
+ "description": "$20.00/month new customer discount",
+ "discountable": false,
+ "discounts": [],
+ "id": "ii_1OmTW1DEQaroqDjsD0TgVZRd",
+ "invoice": null,
+ "livemode": false,
+ "metadata": {},
+ "object": "invoiceitem",
+ "period": {
+ "end": 1708574649,
+ "start": 1708574649
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1704886320,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_1OX00qDEQaroqDjst0aTUdZR",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_PLhPbuhP0lDy6A",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -2000,
+ "unit_amount_decimal": "-2000"
+ },
+ "proration": false,
+ "quantity": 1,
+ "subscription": null,
+ "tax_rates": [],
+ "test_clock": null,
+ "unit_amount": -2000,
+ "unit_amount_decimal": "-2000"
+}
diff --git a/corporate/tests/stripe_fixtures/free_trial_not_available_for_active_legacy_customer--SetupIntent.create.1.json b/corporate/tests/stripe_fixtures/free_trial_not_available_for_active_legacy_customer--SetupIntent.create.1.json
new file mode 100644
index 00000000000..f809ca4dc7f
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/free_trial_not_available_for_active_legacy_customer--SetupIntent.create.1.json
@@ -0,0 +1,34 @@
+{
+ "application": null,
+ "automatic_payment_methods": null,
+ "cancellation_reason": null,
+ "client_secret": "seti_1OmTVxDEQaroqDjs0hVfAEnU_secret_PbgtNyb9b26hwn2mQjnCzuFQG62bPX7",
+ "created": 1708574645,
+ "customer": "cus_PbgtpRvLU7dw2y",
+ "description": null,
+ "flow_directions": null,
+ "id": "seti_1OmTVxDEQaroqDjs0hVfAEnU",
+ "last_setup_error": null,
+ "latest_attempt": "setatt_1OmTVxDEQaroqDjsQvzeI8Il",
+ "livemode": false,
+ "mandate": null,
+ "metadata": {},
+ "next_action": null,
+ "object": "setup_intent",
+ "on_behalf_of": null,
+ "payment_method": "pm_1OmTVwDEQaroqDjsJyP28EtN",
+ "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/free_trial_not_available_for_active_legacy_customer--SetupIntent.list.1.json b/corporate/tests/stripe_fixtures/free_trial_not_available_for_active_legacy_customer--SetupIntent.list.1.json
new file mode 100644
index 00000000000..705ebc03b28
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/free_trial_not_available_for_active_legacy_customer--SetupIntent.list.1.json
@@ -0,0 +1,41 @@
+{
+ "data": [
+ {
+ "application": null,
+ "automatic_payment_methods": null,
+ "cancellation_reason": null,
+ "client_secret": "seti_1OmTVwDEQaroqDjsSzwj9MoK_secret_Pbgtg21v1ixzkjLBM5jcg5fQnBfWSUR",
+ "created": 1708574644,
+ "customer": "cus_PbgtpRvLU7dw2y",
+ "description": null,
+ "flow_directions": null,
+ "id": "seti_1OmTVwDEQaroqDjsSzwj9MoK",
+ "last_setup_error": null,
+ "latest_attempt": null,
+ "livemode": false,
+ "mandate": null,
+ "metadata": {},
+ "next_action": null,
+ "object": "setup_intent",
+ "on_behalf_of": null,
+ "payment_method": null,
+ "payment_method_configuration_details": null,
+ "payment_method_options": {
+ "card": {
+ "mandate_options": null,
+ "network": null,
+ "request_three_d_secure": "automatic"
+ }
+ },
+ "payment_method_types": [
+ "card"
+ ],
+ "single_use_mandate": null,
+ "status": "requires_payment_method",
+ "usage": "off_session"
+ }
+ ],
+ "has_more": true,
+ "object": "list",
+ "url": "/v1/setup_intents"
+}
diff --git a/corporate/tests/stripe_fixtures/free_trial_not_available_for_active_legacy_customer--SetupIntent.retrieve.1.json b/corporate/tests/stripe_fixtures/free_trial_not_available_for_active_legacy_customer--SetupIntent.retrieve.1.json
new file mode 100644
index 00000000000..f809ca4dc7f
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/free_trial_not_available_for_active_legacy_customer--SetupIntent.retrieve.1.json
@@ -0,0 +1,34 @@
+{
+ "application": null,
+ "automatic_payment_methods": null,
+ "cancellation_reason": null,
+ "client_secret": "seti_1OmTVxDEQaroqDjs0hVfAEnU_secret_PbgtNyb9b26hwn2mQjnCzuFQG62bPX7",
+ "created": 1708574645,
+ "customer": "cus_PbgtpRvLU7dw2y",
+ "description": null,
+ "flow_directions": null,
+ "id": "seti_1OmTVxDEQaroqDjs0hVfAEnU",
+ "last_setup_error": null,
+ "latest_attempt": "setatt_1OmTVxDEQaroqDjsQvzeI8Il",
+ "livemode": false,
+ "mandate": null,
+ "metadata": {},
+ "next_action": null,
+ "object": "setup_intent",
+ "on_behalf_of": null,
+ "payment_method": "pm_1OmTVwDEQaroqDjsJyP28EtN",
+ "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/free_trial_not_available_for_active_legacy_customer--checkout.Session.create.1.json b/corporate/tests/stripe_fixtures/free_trial_not_available_for_active_legacy_customer--checkout.Session.create.1.json
new file mode 100644
index 00000000000..62005867f06
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/free_trial_not_available_for_active_legacy_customer--checkout.Session.create.1.json
@@ -0,0 +1,75 @@
+{
+ "after_expiration": null,
+ "allow_promotion_codes": null,
+ "amount_subtotal": null,
+ "amount_total": null,
+ "automatic_tax": {
+ "enabled": false,
+ "liability": null,
+ "status": null
+ },
+ "billing_address_collection": "required",
+ "cancel_url": "http://selfhosting.testserver/server/6cde5f7a-1f7e-4978-9716-49f69ebfc9fe/upgrade/?manual_license_management=false&tier=1",
+ "client_reference_id": null,
+ "client_secret": null,
+ "consent": null,
+ "consent_collection": null,
+ "created": 1708574644,
+ "currency": null,
+ "currency_conversion": null,
+ "custom_fields": [],
+ "custom_text": {
+ "after_submit": null,
+ "shipping_address": null,
+ "submit": null,
+ "terms_of_service_acceptance": null
+ },
+ "customer": "cus_PbgtpRvLU7dw2y",
+ "customer_creation": null,
+ "customer_details": {
+ "address": null,
+ "email": "[email protected]",
+ "name": null,
+ "phone": null,
+ "tax_exempt": null,
+ "tax_ids": null
+ },
+ "customer_email": null,
+ "expires_at": 1708661044,
+ "id": "cs_test_c1UqAKnkSWSP6qzkLbuI9WBn96e6eWLLcKXGW0ZyOpk9Wp3Bys630PIJX7",
+ "invoice": null,
+ "invoice_creation": null,
+ "livemode": false,
+ "locale": null,
+ "metadata": {
+ "remote_server_user_id": "1",
+ "type": "card_update"
+ },
+ "mode": "setup",
+ "object": "checkout.session",
+ "payment_intent": null,
+ "payment_link": null,
+ "payment_method_collection": "always",
+ "payment_method_configuration_details": null,
+ "payment_method_options": {},
+ "payment_method_types": [
+ "card"
+ ],
+ "payment_status": "no_payment_required",
+ "phone_number_collection": {
+ "enabled": false
+ },
+ "recovered_from": null,
+ "setup_intent": "seti_1OmTVwDEQaroqDjsSzwj9MoK",
+ "shipping": null,
+ "shipping_address_collection": null,
+ "shipping_options": [],
+ "shipping_rate": null,
+ "status": "open",
+ "submit_type": null,
+ "subscription": null,
+ "success_url": "http://selfhosting.testserver/server/6cde5f7a-1f7e-4978-9716-49f69ebfc9fe/billing/event_status/?stripe_session_id={CHECKOUT_SESSION_ID}",
+ "total_details": null,
+ "ui_mode": "hosted",
+ "url": "https://checkout.stripe.com/c/pay/cs_test_c1UqAKnkSWSP6qzkLbuI9WBn96e6eWLLcKXGW0ZyOpk9Wp3Bys630PIJX7#fid1d2BpamRhQ2prcSc%2FJ1ZqcHdmYCVWZGt2JVV3aicpJ2R1bE5gfCc%2FJ3VuWnFgdnFaXVRmMU5zNkldQTY9SnNRY09XZml2UXNQJyknY3dqaFZgd3Ngdyc%2FcXdwYCknaWR8anBxUXx1YCc%2FJ3Zsa2JpYFpmamlwaGsnKSdga2RnaWBVaWRmYG1qaWFgd3YnP3F3cGB4JSUl"
+}
diff --git a/corporate/tests/stripe_fixtures/free_trial_not_available_for_active_legacy_customer--checkout.Session.list.1.json b/corporate/tests/stripe_fixtures/free_trial_not_available_for_active_legacy_customer--checkout.Session.list.1.json
new file mode 100644
index 00000000000..daeee15a0eb
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/free_trial_not_available_for_active_legacy_customer--checkout.Session.list.1.json
@@ -0,0 +1,82 @@
+{
+ "data": [
+ {
+ "after_expiration": null,
+ "allow_promotion_codes": null,
+ "amount_subtotal": null,
+ "amount_total": null,
+ "automatic_tax": {
+ "enabled": false,
+ "liability": null,
+ "status": null
+ },
+ "billing_address_collection": "required",
+ "cancel_url": "http://selfhosting.testserver/server/6cde5f7a-1f7e-4978-9716-49f69ebfc9fe/upgrade/?manual_license_management=false&tier=1",
+ "client_reference_id": null,
+ "client_secret": null,
+ "consent": null,
+ "consent_collection": null,
+ "created": 1708574644,
+ "currency": null,
+ "currency_conversion": null,
+ "custom_fields": [],
+ "custom_text": {
+ "after_submit": null,
+ "shipping_address": null,
+ "submit": null,
+ "terms_of_service_acceptance": null
+ },
+ "customer": "cus_PbgtpRvLU7dw2y",
+ "customer_creation": null,
+ "customer_details": {
+ "address": null,
+ "email": "[email protected]",
+ "name": null,
+ "phone": null,
+ "tax_exempt": null,
+ "tax_ids": null
+ },
+ "customer_email": null,
+ "expires_at": 1708661044,
+ "id": "cs_test_c1UqAKnkSWSP6qzkLbuI9WBn96e6eWLLcKXGW0ZyOpk9Wp3Bys630PIJX7",
+ "invoice": null,
+ "invoice_creation": null,
+ "livemode": false,
+ "locale": null,
+ "metadata": {
+ "remote_server_user_id": "1",
+ "type": "card_update"
+ },
+ "mode": "setup",
+ "object": "checkout.session",
+ "payment_intent": null,
+ "payment_link": null,
+ "payment_method_collection": "always",
+ "payment_method_configuration_details": null,
+ "payment_method_options": {},
+ "payment_method_types": [
+ "card"
+ ],
+ "payment_status": "no_payment_required",
+ "phone_number_collection": {
+ "enabled": false
+ },
+ "recovered_from": null,
+ "setup_intent": "seti_1OmTVwDEQaroqDjsSzwj9MoK",
+ "shipping": null,
+ "shipping_address_collection": null,
+ "shipping_options": [],
+ "shipping_rate": null,
+ "status": "open",
+ "submit_type": null,
+ "subscription": null,
+ "success_url": "http://selfhosting.testserver/server/6cde5f7a-1f7e-4978-9716-49f69ebfc9fe/billing/event_status/?stripe_session_id={CHECKOUT_SESSION_ID}",
+ "total_details": null,
+ "ui_mode": "hosted",
+ "url": "https://checkout.stripe.com/c/pay/cs_test_c1UqAKnkSWSP6qzkLbuI9WBn96e6eWLLcKXGW0ZyOpk9Wp3Bys630PIJX7#fid1d2BpamRhQ2prcSc%2FJ1ZqcHdmYCVWZGt2JVV3aicpJ2R1bE5gfCc%2FJ3VuWnFgdnFaXVRmMU5zNkldQTY9SnNRY09XZml2UXNQJyknY3dqaFZgd3Ngdyc%2FcXdwYCknaWR8anBxUXx1YCc%2FJ3Zsa2JpYFpmamlwaGsnKSdga2RnaWBVaWRmYG1qaWFgd3YnP3F3cGB4JSUl"
+ }
+ ],
+ "has_more": true,
+ "object": "list",
+ "url": "/v1/checkout/sessions"
+}
diff --git a/corporate/tests/stripe_fixtures/free_trial_not_available_for_ended_legacy_customer--Customer.create.1.json b/corporate/tests/stripe_fixtures/free_trial_not_available_for_ended_legacy_customer--Customer.create.1.json
new file mode 100644
index 00000000000..3d6b9bc66c1
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/free_trial_not_available_for_ended_legacy_customer--Customer.create.1.json
@@ -0,0 +1,33 @@
+{
+ "address": null,
+ "balance": 0,
+ "created": 1000000000,
+ "currency": null,
+ "default_currency": null,
+ "default_source": null,
+ "delinquent": false,
+ "description": "demo.example.com 6cde5f7a-1f7",
+ "discount": null,
+ "email": "[email protected]",
+ "id": "cus_NORMALIZED0001",
+ "invoice_prefix": "NORMA01",
+ "invoice_settings": {
+ "custom_fields": null,
+ "default_payment_method": null,
+ "footer": null,
+ "rendering_options": null
+ },
+ "livemode": false,
+ "metadata": {
+ "remote_server_str": "demo.example.com 6cde5f7a-1f7",
+ "remote_server_uuid": "6cde5f7a-1f7e-4978-9716-49f69ebfc9fe"
+ },
+ "name": null,
+ "next_invoice_sequence": 1,
+ "object": "customer",
+ "phone": null,
+ "preferred_locales": [],
+ "shipping": null,
+ "tax_exempt": "none",
+ "test_clock": null
+}
diff --git a/corporate/tests/stripe_fixtures/free_trial_not_available_for_ended_legacy_customer--Customer.modify.1.json b/corporate/tests/stripe_fixtures/free_trial_not_available_for_ended_legacy_customer--Customer.modify.1.json
new file mode 100644
index 00000000000..53d023ce515
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/free_trial_not_available_for_ended_legacy_customer--Customer.modify.1.json
@@ -0,0 +1,33 @@
+{
+ "address": null,
+ "balance": 0,
+ "created": 1000000000,
+ "currency": null,
+ "default_currency": null,
+ "default_source": null,
+ "delinquent": false,
+ "description": "demo.example.com 6cde5f7a-1f7",
+ "discount": null,
+ "email": "[email protected]",
+ "id": "cus_NORMALIZED0001",
+ "invoice_prefix": "NORMA01",
+ "invoice_settings": {
+ "custom_fields": null,
+ "default_payment_method": "pm_1OmTnMDEQaroqDjsXJSvs7og",
+ "footer": null,
+ "rendering_options": null
+ },
+ "livemode": false,
+ "metadata": {
+ "remote_server_str": "demo.example.com 6cde5f7a-1f7",
+ "remote_server_uuid": "6cde5f7a-1f7e-4978-9716-49f69ebfc9fe"
+ },
+ "name": null,
+ "next_invoice_sequence": 1,
+ "object": "customer",
+ "phone": null,
+ "preferred_locales": [],
+ "shipping": null,
+ "tax_exempt": "none",
+ "test_clock": null
+}
diff --git a/corporate/tests/stripe_fixtures/free_trial_not_available_for_ended_legacy_customer--Customer.retrieve.1.json b/corporate/tests/stripe_fixtures/free_trial_not_available_for_ended_legacy_customer--Customer.retrieve.1.json
new file mode 100644
index 00000000000..82a47be188b
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/free_trial_not_available_for_ended_legacy_customer--Customer.retrieve.1.json
@@ -0,0 +1,80 @@
+{
+ "address": null,
+ "balance": 0,
+ "created": 1000000000,
+ "currency": null,
+ "default_currency": null,
+ "default_source": null,
+ "delinquent": false,
+ "description": "demo.example.com 6cde5f7a-1f7",
+ "discount": null,
+ "email": "[email protected]",
+ "id": "cus_NORMALIZED0001",
+ "invoice_prefix": "NORMA01",
+ "invoice_settings": {
+ "custom_fields": null,
+ "default_payment_method": {
+ "billing_details": {
+ "address": {
+ "city": null,
+ "country": null,
+ "line1": null,
+ "line2": null,
+ "postal_code": null,
+ "state": null
+ },
+ "email": null,
+ "name": null,
+ "phone": null
+ },
+ "card": {
+ "brand": "visa",
+ "checks": {
+ "address_line1_check": null,
+ "address_postal_code_check": null,
+ "cvc_check": "pass"
+ },
+ "country": "US",
+ "display_brand": "visa",
+ "exp_month": 2,
+ "exp_year": 2025,
+ "fingerprint": "NORMALIZED000001",
+ "funding": "credit",
+ "generated_from": null,
+ "last4": "4242",
+ "networks": {
+ "available": [
+ "visa"
+ ],
+ "preferred": null
+ },
+ "three_d_secure_usage": {
+ "supported": true
+ },
+ "wallet": null
+ },
+ "created": 1000000000,
+ "customer": "cus_NORMALIZED0001",
+ "id": "pm_1OmTnMDEQaroqDjsXJSvs7og",
+ "livemode": false,
+ "metadata": {},
+ "object": "payment_method",
+ "type": "card"
+ },
+ "footer": null,
+ "rendering_options": null
+ },
+ "livemode": false,
+ "metadata": {
+ "remote_server_str": "demo.example.com 6cde5f7a-1f7",
+ "remote_server_uuid": "6cde5f7a-1f7e-4978-9716-49f69ebfc9fe"
+ },
+ "name": null,
+ "next_invoice_sequence": 1,
+ "object": "customer",
+ "phone": null,
+ "preferred_locales": [],
+ "shipping": null,
+ "tax_exempt": "none",
+ "test_clock": null
+}
diff --git a/corporate/tests/stripe_fixtures/free_trial_not_available_for_ended_legacy_customer--Customer.retrieve.2.json b/corporate/tests/stripe_fixtures/free_trial_not_available_for_ended_legacy_customer--Customer.retrieve.2.json
new file mode 100644
index 00000000000..82a47be188b
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/free_trial_not_available_for_ended_legacy_customer--Customer.retrieve.2.json
@@ -0,0 +1,80 @@
+{
+ "address": null,
+ "balance": 0,
+ "created": 1000000000,
+ "currency": null,
+ "default_currency": null,
+ "default_source": null,
+ "delinquent": false,
+ "description": "demo.example.com 6cde5f7a-1f7",
+ "discount": null,
+ "email": "[email protected]",
+ "id": "cus_NORMALIZED0001",
+ "invoice_prefix": "NORMA01",
+ "invoice_settings": {
+ "custom_fields": null,
+ "default_payment_method": {
+ "billing_details": {
+ "address": {
+ "city": null,
+ "country": null,
+ "line1": null,
+ "line2": null,
+ "postal_code": null,
+ "state": null
+ },
+ "email": null,
+ "name": null,
+ "phone": null
+ },
+ "card": {
+ "brand": "visa",
+ "checks": {
+ "address_line1_check": null,
+ "address_postal_code_check": null,
+ "cvc_check": "pass"
+ },
+ "country": "US",
+ "display_brand": "visa",
+ "exp_month": 2,
+ "exp_year": 2025,
+ "fingerprint": "NORMALIZED000001",
+ "funding": "credit",
+ "generated_from": null,
+ "last4": "4242",
+ "networks": {
+ "available": [
+ "visa"
+ ],
+ "preferred": null
+ },
+ "three_d_secure_usage": {
+ "supported": true
+ },
+ "wallet": null
+ },
+ "created": 1000000000,
+ "customer": "cus_NORMALIZED0001",
+ "id": "pm_1OmTnMDEQaroqDjsXJSvs7og",
+ "livemode": false,
+ "metadata": {},
+ "object": "payment_method",
+ "type": "card"
+ },
+ "footer": null,
+ "rendering_options": null
+ },
+ "livemode": false,
+ "metadata": {
+ "remote_server_str": "demo.example.com 6cde5f7a-1f7",
+ "remote_server_uuid": "6cde5f7a-1f7e-4978-9716-49f69ebfc9fe"
+ },
+ "name": null,
+ "next_invoice_sequence": 1,
+ "object": "customer",
+ "phone": null,
+ "preferred_locales": [],
+ "shipping": null,
+ "tax_exempt": "none",
+ "test_clock": null
+}
diff --git a/corporate/tests/stripe_fixtures/free_trial_not_available_for_ended_legacy_customer--Customer.retrieve.3.json b/corporate/tests/stripe_fixtures/free_trial_not_available_for_ended_legacy_customer--Customer.retrieve.3.json
new file mode 100644
index 00000000000..82a47be188b
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/free_trial_not_available_for_ended_legacy_customer--Customer.retrieve.3.json
@@ -0,0 +1,80 @@
+{
+ "address": null,
+ "balance": 0,
+ "created": 1000000000,
+ "currency": null,
+ "default_currency": null,
+ "default_source": null,
+ "delinquent": false,
+ "description": "demo.example.com 6cde5f7a-1f7",
+ "discount": null,
+ "email": "[email protected]",
+ "id": "cus_NORMALIZED0001",
+ "invoice_prefix": "NORMA01",
+ "invoice_settings": {
+ "custom_fields": null,
+ "default_payment_method": {
+ "billing_details": {
+ "address": {
+ "city": null,
+ "country": null,
+ "line1": null,
+ "line2": null,
+ "postal_code": null,
+ "state": null
+ },
+ "email": null,
+ "name": null,
+ "phone": null
+ },
+ "card": {
+ "brand": "visa",
+ "checks": {
+ "address_line1_check": null,
+ "address_postal_code_check": null,
+ "cvc_check": "pass"
+ },
+ "country": "US",
+ "display_brand": "visa",
+ "exp_month": 2,
+ "exp_year": 2025,
+ "fingerprint": "NORMALIZED000001",
+ "funding": "credit",
+ "generated_from": null,
+ "last4": "4242",
+ "networks": {
+ "available": [
+ "visa"
+ ],
+ "preferred": null
+ },
+ "three_d_secure_usage": {
+ "supported": true
+ },
+ "wallet": null
+ },
+ "created": 1000000000,
+ "customer": "cus_NORMALIZED0001",
+ "id": "pm_1OmTnMDEQaroqDjsXJSvs7og",
+ "livemode": false,
+ "metadata": {},
+ "object": "payment_method",
+ "type": "card"
+ },
+ "footer": null,
+ "rendering_options": null
+ },
+ "livemode": false,
+ "metadata": {
+ "remote_server_str": "demo.example.com 6cde5f7a-1f7",
+ "remote_server_uuid": "6cde5f7a-1f7e-4978-9716-49f69ebfc9fe"
+ },
+ "name": null,
+ "next_invoice_sequence": 1,
+ "object": "customer",
+ "phone": null,
+ "preferred_locales": [],
+ "shipping": null,
+ "tax_exempt": "none",
+ "test_clock": null
+}
diff --git a/corporate/tests/stripe_fixtures/free_trial_not_available_for_ended_legacy_customer--Customer.retrieve.4.json b/corporate/tests/stripe_fixtures/free_trial_not_available_for_ended_legacy_customer--Customer.retrieve.4.json
new file mode 100644
index 00000000000..82a47be188b
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/free_trial_not_available_for_ended_legacy_customer--Customer.retrieve.4.json
@@ -0,0 +1,80 @@
+{
+ "address": null,
+ "balance": 0,
+ "created": 1000000000,
+ "currency": null,
+ "default_currency": null,
+ "default_source": null,
+ "delinquent": false,
+ "description": "demo.example.com 6cde5f7a-1f7",
+ "discount": null,
+ "email": "[email protected]",
+ "id": "cus_NORMALIZED0001",
+ "invoice_prefix": "NORMA01",
+ "invoice_settings": {
+ "custom_fields": null,
+ "default_payment_method": {
+ "billing_details": {
+ "address": {
+ "city": null,
+ "country": null,
+ "line1": null,
+ "line2": null,
+ "postal_code": null,
+ "state": null
+ },
+ "email": null,
+ "name": null,
+ "phone": null
+ },
+ "card": {
+ "brand": "visa",
+ "checks": {
+ "address_line1_check": null,
+ "address_postal_code_check": null,
+ "cvc_check": "pass"
+ },
+ "country": "US",
+ "display_brand": "visa",
+ "exp_month": 2,
+ "exp_year": 2025,
+ "fingerprint": "NORMALIZED000001",
+ "funding": "credit",
+ "generated_from": null,
+ "last4": "4242",
+ "networks": {
+ "available": [
+ "visa"
+ ],
+ "preferred": null
+ },
+ "three_d_secure_usage": {
+ "supported": true
+ },
+ "wallet": null
+ },
+ "created": 1000000000,
+ "customer": "cus_NORMALIZED0001",
+ "id": "pm_1OmTnMDEQaroqDjsXJSvs7og",
+ "livemode": false,
+ "metadata": {},
+ "object": "payment_method",
+ "type": "card"
+ },
+ "footer": null,
+ "rendering_options": null
+ },
+ "livemode": false,
+ "metadata": {
+ "remote_server_str": "demo.example.com 6cde5f7a-1f7",
+ "remote_server_uuid": "6cde5f7a-1f7e-4978-9716-49f69ebfc9fe"
+ },
+ "name": null,
+ "next_invoice_sequence": 1,
+ "object": "customer",
+ "phone": null,
+ "preferred_locales": [],
+ "shipping": null,
+ "tax_exempt": "none",
+ "test_clock": null
+}
diff --git a/corporate/tests/stripe_fixtures/free_trial_not_available_for_ended_legacy_customer--Customer.retrieve.5.json b/corporate/tests/stripe_fixtures/free_trial_not_available_for_ended_legacy_customer--Customer.retrieve.5.json
new file mode 100644
index 00000000000..6e3e5fea101
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/free_trial_not_available_for_ended_legacy_customer--Customer.retrieve.5.json
@@ -0,0 +1,80 @@
+{
+ "address": null,
+ "balance": 0,
+ "created": 1000000000,
+ "currency": "usd",
+ "default_currency": "usd",
+ "default_source": null,
+ "delinquent": false,
+ "description": "demo.example.com 6cde5f7a-1f7",
+ "discount": null,
+ "email": "[email protected]",
+ "id": "cus_NORMALIZED0001",
+ "invoice_prefix": "NORMA01",
+ "invoice_settings": {
+ "custom_fields": null,
+ "default_payment_method": {
+ "billing_details": {
+ "address": {
+ "city": null,
+ "country": null,
+ "line1": null,
+ "line2": null,
+ "postal_code": null,
+ "state": null
+ },
+ "email": null,
+ "name": null,
+ "phone": null
+ },
+ "card": {
+ "brand": "visa",
+ "checks": {
+ "address_line1_check": null,
+ "address_postal_code_check": null,
+ "cvc_check": "pass"
+ },
+ "country": "US",
+ "display_brand": "visa",
+ "exp_month": 2,
+ "exp_year": 2025,
+ "fingerprint": "NORMALIZED000001",
+ "funding": "credit",
+ "generated_from": null,
+ "last4": "4242",
+ "networks": {
+ "available": [
+ "visa"
+ ],
+ "preferred": null
+ },
+ "three_d_secure_usage": {
+ "supported": true
+ },
+ "wallet": null
+ },
+ "created": 1000000000,
+ "customer": "cus_NORMALIZED0001",
+ "id": "pm_1OmTnMDEQaroqDjsXJSvs7og",
+ "livemode": false,
+ "metadata": {},
+ "object": "payment_method",
+ "type": "card"
+ },
+ "footer": null,
+ "rendering_options": null
+ },
+ "livemode": false,
+ "metadata": {
+ "remote_server_str": "demo.example.com 6cde5f7a-1f7",
+ "remote_server_uuid": "6cde5f7a-1f7e-4978-9716-49f69ebfc9fe"
+ },
+ "name": null,
+ "next_invoice_sequence": 2,
+ "object": "customer",
+ "phone": null,
+ "preferred_locales": [],
+ "shipping": null,
+ "tax_exempt": "none",
+ "test_clock": null
+}
diff --git a/corporate/tests/stripe_fixtures/free_trial_not_available_for_ended_legacy_customer--Event.list.1.json b/corporate/tests/stripe_fixtures/free_trial_not_available_for_ended_legacy_customer--Event.list.1.json
new file mode 100644
index 00000000000..6ec01fdc81d
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/free_trial_not_available_for_ended_legacy_customer--Event.list.1.json
@@ -0,0 +1,60 @@
+{
+ "data": [
+ {
+ "api_version": "2020-08-27",
+ "created": 1000000000,
+ "data": {
+ "object": {
+ "address": null,
+ "balance": 0,
+ "created": 1000000000,
+ "currency": null,
+ "default_currency": null,
+ "default_source": null,
+ "delinquent": false,
+ "description": "demo.example.com 6cde5f7a-1f7",
+ "discount": null,
+ "email": "[email protected]",
+ "id": "cus_NORMALIZED0001",
+ "invoice_prefix": "NORMA01",
+ "invoice_settings": {
+ "custom_fields": null,
+ "default_payment_method": "pm_1OmTnMDEQaroqDjsXJSvs7og",
+ "footer": null,
+ "rendering_options": null
+ },
+ "livemode": false,
+ "metadata": {
+ "remote_server_str": "demo.example.com 6cde5f7a-1f7",
+ "remote_server_uuid": "6cde5f7a-1f7e-4978-9716-49f69ebfc9fe"
+ },
+ "name": null,
+ "next_invoice_sequence": 1,
+ "object": "customer",
+ "phone": null,
+ "preferred_locales": [],
+ "shipping": null,
+ "tax_exempt": "none",
+ "test_clock": null
+ },
+ "previous_attributes": {
+ "invoice_settings": {
+ "default_payment_method": null
+ }
+ }
+ },
+ "id": "evt_1OmTnODEQaroqDjsGUYUPrmf",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_NORMALIZED0001",
+ "idempotency_key": "aaad3614-65b9-4532-ab8f-3dac86502c6d"
+ },
+ "type": "customer.updated"
+ }
+ ],
+ "has_more": true,
+ "object": "list",
+ "url": "/v1/events"
+}
diff --git a/corporate/tests/stripe_fixtures/free_trial_not_available_for_ended_legacy_customer--Event.list.2.json b/corporate/tests/stripe_fixtures/free_trial_not_available_for_ended_legacy_customer--Event.list.2.json
new file mode 100644
index 00000000000..a5e7f51eae6
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/free_trial_not_available_for_ended_legacy_customer--Event.list.2.json
@@ -0,0 +1,1170 @@
+{
+ "data": [
+ {
+ "api_version": "2020-08-27",
+ "created": 1000000000,
+ "data": {
+ "object": {
+ "amount": 4300,
+ "amount_capturable": 0,
+ "amount_details": {
+ "tip": {}
+ },
+ "amount_received": 4300,
+ "application": null,
+ "application_fee_amount": null,
+ "automatic_payment_methods": null,
+ "canceled_at": null,
+ "cancellation_reason": null,
+ "capture_method": "automatic",
+ "charges": {
+ "data": [
+ {
+ "amount": 4300,
+ "amount_captured": 4300,
+ "amount_refunded": 0,
+ "application": null,
+ "application_fee": null,
+ "application_fee_amount": null,
+ "balance_transaction": "txn_NORMALIZED00000000000001",
+ "billing_details": {
+ "address": {
+ "city": null,
+ "country": null,
+ "line1": null,
+ "line2": null,
+ "postal_code": null,
+ "state": null
+ },
+ "email": null,
+ "name": null,
+ "phone": null
+ },
+ "calculated_statement_descriptor": "ZULIP BASIC",
+ "captured": true,
+ "created": 1000000000,
+ "currency": "usd",
+ "customer": "cus_NORMALIZED0001",
+ "description": "Payment for Invoice",
+ "destination": null,
+ "dispute": null,
+ "disputed": false,
+ "failure_balance_transaction": null,
+ "failure_code": null,
+ "failure_message": null,
+ "fraud_details": {},
+ "id": "ch_NORMALIZED00000000000001",
+ "invoice": "in_NORMALIZED00000000000001",
+ "livemode": false,
+ "metadata": {},
+ "object": "charge",
+ "on_behalf_of": null,
+ "order": null,
+ "outcome": {
+ "network_status": "approved_by_network",
+ "reason": null,
+ "risk_level": "normal",
+ "risk_score": 0,
+ "seller_message": "Payment complete.",
+ "type": "authorized"
+ },
+ "paid": true,
+ "payment_intent": "pi_NORMALIZED00000000000001",
+ "payment_method": "pm_1OmTnMDEQaroqDjsXJSvs7og",
+ "payment_method_details": {
+ "card": {
+ "amount_authorized": 4300,
+ "brand": "visa",
+ "checks": {
+ "address_line1_check": null,
+ "address_postal_code_check": null,
+ "cvc_check": "pass"
+ },
+ "country": "US",
+ "exp_month": 2,
+ "exp_year": 2025,
+ "extended_authorization": {
+ "status": "disabled"
+ },
+ "fingerprint": "NORMALIZED000001",
+ "funding": "credit",
+ "incremental_authorization": {
+ "status": "unavailable"
+ },
+ "installments": null,
+ "last4": "4242",
+ "mandate": null,
+ "multicapture": {
+ "status": "unavailable"
+ },
+ "network": "visa",
+ "network_token": {
+ "used": false
+ },
+ "overcapture": {
+ "maximum_amount_capturable": 4300,
+ "status": "unavailable"
+ },
+ "three_d_secure": null,
+ "wallet": null
+ },
+ "type": "card"
+ },
+ "radar_options": {},
+ "receipt_email": "[email protected]",
+ "receipt_number": null,
+ "receipt_url": "https://pay.stripe.com/receipts/invoices/CAcaFwoVYWNjdF8xN3ZUa3dERVFhcm9xRGpzKPSX264GMgbKSPGLKnA6LBZi23xVzWBbAMR5tyXU0ZpcmGJebwBj2lvYaMLLewXSQMZqGfuWxJN1E3ry?s=ap",
+ "refunded": false,
+ "refunds": {
+ "data": [],
+ "has_more": false,
+ "object": "list",
+ "total_count": 0,
+ "url": "/v1/charges/ch_NORMALIZED00000000000001/refunds"
+ },
+ "review": null,
+ "shipping": null,
+ "source": null,
+ "source_transfer": null,
+ "statement_descriptor": "Zulip Basic",
+ "statement_descriptor_suffix": null,
+ "status": "succeeded",
+ "transfer_data": null,
+ "transfer_group": null
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 1,
+ "url": "/v1/charges?payment_intent=pi_NORMALIZED00000000000001"
+ },
+ "client_secret": "pi_NORMALIZED00000000000001_secret_ZUDoff9kiNkJzGbnuLTTgZLKu",
+ "confirmation_method": "automatic",
+ "created": 1000000000,
+ "currency": "usd",
+ "customer": "cus_NORMALIZED0001",
+ "description": "Payment for Invoice",
+ "id": "pi_NORMALIZED00000000000001",
+ "invoice": "in_NORMALIZED00000000000001",
+ "last_payment_error": null,
+ "latest_charge": "ch_NORMALIZED00000000000001",
+ "livemode": false,
+ "metadata": {},
+ "next_action": null,
+ "object": "payment_intent",
+ "on_behalf_of": null,
+ "payment_method": "pm_1OmTnMDEQaroqDjsXJSvs7og",
+ "payment_method_configuration_details": null,
+ "payment_method_options": {
+ "card": {
+ "installments": null,
+ "mandate_options": null,
+ "network": null,
+ "request_three_d_secure": "automatic"
+ },
+ "cashapp": {}
+ },
+ "payment_method_types": [
+ "card",
+ "cashapp"
+ ],
+ "processing": null,
+ "receipt_email": "[email protected]",
+ "review": null,
+ "setup_future_usage": null,
+ "shipping": null,
+ "source": null,
+ "statement_descriptor": "Zulip Basic",
+ "statement_descriptor_suffix": null,
+ "status": "succeeded",
+ "transfer_data": null,
+ "transfer_group": null
+ }
+ },
+ "id": "evt_3OmTnSDEQaroqDjs0kruWvxP",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 1,
+ "request": {
+ "id": "req_NORMALIZED0002",
+ "idempotency_key": "29906042-b934-42b5-9c9b-10ba955641d0"
+ },
+ "type": "payment_intent.succeeded"
+ },
+ {
+ "api_version": "2020-08-27",
+ "created": 1000000000,
+ "data": {
+ "object": {
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 4300,
+ "amount_paid": 0,
+ "amount_remaining": 4300,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 0,
+ "attempted": false,
+ "auto_advance": false,
+ "automatic_tax": {
+ "enabled": false,
+ "liability": null,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": null,
+ "collection_method": "charge_automatically",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_NORMALIZED0001",
+ "customer_address": null,
+ "customer_email": "[email protected]",
+ "customer_name": null,
+ "customer_phone": null,
+ "customer_shipping": null,
+ "customer_tax_exempt": "none",
+ "customer_tax_ids": [],
+ "default_payment_method": null,
+ "default_source": null,
+ "default_tax_rates": [],
+ "description": null,
+ "discount": null,
+ "discounts": [],
+ "due_date": null,
+ "effective_at": 1000000000,
+ "ending_balance": 0,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QYmhCdjYxQ1RRQWk5NFBDQXlrbEF6akkwZmNNSHIwLDk5MTE2NTMw0200kRUVZYHN?s=ap",
+ "id": "in_NORMALIZED00000000000001",
+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QYmhCdjYxQ1RRQWk5NFBDQXlrbEF6akkwZmNNSHIwLDk5MTE2NTMw0200kRUVZYHN/pdf?s=ap",
+ "issuer": {
+ "type": "self"
+ },
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": -2000,
+ "amount_excluding_tax": -2000,
+ "currency": "usd",
+ "description": "$20.00/month new customer discount",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_NORMALIZED00000000000001",
+ "invoice": "in_NORMALIZED00000000000001",
+ "invoice_item": "ii_NORMALIZED00000000000001",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1000000000,
+ "start": 1000000000
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000001",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0001",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -2000,
+ "unit_amount_decimal": "-2000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-2000"
+ },
+ {
+ "amount": 6300,
+ "amount_excluding_tax": 6300,
+ "currency": "usd",
+ "description": "Zulip Basic",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_NORMALIZED00000000000002",
+ "invoice": "in_NORMALIZED00000000000001",
+ "invoice_item": "ii_NORMALIZED00000000000002",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1000000000,
+ "start": 1000000000
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000002",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0002",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 350,
+ "unit_amount_decimal": "350"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 18,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "350"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 2,
+ "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"
+ },
+ "livemode": false,
+ "metadata": {
+ "billing_schedule": "2",
+ "license_management": "automatic",
+ "licenses": "18",
+ "plan_tier": "103"
+ },
+ "next_payment_attempt": null,
+ "number": "NORMALI-0001",
+ "object": "invoice",
+ "on_behalf_of": null,
+ "paid": false,
+ "paid_out_of_band": false,
+ "payment_intent": "pi_NORMALIZED00000000000001",
+ "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,
+ "quote": null,
+ "receipt_number": null,
+ "rendering": {
+ "amount_tax_display": null,
+ "pdf": {
+ "page_size": "letter"
+ }
+ },
+ "rendering_options": null,
+ "shipping_cost": null,
+ "shipping_details": null,
+ "starting_balance": 0,
+ "statement_descriptor": "Zulip Basic",
+ "status": "open",
+ "status_transitions": {
+ "finalized_at": 1000000000,
+ "marked_uncollectible_at": null,
+ "paid_at": null,
+ "voided_at": null
+ },
+ "subscription": null,
+ "subscription_details": {
+ "metadata": null
+ },
+ "subtotal": 4300,
+ "subtotal_excluding_tax": 4300,
+ "tax": null,
+ "test_clock": null,
+ "total": 4300,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 4300,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": null
+ }
+ },
+ "id": "evt_1OmTnSDEQaroqDjsEoNzrQeY",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_NORMALIZED0003",
+ "idempotency_key": "7176fd98-a08f-45f5-9e56-c8be8049b1ee"
+ },
+ "type": "invoice.finalized"
+ },
+ {
+ "api_version": "2020-08-27",
+ "created": 1000000000,
+ "data": {
+ "object": {
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 4300,
+ "amount_paid": 0,
+ "amount_remaining": 4300,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 0,
+ "attempted": false,
+ "auto_advance": false,
+ "automatic_tax": {
+ "enabled": false,
+ "liability": null,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": null,
+ "collection_method": "charge_automatically",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_NORMALIZED0001",
+ "customer_address": null,
+ "customer_email": "[email protected]",
+ "customer_name": null,
+ "customer_phone": null,
+ "customer_shipping": null,
+ "customer_tax_exempt": "none",
+ "customer_tax_ids": [],
+ "default_payment_method": null,
+ "default_source": null,
+ "default_tax_rates": [],
+ "description": null,
+ "discount": null,
+ "discounts": [],
+ "due_date": null,
+ "effective_at": 1000000000,
+ "ending_balance": 0,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QYmhCdjYxQ1RRQWk5NFBDQXlrbEF6akkwZmNNSHIwLDk5MTE2NTMw0200kRUVZYHN?s=ap",
+ "id": "in_NORMALIZED00000000000001",
+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QYmhCdjYxQ1RRQWk5NFBDQXlrbEF6akkwZmNNSHIwLDk5MTE2NTMw0200kRUVZYHN/pdf?s=ap",
+ "issuer": {
+ "type": "self"
+ },
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": -2000,
+ "amount_excluding_tax": -2000,
+ "currency": "usd",
+ "description": "$20.00/month new customer discount",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_NORMALIZED00000000000001",
+ "invoice": "in_NORMALIZED00000000000001",
+ "invoice_item": "ii_NORMALIZED00000000000001",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1000000000,
+ "start": 1000000000
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000001",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0001",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -2000,
+ "unit_amount_decimal": "-2000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-2000"
+ },
+ {
+ "amount": 6300,
+ "amount_excluding_tax": 6300,
+ "currency": "usd",
+ "description": "Zulip Basic",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_NORMALIZED00000000000002",
+ "invoice": "in_NORMALIZED00000000000001",
+ "invoice_item": "ii_NORMALIZED00000000000002",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1000000000,
+ "start": 1000000000
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000002",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0002",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 350,
+ "unit_amount_decimal": "350"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 18,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "350"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 2,
+ "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"
+ },
+ "livemode": false,
+ "metadata": {
+ "billing_schedule": "2",
+ "license_management": "automatic",
+ "licenses": "18",
+ "plan_tier": "103"
+ },
+ "next_payment_attempt": null,
+ "number": "NORMALI-0001",
+ "object": "invoice",
+ "on_behalf_of": null,
+ "paid": false,
+ "paid_out_of_band": false,
+ "payment_intent": "pi_NORMALIZED00000000000001",
+ "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,
+ "quote": null,
+ "receipt_number": null,
+ "rendering": {
+ "amount_tax_display": null,
+ "pdf": {
+ "page_size": "letter"
+ }
+ },
+ "rendering_options": null,
+ "shipping_cost": null,
+ "shipping_details": null,
+ "starting_balance": 0,
+ "statement_descriptor": "Zulip Basic",
+ "status": "open",
+ "status_transitions": {
+ "finalized_at": 1000000000,
+ "marked_uncollectible_at": null,
+ "paid_at": null,
+ "voided_at": null
+ },
+ "subscription": null,
+ "subscription_details": {
+ "metadata": null
+ },
+ "subtotal": 4300,
+ "subtotal_excluding_tax": 4300,
+ "tax": null,
+ "test_clock": null,
+ "total": 4300,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 4300,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": null
+ },
+ "previous_attributes": {
+ "effective_at": null,
+ "ending_balance": null,
+ "hosted_invoice_url": null,
+ "invoice_pdf": null,
+ "number": null,
+ "payment_intent": null,
+ "rendering": {
+ "pdf": {
+ "page_size": "auto"
+ }
+ },
+ "status": "draft",
+ "status_transitions": {
+ "finalized_at": null
+ }
+ }
+ },
+ "id": "evt_1OmTnSDEQaroqDjsfJh0duNX",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_NORMALIZED0003",
+ "idempotency_key": "7176fd98-a08f-45f5-9e56-c8be8049b1ee"
+ },
+ "type": "invoice.updated"
+ },
+ {
+ "api_version": "2020-08-27",
+ "created": 1000000000,
+ "data": {
+ "object": {
+ "amount": 4300,
+ "amount_capturable": 0,
+ "amount_details": {
+ "tip": {}
+ },
+ "amount_received": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "automatic_payment_methods": null,
+ "canceled_at": null,
+ "cancellation_reason": null,
+ "capture_method": "automatic",
+ "charges": {
+ "data": [],
+ "has_more": false,
+ "object": "list",
+ "total_count": 0,
+ "url": "/v1/charges?payment_intent=pi_NORMALIZED00000000000001"
+ },
+ "client_secret": "pi_NORMALIZED00000000000001_secret_ZUDoff9kiNkJzGbnuLTTgZLKu",
+ "confirmation_method": "automatic",
+ "created": 1000000000,
+ "currency": "usd",
+ "customer": "cus_NORMALIZED0001",
+ "description": "Payment for Invoice",
+ "id": "pi_NORMALIZED00000000000001",
+ "invoice": "in_NORMALIZED00000000000001",
+ "last_payment_error": null,
+ "latest_charge": null,
+ "livemode": false,
+ "metadata": {},
+ "next_action": null,
+ "object": "payment_intent",
+ "on_behalf_of": null,
+ "payment_method": null,
+ "payment_method_configuration_details": null,
+ "payment_method_options": {
+ "card": {
+ "installments": null,
+ "mandate_options": null,
+ "network": null,
+ "request_three_d_secure": "automatic"
+ },
+ "cashapp": {}
+ },
+ "payment_method_types": [
+ "card",
+ "cashapp"
+ ],
+ "processing": null,
+ "receipt_email": "[email protected]",
+ "review": null,
+ "setup_future_usage": null,
+ "shipping": null,
+ "source": null,
+ "statement_descriptor": "Zulip Basic",
+ "statement_descriptor_suffix": null,
+ "status": "requires_payment_method",
+ "transfer_data": null,
+ "transfer_group": null
+ }
+ },
+ "id": "evt_3OmTnSDEQaroqDjs01trj5nt",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_NORMALIZED0003",
+ "idempotency_key": "7176fd98-a08f-45f5-9e56-c8be8049b1ee"
+ },
+ "type": "payment_intent.created"
+ },
+ {
+ "api_version": "2020-08-27",
+ "created": 1000000000,
+ "data": {
+ "object": {
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 4300,
+ "amount_paid": 0,
+ "amount_remaining": 4300,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 0,
+ "attempted": false,
+ "auto_advance": false,
+ "automatic_tax": {
+ "enabled": false,
+ "liability": null,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": null,
+ "collection_method": "charge_automatically",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_NORMALIZED0001",
+ "customer_address": null,
+ "customer_email": "[email protected]",
+ "customer_name": null,
+ "customer_phone": null,
+ "customer_shipping": null,
+ "customer_tax_exempt": "none",
+ "customer_tax_ids": [],
+ "default_payment_method": null,
+ "default_source": null,
+ "default_tax_rates": [],
+ "description": null,
+ "discount": null,
+ "discounts": [],
+ "due_date": null,
+ "effective_at": null,
+ "ending_balance": null,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": null,
+ "id": "in_NORMALIZED00000000000001",
+ "invoice_pdf": null,
+ "issuer": {
+ "type": "self"
+ },
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": -2000,
+ "amount_excluding_tax": -2000,
+ "currency": "usd",
+ "description": "$20.00/month new customer discount",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_NORMALIZED00000000000001",
+ "invoice": "in_NORMALIZED00000000000001",
+ "invoice_item": "ii_NORMALIZED00000000000001",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1000000000,
+ "start": 1000000000
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000001",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0001",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -2000,
+ "unit_amount_decimal": "-2000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-2000"
+ },
+ {
+ "amount": 6300,
+ "amount_excluding_tax": 6300,
+ "currency": "usd",
+ "description": "Zulip Basic",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_NORMALIZED00000000000002",
+ "invoice": "in_NORMALIZED00000000000001",
+ "invoice_item": "ii_NORMALIZED00000000000002",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1000000000,
+ "start": 1000000000
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000002",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0002",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 350,
+ "unit_amount_decimal": "350"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 18,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "350"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 2,
+ "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"
+ },
+ "livemode": false,
+ "metadata": {
+ "billing_schedule": "2",
+ "license_management": "automatic",
+ "licenses": "18",
+ "plan_tier": "103"
+ },
+ "next_payment_attempt": null,
+ "number": null,
+ "object": "invoice",
+ "on_behalf_of": null,
+ "paid": false,
+ "paid_out_of_band": false,
+ "payment_intent": null,
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1000000000,
+ "period_start": 1000000000,
+ "post_payment_credit_notes_amount": 0,
+ "pre_payment_credit_notes_amount": 0,
+ "quote": null,
+ "receipt_number": null,
+ "rendering": {
+ "amount_tax_display": null,
+ "pdf": {
+ "page_size": "auto"
+ }
+ },
+ "rendering_options": null,
+ "shipping_cost": null,
+ "shipping_details": null,
+ "starting_balance": 0,
+ "statement_descriptor": "Zulip Basic",
+ "status": "draft",
+ "status_transitions": {
+ "finalized_at": null,
+ "marked_uncollectible_at": null,
+ "paid_at": null,
+ "voided_at": null
+ },
+ "subscription": null,
+ "subscription_details": {
+ "metadata": null
+ },
+ "subtotal": 4300,
+ "subtotal_excluding_tax": 4300,
+ "tax": null,
+ "test_clock": null,
+ "total": 4300,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 4300,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": null
+ }
+ },
+ "id": "evt_1OmTnRDEQaroqDjs2cjkxUQH",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_NORMALIZED0004",
+ "idempotency_key": "83d05827-b023-420d-abcb-d9991cc514a4"
+ },
+ "type": "invoice.created"
+ },
+ {
+ "api_version": "2020-08-27",
+ "created": 1000000000,
+ "data": {
+ "object": {
+ "amount": -2000,
+ "currency": "usd",
+ "customer": "cus_NORMALIZED0001",
+ "date": 1000000000,
+ "description": "$20.00/month new customer discount",
+ "discountable": false,
+ "discounts": [],
+ "id": "ii_NORMALIZED00000000000001",
+ "invoice": null,
+ "livemode": false,
+ "metadata": {},
+ "object": "invoiceitem",
+ "period": {
+ "end": 1000000000,
+ "start": 1000000000
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000001",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0001",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -2000,
+ "unit_amount_decimal": "-2000"
+ },
+ "proration": false,
+ "quantity": 1,
+ "subscription": null,
+ "tax_rates": [],
+ "test_clock": null,
+ "unit_amount": -2000,
+ "unit_amount_decimal": "-2000"
+ }
+ },
+ "id": "evt_1OmTnRDEQaroqDjsTvBynnu4",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_NORMALIZED0005",
+ "idempotency_key": "a3142a65-946f-4107-82ad-cfbc956cc9ab"
+ },
+ "type": "invoiceitem.created"
+ },
+ {
+ "api_version": "2020-08-27",
+ "created": 1000000000,
+ "data": {
+ "object": {
+ "amount": 6300,
+ "currency": "usd",
+ "customer": "cus_NORMALIZED0001",
+ "date": 1000000000,
+ "description": "Zulip Basic",
+ "discountable": false,
+ "discounts": [],
+ "id": "ii_NORMALIZED00000000000002",
+ "invoice": null,
+ "livemode": false,
+ "metadata": {},
+ "object": "invoiceitem",
+ "period": {
+ "end": 1000000000,
+ "start": 1000000000
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000002",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0002",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 350,
+ "unit_amount_decimal": "350"
+ },
+ "proration": false,
+ "quantity": 18,
+ "subscription": null,
+ "tax_rates": [],
+ "test_clock": null,
+ "unit_amount": 350,
+ "unit_amount_decimal": "350"
+ }
+ },
+ "id": "evt_1OmTnQDEQaroqDjsYu5SxKGQ",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_NORMALIZED0006",
+ "idempotency_key": "f565be8e-724a-4a5b-9c6b-f5746e9a5dfb"
+ },
+ "type": "invoiceitem.created"
+ },
+ {
+ "api_version": "2020-08-27",
+ "created": 1000000000,
+ "data": {
+ "object": {
+ "address": null,
+ "balance": 0,
+ "created": 1000000000,
+ "currency": "usd",
+ "default_currency": "usd",
+ "default_source": null,
+ "delinquent": false,
+ "description": "demo.example.com 6cde5f7a-1f7",
+ "discount": null,
+ "email": "[email protected]",
+ "id": "cus_NORMALIZED0001",
+ "invoice_prefix": "NORMA01",
+ "invoice_settings": {
+ "custom_fields": null,
+ "default_payment_method": "pm_1OmTnMDEQaroqDjsXJSvs7og",
+ "footer": null,
+ "rendering_options": null
+ },
+ "livemode": false,
+ "metadata": {
+ "remote_server_str": "demo.example.com 6cde5f7a-1f7",
+ "remote_server_uuid": "6cde5f7a-1f7e-4978-9716-49f69ebfc9fe"
+ },
+ "name": null,
+ "next_invoice_sequence": 1,
+ "object": "customer",
+ "phone": null,
+ "preferred_locales": [],
+ "shipping": null,
+ "tax_exempt": "none",
+ "test_clock": null
+ },
+ "previous_attributes": {
+ "currency": null,
+ "default_currency": null
+ }
+ },
+ "id": "evt_1OmTnQDEQaroqDjspLw3lxpT",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_NORMALIZED0006",
+ "idempotency_key": "f565be8e-724a-4a5b-9c6b-f5746e9a5dfb"
+ },
+ "type": "customer.updated"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "url": "/v1/events"
+}
diff --git a/corporate/tests/stripe_fixtures/free_trial_not_available_for_ended_legacy_customer--Event.list.3.json b/corporate/tests/stripe_fixtures/free_trial_not_available_for_ended_legacy_customer--Event.list.3.json
new file mode 100644
index 00000000000..30345b03258
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/free_trial_not_available_for_ended_legacy_customer--Event.list.3.json
@@ -0,0 +1,487 @@
+{
+ "data": [
+ {
+ "api_version": "2020-08-27",
+ "created": 1000000000,
+ "data": {
+ "object": {
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 4300,
+ "amount_paid": 4300,
+ "amount_remaining": 0,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 1,
+ "attempted": true,
+ "auto_advance": false,
+ "automatic_tax": {
+ "enabled": false,
+ "liability": null,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": "ch_NORMALIZED00000000000001",
+ "collection_method": "charge_automatically",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_NORMALIZED0001",
+ "customer_address": null,
+ "customer_email": "[email protected]",
+ "customer_name": null,
+ "customer_phone": null,
+ "customer_shipping": null,
+ "customer_tax_exempt": "none",
+ "customer_tax_ids": [],
+ "default_payment_method": null,
+ "default_source": null,
+ "default_tax_rates": [],
+ "description": null,
+ "discount": null,
+ "discounts": [],
+ "due_date": null,
+ "effective_at": 1000000000,
+ "ending_balance": 0,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QYmhCdjYxQ1RRQWk5NFBDQXlrbEF6akkwZmNNSHIwLDk5MTE2NTMz0200noOCGhEX?s=ap",
+ "id": "in_NORMALIZED00000000000001",
+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QYmhCdjYxQ1RRQWk5NFBDQXlrbEF6akkwZmNNSHIwLDk5MTE2NTMz0200noOCGhEX/pdf?s=ap",
+ "issuer": {
+ "type": "self"
+ },
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": -2000,
+ "amount_excluding_tax": -2000,
+ "currency": "usd",
+ "description": "$20.00/month new customer discount",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_NORMALIZED00000000000001",
+ "invoice": "in_NORMALIZED00000000000001",
+ "invoice_item": "ii_NORMALIZED00000000000001",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1000000000,
+ "start": 1000000000
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000001",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0001",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -2000,
+ "unit_amount_decimal": "-2000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-2000"
+ },
+ {
+ "amount": 6300,
+ "amount_excluding_tax": 6300,
+ "currency": "usd",
+ "description": "Zulip Basic",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_NORMALIZED00000000000002",
+ "invoice": "in_NORMALIZED00000000000001",
+ "invoice_item": "ii_NORMALIZED00000000000002",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1000000000,
+ "start": 1000000000
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000002",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0002",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 350,
+ "unit_amount_decimal": "350"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 18,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "350"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 2,
+ "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"
+ },
+ "livemode": false,
+ "metadata": {
+ "billing_schedule": "2",
+ "license_management": "automatic",
+ "licenses": "18",
+ "plan_tier": "103"
+ },
+ "next_payment_attempt": null,
+ "number": "NORMALI-0002",
+ "object": "invoice",
+ "on_behalf_of": null,
+ "paid": true,
+ "paid_out_of_band": false,
+ "payment_intent": "pi_NORMALIZED00000000000001",
+ "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,
+ "quote": null,
+ "receipt_number": null,
+ "rendering": {
+ "amount_tax_display": null,
+ "pdf": {
+ "page_size": "letter"
+ }
+ },
+ "rendering_options": null,
+ "shipping_cost": null,
+ "shipping_details": null,
+ "starting_balance": 0,
+ "statement_descriptor": "Zulip Basic",
+ "status": "paid",
+ "status_transitions": {
+ "finalized_at": 1000000000,
+ "marked_uncollectible_at": null,
+ "paid_at": 1000000000,
+ "voided_at": null
+ },
+ "subscription": null,
+ "subscription_details": {
+ "metadata": null
+ },
+ "subtotal": 4300,
+ "subtotal_excluding_tax": 4300,
+ "tax": null,
+ "test_clock": null,
+ "total": 4300,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 4300,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": 1000000000
+ }
+ },
+ "id": "evt_1OmTnVDEQaroqDjswuHlifKh",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 2,
+ "request": {
+ "id": "req_NORMALIZED0002",
+ "idempotency_key": "29906042-b934-42b5-9c9b-10ba955641d0"
+ },
+ "type": "invoice.paid"
+ },
+ {
+ "api_version": "2020-08-27",
+ "created": 1000000000,
+ "data": {
+ "object": {
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 4300,
+ "amount_paid": 4300,
+ "amount_remaining": 0,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 1,
+ "attempted": true,
+ "auto_advance": false,
+ "automatic_tax": {
+ "enabled": false,
+ "liability": null,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": "ch_NORMALIZED00000000000001",
+ "collection_method": "charge_automatically",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_NORMALIZED0001",
+ "customer_address": null,
+ "customer_email": "[email protected]",
+ "customer_name": null,
+ "customer_phone": null,
+ "customer_shipping": null,
+ "customer_tax_exempt": "none",
+ "customer_tax_ids": [],
+ "default_payment_method": null,
+ "default_source": null,
+ "default_tax_rates": [],
+ "description": null,
+ "discount": null,
+ "discounts": [],
+ "due_date": null,
+ "effective_at": 1000000000,
+ "ending_balance": 0,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QYmhCdjYxQ1RRQWk5NFBDQXlrbEF6akkwZmNNSHIwLDk5MTE2NTMz0200noOCGhEX?s=ap",
+ "id": "in_NORMALIZED00000000000001",
+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QYmhCdjYxQ1RRQWk5NFBDQXlrbEF6akkwZmNNSHIwLDk5MTE2NTMz0200noOCGhEX/pdf?s=ap",
+ "issuer": {
+ "type": "self"
+ },
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": -2000,
+ "amount_excluding_tax": -2000,
+ "currency": "usd",
+ "description": "$20.00/month new customer discount",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_NORMALIZED00000000000001",
+ "invoice": "in_NORMALIZED00000000000001",
+ "invoice_item": "ii_NORMALIZED00000000000001",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1000000000,
+ "start": 1000000000
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000001",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0001",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -2000,
+ "unit_amount_decimal": "-2000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-2000"
+ },
+ {
+ "amount": 6300,
+ "amount_excluding_tax": 6300,
+ "currency": "usd",
+ "description": "Zulip Basic",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_NORMALIZED00000000000002",
+ "invoice": "in_NORMALIZED00000000000001",
+ "invoice_item": "ii_NORMALIZED00000000000002",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1000000000,
+ "start": 1000000000
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000002",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0002",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 350,
+ "unit_amount_decimal": "350"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 18,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "350"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 2,
+ "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"
+ },
+ "livemode": false,
+ "metadata": {
+ "billing_schedule": "2",
+ "license_management": "automatic",
+ "licenses": "18",
+ "plan_tier": "103"
+ },
+ "next_payment_attempt": null,
+ "number": "NORMALI-0002",
+ "object": "invoice",
+ "on_behalf_of": null,
+ "paid": true,
+ "paid_out_of_band": false,
+ "payment_intent": "pi_NORMALIZED00000000000001",
+ "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,
+ "quote": null,
+ "receipt_number": null,
+ "rendering": {
+ "amount_tax_display": null,
+ "pdf": {
+ "page_size": "letter"
+ }
+ },
+ "rendering_options": null,
+ "shipping_cost": null,
+ "shipping_details": null,
+ "starting_balance": 0,
+ "statement_descriptor": "Zulip Basic",
+ "status": "paid",
+ "status_transitions": {
+ "finalized_at": 1000000000,
+ "marked_uncollectible_at": null,
+ "paid_at": 1000000000,
+ "voided_at": null
+ },
+ "subscription": null,
+ "subscription_details": {
+ "metadata": null
+ },
+ "subtotal": 4300,
+ "subtotal_excluding_tax": 4300,
+ "tax": null,
+ "test_clock": null,
+ "total": 4300,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 4300,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": 1000000000
+ },
+ "previous_attributes": {
+ "amount_paid": 0,
+ "amount_remaining": 4300,
+ "attempt_count": 0,
+ "attempted": false,
+ "charge": null,
+ "paid": false,
+ "status": "open",
+ "status_transitions": {
+ "paid_at": null
+ }
+ }
+ },
+ "id": "evt_1OmTnVDEQaroqDjsJfujbbkw",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_NORMALIZED0002",
+ "idempotency_key": "29906042-b934-42b5-9c9b-10ba955641d0"
+ },
+ "type": "invoice.updated"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "url": "/v1/events"
+}
diff --git a/corporate/tests/stripe_fixtures/free_trial_not_available_for_ended_legacy_customer--Event.list.4.json b/corporate/tests/stripe_fixtures/free_trial_not_available_for_ended_legacy_customer--Event.list.4.json
new file mode 100644
index 00000000000..2cb9edc25f3
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/free_trial_not_available_for_ended_legacy_customer--Event.list.4.json
@@ -0,0 +1,241 @@
+{
+ "data": [
+ {
+ "api_version": "2020-08-27",
+ "created": 1000000000,
+ "data": {
+ "object": {
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 4300,
+ "amount_paid": 4300,
+ "amount_remaining": 0,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 1,
+ "attempted": true,
+ "auto_advance": false,
+ "automatic_tax": {
+ "enabled": false,
+ "liability": null,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": "ch_NORMALIZED00000000000001",
+ "collection_method": "charge_automatically",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_NORMALIZED0001",
+ "customer_address": null,
+ "customer_email": "[email protected]",
+ "customer_name": null,
+ "customer_phone": null,
+ "customer_shipping": null,
+ "customer_tax_exempt": "none",
+ "customer_tax_ids": [],
+ "default_payment_method": null,
+ "default_source": null,
+ "default_tax_rates": [],
+ "description": null,
+ "discount": null,
+ "discounts": [],
+ "due_date": null,
+ "effective_at": 1000000000,
+ "ending_balance": 0,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QYmhCdjYxQ1RRQWk5NFBDQXlrbEF6akkwZmNNSHIwLDk5MTE2NTMz0200noOCGhEX?s=ap",
+ "id": "in_NORMALIZED00000000000001",
+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QYmhCdjYxQ1RRQWk5NFBDQXlrbEF6akkwZmNNSHIwLDk5MTE2NTMz0200noOCGhEX/pdf?s=ap",
+ "issuer": {
+ "type": "self"
+ },
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": -2000,
+ "amount_excluding_tax": -2000,
+ "currency": "usd",
+ "description": "$20.00/month new customer discount",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_NORMALIZED00000000000001",
+ "invoice": "in_NORMALIZED00000000000001",
+ "invoice_item": "ii_NORMALIZED00000000000001",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1000000000,
+ "start": 1000000000
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000001",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0001",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -2000,
+ "unit_amount_decimal": "-2000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-2000"
+ },
+ {
+ "amount": 6300,
+ "amount_excluding_tax": 6300,
+ "currency": "usd",
+ "description": "Zulip Basic",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_NORMALIZED00000000000002",
+ "invoice": "in_NORMALIZED00000000000001",
+ "invoice_item": "ii_NORMALIZED00000000000002",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1000000000,
+ "start": 1000000000
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000002",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0002",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 350,
+ "unit_amount_decimal": "350"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 18,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "350"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 2,
+ "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"
+ },
+ "livemode": false,
+ "metadata": {
+ "billing_schedule": "2",
+ "license_management": "automatic",
+ "licenses": "18",
+ "plan_tier": "103"
+ },
+ "next_payment_attempt": null,
+ "number": "NORMALI-0002",
+ "object": "invoice",
+ "on_behalf_of": null,
+ "paid": true,
+ "paid_out_of_band": false,
+ "payment_intent": "pi_NORMALIZED00000000000001",
+ "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,
+ "quote": null,
+ "receipt_number": null,
+ "rendering": {
+ "amount_tax_display": null,
+ "pdf": {
+ "page_size": "letter"
+ }
+ },
+ "rendering_options": null,
+ "shipping_cost": null,
+ "shipping_details": null,
+ "starting_balance": 0,
+ "statement_descriptor": "Zulip Basic",
+ "status": "paid",
+ "status_transitions": {
+ "finalized_at": 1000000000,
+ "marked_uncollectible_at": null,
+ "paid_at": 1000000000,
+ "voided_at": null
+ },
+ "subscription": null,
+ "subscription_details": {
+ "metadata": null
+ },
+ "subtotal": 4300,
+ "subtotal_excluding_tax": 4300,
+ "tax": null,
+ "test_clock": null,
+ "total": 4300,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 4300,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": 1000000000
+ }
+ },
+ "id": "evt_1OmTnVDEQaroqDjsplJmhFMQ",
+ "livemode": false,
+ "object": "event",
+ "pending_webhooks": 0,
+ "request": {
+ "id": "req_NORMALIZED0002",
+ "idempotency_key": "29906042-b934-42b5-9c9b-10ba955641d0"
+ },
+ "type": "invoice.payment_succeeded"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "url": "/v1/events"
+}
diff --git a/corporate/tests/stripe_fixtures/free_trial_not_available_for_ended_legacy_customer--Event.list.5.json b/corporate/tests/stripe_fixtures/free_trial_not_available_for_ended_legacy_customer--Event.list.5.json
new file mode 100644
index 00000000000..6d922067afe
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/free_trial_not_available_for_ended_legacy_customer--Event.list.5.json
@@ -0,0 +1,6 @@
+{
+ "data": [],
+ "has_more": false,
+ "object": "list",
+ "url": "/v1/events"
+}
diff --git a/corporate/tests/stripe_fixtures/free_trial_not_available_for_ended_legacy_customer--Invoice.create.1.json b/corporate/tests/stripe_fixtures/free_trial_not_available_for_ended_legacy_customer--Invoice.create.1.json
new file mode 100644
index 00000000000..4f060c1df9f
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/free_trial_not_available_for_ended_legacy_customer--Invoice.create.1.json
@@ -0,0 +1,219 @@
+{
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 4300,
+ "amount_paid": 0,
+ "amount_remaining": 4300,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 0,
+ "attempted": false,
+ "auto_advance": false,
+ "automatic_tax": {
+ "enabled": false,
+ "liability": null,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": null,
+ "collection_method": "charge_automatically",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_NORMALIZED0001",
+ "customer_address": null,
+ "customer_email": "[email protected]",
+ "customer_name": null,
+ "customer_phone": null,
+ "customer_shipping": null,
+ "customer_tax_exempt": "none",
+ "customer_tax_ids": [],
+ "default_payment_method": null,
+ "default_source": null,
+ "default_tax_rates": [],
+ "description": null,
+ "discount": null,
+ "discounts": [],
+ "due_date": null,
+ "effective_at": null,
+ "ending_balance": null,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": null,
+ "id": "in_NORMALIZED00000000000001",
+ "invoice_pdf": null,
+ "issuer": {
+ "type": "self"
+ },
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": -2000,
+ "amount_excluding_tax": -2000,
+ "currency": "usd",
+ "description": "$20.00/month new customer discount",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_NORMALIZED00000000000001",
+ "invoice": "in_NORMALIZED00000000000001",
+ "invoice_item": "ii_NORMALIZED00000000000001",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1000000000,
+ "start": 1000000000
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000001",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0001",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -2000,
+ "unit_amount_decimal": "-2000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-2000"
+ },
+ {
+ "amount": 6300,
+ "amount_excluding_tax": 6300,
+ "currency": "usd",
+ "description": "Zulip Basic",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_NORMALIZED00000000000002",
+ "invoice": "in_NORMALIZED00000000000001",
+ "invoice_item": "ii_NORMALIZED00000000000002",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1000000000,
+ "start": 1000000000
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000002",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0002",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 350,
+ "unit_amount_decimal": "350"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 18,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "350"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 2,
+ "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"
+ },
+ "livemode": false,
+ "metadata": {
+ "billing_schedule": "2",
+ "license_management": "automatic",
+ "licenses": "18",
+ "plan_tier": "103"
+ },
+ "next_payment_attempt": null,
+ "number": null,
+ "object": "invoice",
+ "on_behalf_of": null,
+ "paid": false,
+ "paid_out_of_band": false,
+ "payment_intent": null,
+ "payment_settings": {
+ "default_mandate": null,
+ "payment_method_options": null,
+ "payment_method_types": null
+ },
+ "period_end": 1000000000,
+ "period_start": 1000000000,
+ "post_payment_credit_notes_amount": 0,
+ "pre_payment_credit_notes_amount": 0,
+ "quote": null,
+ "receipt_number": null,
+ "rendering": {
+ "amount_tax_display": null,
+ "pdf": {
+ "page_size": "auto"
+ }
+ },
+ "rendering_options": null,
+ "shipping_cost": null,
+ "shipping_details": null,
+ "starting_balance": 0,
+ "statement_descriptor": "Zulip Basic",
+ "status": "draft",
+ "status_transitions": {
+ "finalized_at": null,
+ "marked_uncollectible_at": null,
+ "paid_at": null,
+ "voided_at": null
+ },
+ "subscription": null,
+ "subscription_details": {
+ "metadata": null
+ },
+ "subtotal": 4300,
+ "subtotal_excluding_tax": 4300,
+ "tax": null,
+ "test_clock": null,
+ "total": 4300,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 4300,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": null
+}
diff --git a/corporate/tests/stripe_fixtures/free_trial_not_available_for_ended_legacy_customer--Invoice.finalize_invoice.1.json b/corporate/tests/stripe_fixtures/free_trial_not_available_for_ended_legacy_customer--Invoice.finalize_invoice.1.json
new file mode 100644
index 00000000000..9513e04f02a
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/free_trial_not_available_for_ended_legacy_customer--Invoice.finalize_invoice.1.json
@@ -0,0 +1,219 @@
+{
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 4300,
+ "amount_paid": 0,
+ "amount_remaining": 4300,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 0,
+ "attempted": false,
+ "auto_advance": false,
+ "automatic_tax": {
+ "enabled": false,
+ "liability": null,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": null,
+ "collection_method": "charge_automatically",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_NORMALIZED0001",
+ "customer_address": null,
+ "customer_email": "[email protected]",
+ "customer_name": null,
+ "customer_phone": null,
+ "customer_shipping": null,
+ "customer_tax_exempt": "none",
+ "customer_tax_ids": [],
+ "default_payment_method": null,
+ "default_source": null,
+ "default_tax_rates": [],
+ "description": null,
+ "discount": null,
+ "discounts": [],
+ "due_date": null,
+ "effective_at": 1000000000,
+ "ending_balance": 0,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QYmhCdjYxQ1RRQWk5NFBDQXlrbEF6akkwZmNNSHIwLDk5MTE2NTMw0200kRUVZYHN?s=ap",
+ "id": "in_NORMALIZED00000000000001",
+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QYmhCdjYxQ1RRQWk5NFBDQXlrbEF6akkwZmNNSHIwLDk5MTE2NTMw0200kRUVZYHN/pdf?s=ap",
+ "issuer": {
+ "type": "self"
+ },
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": -2000,
+ "amount_excluding_tax": -2000,
+ "currency": "usd",
+ "description": "$20.00/month new customer discount",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_NORMALIZED00000000000001",
+ "invoice": "in_NORMALIZED00000000000001",
+ "invoice_item": "ii_NORMALIZED00000000000001",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1000000000,
+ "start": 1000000000
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000001",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0001",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -2000,
+ "unit_amount_decimal": "-2000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-2000"
+ },
+ {
+ "amount": 6300,
+ "amount_excluding_tax": 6300,
+ "currency": "usd",
+ "description": "Zulip Basic",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_NORMALIZED00000000000002",
+ "invoice": "in_NORMALIZED00000000000001",
+ "invoice_item": "ii_NORMALIZED00000000000002",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1000000000,
+ "start": 1000000000
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000002",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0002",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 350,
+ "unit_amount_decimal": "350"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 18,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "350"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 2,
+ "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"
+ },
+ "livemode": false,
+ "metadata": {
+ "billing_schedule": "2",
+ "license_management": "automatic",
+ "licenses": "18",
+ "plan_tier": "103"
+ },
+ "next_payment_attempt": null,
+ "number": "NORMALI-0002",
+ "object": "invoice",
+ "on_behalf_of": null,
+ "paid": false,
+ "paid_out_of_band": false,
+ "payment_intent": "pi_NORMALIZED00000000000001",
+ "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,
+ "quote": null,
+ "receipt_number": null,
+ "rendering": {
+ "amount_tax_display": null,
+ "pdf": {
+ "page_size": "letter"
+ }
+ },
+ "rendering_options": null,
+ "shipping_cost": null,
+ "shipping_details": null,
+ "starting_balance": 0,
+ "statement_descriptor": "Zulip Basic",
+ "status": "open",
+ "status_transitions": {
+ "finalized_at": 1000000000,
+ "marked_uncollectible_at": null,
+ "paid_at": null,
+ "voided_at": null
+ },
+ "subscription": null,
+ "subscription_details": {
+ "metadata": null
+ },
+ "subtotal": 4300,
+ "subtotal_excluding_tax": 4300,
+ "tax": null,
+ "test_clock": null,
+ "total": 4300,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 4300,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": null
+}
diff --git a/corporate/tests/stripe_fixtures/free_trial_not_available_for_ended_legacy_customer--Invoice.list.1.json b/corporate/tests/stripe_fixtures/free_trial_not_available_for_ended_legacy_customer--Invoice.list.1.json
new file mode 100644
index 00000000000..e39960ab725
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/free_trial_not_available_for_ended_legacy_customer--Invoice.list.1.json
@@ -0,0 +1,6 @@
+{
+ "data": [],
+ "has_more": false,
+ "object": "list",
+ "url": "/v1/invoices"
+}
diff --git a/corporate/tests/stripe_fixtures/free_trial_not_available_for_ended_legacy_customer--Invoice.pay.1.json b/corporate/tests/stripe_fixtures/free_trial_not_available_for_ended_legacy_customer--Invoice.pay.1.json
new file mode 100644
index 00000000000..ab0d215f278
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/free_trial_not_available_for_ended_legacy_customer--Invoice.pay.1.json
@@ -0,0 +1,219 @@
+{
+ "account_country": "US",
+ "account_name": "Kandra Labs, Inc.",
+ "account_tax_ids": null,
+ "amount_due": 4300,
+ "amount_paid": 4300,
+ "amount_remaining": 0,
+ "amount_shipping": 0,
+ "application": null,
+ "application_fee_amount": null,
+ "attempt_count": 1,
+ "attempted": true,
+ "auto_advance": false,
+ "automatic_tax": {
+ "enabled": false,
+ "liability": null,
+ "status": null
+ },
+ "billing_reason": "manual",
+ "charge": "ch_NORMALIZED00000000000001",
+ "collection_method": "charge_automatically",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_fields": null,
+ "customer": "cus_NORMALIZED0001",
+ "customer_address": null,
+ "customer_email": "[email protected]",
+ "customer_name": null,
+ "customer_phone": null,
+ "customer_shipping": null,
+ "customer_tax_exempt": "none",
+ "customer_tax_ids": [],
+ "default_payment_method": null,
+ "default_source": null,
+ "default_tax_rates": [],
+ "description": null,
+ "discount": null,
+ "discounts": [],
+ "due_date": null,
+ "effective_at": 1000000000,
+ "ending_balance": 0,
+ "footer": null,
+ "from_invoice": null,
+ "hosted_invoice_url": "https://invoice.stripe.com/i/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QYmhCdjYxQ1RRQWk5NFBDQXlrbEF6akkwZmNNSHIwLDk5MTE2NTMy0200cCzjjY4e?s=ap",
+ "id": "in_NORMALIZED00000000000001",
+ "invoice_pdf": "https://pay.stripe.com/invoice/acct_NORMALIZED000001/test_NORMALIZED01a3dERVFhcm9xRGpzLF9QYmhCdjYxQ1RRQWk5NFBDQXlrbEF6akkwZmNNSHIwLDk5MTE2NTMy0200cCzjjY4e/pdf?s=ap",
+ "issuer": {
+ "type": "self"
+ },
+ "last_finalization_error": null,
+ "latest_revision": null,
+ "lines": {
+ "data": [
+ {
+ "amount": -2000,
+ "amount_excluding_tax": -2000,
+ "currency": "usd",
+ "description": "$20.00/month new customer discount",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_NORMALIZED00000000000001",
+ "invoice": "in_NORMALIZED00000000000001",
+ "invoice_item": "ii_NORMALIZED00000000000001",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1000000000,
+ "start": 1000000000
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000001",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0001",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -2000,
+ "unit_amount_decimal": "-2000"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 1,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "-2000"
+ },
+ {
+ "amount": 6300,
+ "amount_excluding_tax": 6300,
+ "currency": "usd",
+ "description": "Zulip Basic",
+ "discount_amounts": [],
+ "discountable": false,
+ "discounts": [],
+ "id": "il_NORMALIZED00000000000002",
+ "invoice": "in_NORMALIZED00000000000001",
+ "invoice_item": "ii_NORMALIZED00000000000002",
+ "livemode": false,
+ "metadata": {},
+ "object": "line_item",
+ "period": {
+ "end": 1000000000,
+ "start": 1000000000
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000002",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0002",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 350,
+ "unit_amount_decimal": "350"
+ },
+ "proration": false,
+ "proration_details": {
+ "credited_items": null
+ },
+ "quantity": 18,
+ "subscription": null,
+ "tax_amounts": [],
+ "tax_rates": [],
+ "type": "invoiceitem",
+ "unit_amount_excluding_tax": "350"
+ }
+ ],
+ "has_more": false,
+ "object": "list",
+ "total_count": 2,
+ "url": "/v1/invoices/in_NORMALIZED00000000000001/lines"
+ },
+ "livemode": false,
+ "metadata": {
+ "billing_schedule": "2",
+ "license_management": "automatic",
+ "licenses": "18",
+ "plan_tier": "103"
+ },
+ "next_payment_attempt": null,
+ "number": "NORMALI-0002",
+ "object": "invoice",
+ "on_behalf_of": null,
+ "paid": true,
+ "paid_out_of_band": false,
+ "payment_intent": "pi_NORMALIZED00000000000001",
+ "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,
+ "quote": null,
+ "receipt_number": null,
+ "rendering": {
+ "amount_tax_display": null,
+ "pdf": {
+ "page_size": "letter"
+ }
+ },
+ "rendering_options": null,
+ "shipping_cost": null,
+ "shipping_details": null,
+ "starting_balance": 0,
+ "statement_descriptor": "Zulip Basic",
+ "status": "paid",
+ "status_transitions": {
+ "finalized_at": 1000000000,
+ "marked_uncollectible_at": null,
+ "paid_at": 1000000000,
+ "voided_at": null
+ },
+ "subscription": null,
+ "subscription_details": {
+ "metadata": null
+ },
+ "subtotal": 4300,
+ "subtotal_excluding_tax": 4300,
+ "tax": null,
+ "test_clock": null,
+ "total": 4300,
+ "total_discount_amounts": [],
+ "total_excluding_tax": 4300,
+ "total_tax_amounts": [],
+ "transfer_data": null,
+ "webhooks_delivered_at": 1000000000
+}
diff --git a/corporate/tests/stripe_fixtures/free_trial_not_available_for_ended_legacy_customer--InvoiceItem.create.1.json b/corporate/tests/stripe_fixtures/free_trial_not_available_for_ended_legacy_customer--InvoiceItem.create.1.json
new file mode 100644
index 00000000000..12dc4667959
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/free_trial_not_available_for_ended_legacy_customer--InvoiceItem.create.1.json
@@ -0,0 +1,47 @@
+{
+ "amount": 6300,
+ "currency": "usd",
+ "customer": "cus_NORMALIZED0001",
+ "date": 1000000000,
+ "description": "Zulip Basic",
+ "discountable": false,
+ "discounts": [],
+ "id": "ii_NORMALIZED00000000000002",
+ "invoice": null,
+ "livemode": false,
+ "metadata": {},
+ "object": "invoiceitem",
+ "period": {
+ "end": 1000000000,
+ "start": 1000000000
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000002",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0002",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": 350,
+ "unit_amount_decimal": "350"
+ },
+ "proration": false,
+ "quantity": 18,
+ "subscription": null,
+ "tax_rates": [],
+ "test_clock": null,
+ "unit_amount": 350,
+ "unit_amount_decimal": "350"
+}
diff --git a/corporate/tests/stripe_fixtures/free_trial_not_available_for_ended_legacy_customer--InvoiceItem.create.2.json b/corporate/tests/stripe_fixtures/free_trial_not_available_for_ended_legacy_customer--InvoiceItem.create.2.json
new file mode 100644
index 00000000000..242630a6319
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/free_trial_not_available_for_ended_legacy_customer--InvoiceItem.create.2.json
@@ -0,0 +1,47 @@
+{
+ "amount": -2000,
+ "currency": "usd",
+ "customer": "cus_NORMALIZED0001",
+ "date": 1000000000,
+ "description": "$20.00/month new customer discount",
+ "discountable": false,
+ "discounts": [],
+ "id": "ii_NORMALIZED00000000000001",
+ "invoice": null,
+ "livemode": false,
+ "metadata": {},
+ "object": "invoiceitem",
+ "period": {
+ "end": 1000000000,
+ "start": 1000000000
+ },
+ "plan": null,
+ "price": {
+ "active": false,
+ "billing_scheme": "per_unit",
+ "created": 1000000000,
+ "currency": "usd",
+ "custom_unit_amount": null,
+ "id": "price_NORMALIZED00000000000001",
+ "livemode": false,
+ "lookup_key": null,
+ "metadata": {},
+ "nickname": null,
+ "object": "price",
+ "product": "prod_NORMALIZED0001",
+ "recurring": null,
+ "tax_behavior": "unspecified",
+ "tiers_mode": null,
+ "transform_quantity": null,
+ "type": "one_time",
+ "unit_amount": -2000,
+ "unit_amount_decimal": "-2000"
+ },
+ "proration": false,
+ "quantity": 1,
+ "subscription": null,
+ "tax_rates": [],
+ "test_clock": null,
+ "unit_amount": -2000,
+ "unit_amount_decimal": "-2000"
+}
diff --git a/corporate/tests/stripe_fixtures/free_trial_not_available_for_ended_legacy_customer--SetupIntent.create.1.json b/corporate/tests/stripe_fixtures/free_trial_not_available_for_ended_legacy_customer--SetupIntent.create.1.json
new file mode 100644
index 00000000000..355ce9f41be
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/free_trial_not_available_for_ended_legacy_customer--SetupIntent.create.1.json
@@ -0,0 +1,34 @@
+{
+ "application": null,
+ "automatic_payment_methods": null,
+ "cancellation_reason": null,
+ "client_secret": "seti_1OmTnMDEQaroqDjsp7p179yi_secret_PbhBGOjLkaTT0DQohUTp7yAd1MtTySE",
+ "created": 1000000000,
+ "customer": "cus_NORMALIZED0001",
+ "description": null,
+ "flow_directions": null,
+ "id": "seti_1OmTnMDEQaroqDjsp7p179yi",
+ "last_setup_error": null,
+ "latest_attempt": "setatt_1OmTnMDEQaroqDjsH6BnkKDO",
+ "livemode": false,
+ "mandate": null,
+ "metadata": {},
+ "next_action": null,
+ "object": "setup_intent",
+ "on_behalf_of": null,
+ "payment_method": "pm_1OmTnMDEQaroqDjsXJSvs7og",
+ "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/free_trial_not_available_for_ended_legacy_customer--SetupIntent.list.1.json b/corporate/tests/stripe_fixtures/free_trial_not_available_for_ended_legacy_customer--SetupIntent.list.1.json
new file mode 100644
index 00000000000..571dbff45f8
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/free_trial_not_available_for_ended_legacy_customer--SetupIntent.list.1.json
@@ -0,0 +1,41 @@
+{
+ "data": [
+ {
+ "application": null,
+ "automatic_payment_methods": null,
+ "cancellation_reason": null,
+ "client_secret": "seti_1OmTnLDEQaroqDjsYfcrAlYn_secret_PbhB8yVO1cA4OvqXVcBnSL5TUAM6hqJ",
+ "created": 1000000000,
+ "customer": "cus_NORMALIZED0001",
+ "description": null,
+ "flow_directions": null,
+ "id": "seti_1OmTnLDEQaroqDjsYfcrAlYn",
+ "last_setup_error": null,
+ "latest_attempt": null,
+ "livemode": false,
+ "mandate": null,
+ "metadata": {},
+ "next_action": null,
+ "object": "setup_intent",
+ "on_behalf_of": null,
+ "payment_method": null,
+ "payment_method_configuration_details": null,
+ "payment_method_options": {
+ "card": {
+ "mandate_options": null,
+ "network": null,
+ "request_three_d_secure": "automatic"
+ }
+ },
+ "payment_method_types": [
+ "card"
+ ],
+ "single_use_mandate": null,
+ "status": "requires_payment_method",
+ "usage": "off_session"
+ }
+ ],
+ "has_more": true,
+ "object": "list",
+ "url": "/v1/setup_intents"
+}
diff --git a/corporate/tests/stripe_fixtures/free_trial_not_available_for_ended_legacy_customer--SetupIntent.retrieve.1.json b/corporate/tests/stripe_fixtures/free_trial_not_available_for_ended_legacy_customer--SetupIntent.retrieve.1.json
new file mode 100644
index 00000000000..355ce9f41be
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/free_trial_not_available_for_ended_legacy_customer--SetupIntent.retrieve.1.json
@@ -0,0 +1,34 @@
+{
+ "application": null,
+ "automatic_payment_methods": null,
+ "cancellation_reason": null,
+ "client_secret": "seti_1OmTnMDEQaroqDjsp7p179yi_secret_PbhBGOjLkaTT0DQohUTp7yAd1MtTySE",
+ "created": 1000000000,
+ "customer": "cus_NORMALIZED0001",
+ "description": null,
+ "flow_directions": null,
+ "id": "seti_1OmTnMDEQaroqDjsp7p179yi",
+ "last_setup_error": null,
+ "latest_attempt": "setatt_1OmTnMDEQaroqDjsH6BnkKDO",
+ "livemode": false,
+ "mandate": null,
+ "metadata": {},
+ "next_action": null,
+ "object": "setup_intent",
+ "on_behalf_of": null,
+ "payment_method": "pm_1OmTnMDEQaroqDjsXJSvs7og",
+ "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/free_trial_not_available_for_ended_legacy_customer--checkout.Session.create.1.json b/corporate/tests/stripe_fixtures/free_trial_not_available_for_ended_legacy_customer--checkout.Session.create.1.json
new file mode 100644
index 00000000000..1a9440d877f
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/free_trial_not_available_for_ended_legacy_customer--checkout.Session.create.1.json
@@ -0,0 +1,75 @@
+{
+ "after_expiration": null,
+ "allow_promotion_codes": null,
+ "amount_subtotal": null,
+ "amount_total": null,
+ "automatic_tax": {
+ "enabled": false,
+ "liability": null,
+ "status": null
+ },
+ "billing_address_collection": "required",
+ "cancel_url": "http://selfhosting.testserver/server/6cde5f7a-1f7e-4978-9716-49f69ebfc9fe/upgrade/?manual_license_management=false&tier=1",
+ "client_reference_id": null,
+ "client_secret": null,
+ "consent": null,
+ "consent_collection": null,
+ "created": 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_NORMALIZED0001",
+ "customer_creation": null,
+ "customer_details": {
+ "address": null,
+ "email": "[email protected]",
+ "name": null,
+ "phone": null,
+ "tax_exempt": null,
+ "tax_ids": null
+ },
+ "customer_email": null,
+ "expires_at": 1000000000,
+ "id": "cs_test_NORMALIZED02eR4SBMTHiYbN8Dzr91OpRWqldiSzH4RQaETbiRVzGUTQ5G",
+ "invoice": null,
+ "invoice_creation": null,
+ "livemode": false,
+ "locale": null,
+ "metadata": {
+ "remote_server_user_id": "1",
+ "type": "card_update"
+ },
+ "mode": "setup",
+ "object": "checkout.session",
+ "payment_intent": null,
+ "payment_link": null,
+ "payment_method_collection": "always",
+ "payment_method_configuration_details": null,
+ "payment_method_options": {},
+ "payment_method_types": [
+ "card"
+ ],
+ "payment_status": "no_payment_required",
+ "phone_number_collection": {
+ "enabled": false
+ },
+ "recovered_from": null,
+ "setup_intent": "seti_1OmTnLDEQaroqDjsYfcrAlYn",
+ "shipping": null,
+ "shipping_address_collection": null,
+ "shipping_options": [],
+ "shipping_rate": null,
+ "status": "open",
+ "submit_type": null,
+ "subscription": null,
+ "success_url": "http://selfhosting.testserver/server/6cde5f7a-1f7e-4978-9716-49f69ebfc9fe/billing/event_status/?stripe_session_id={CHECKOUT_SESSION_ID}",
+ "total_details": null,
+ "ui_mode": "hosted",
+ "url": "https://checkout.stripe.com/c/pay/cs_test_NORMALIZED02eR4SBMTHiYbN8Dzr91OpRWqldiSzH4RQaETbiRVzGUTQ5G#fid1d2BpamRhQ2prcSc%2FJ1ZqcHdmYCVWZGt2JVV3aicpJ2R1bE5gfCc%2FJ3VuWnFgdnFaXVRmMU5zNkldQTY9SnNRY09XZml2UXNQJyknY3dqaFZgd3Ngdyc%2FcXdwYCknaWR8anBxUXx1YCc%2FJ3Zsa2JpYFpmamlwaGsnKSdga2RnaWBVaWRmYG1qaWFgd3YnP3F3cGB4JSUl"
+}
diff --git a/corporate/tests/stripe_fixtures/free_trial_not_available_for_ended_legacy_customer--checkout.Session.list.1.json b/corporate/tests/stripe_fixtures/free_trial_not_available_for_ended_legacy_customer--checkout.Session.list.1.json
new file mode 100644
index 00000000000..b96cac72568
--- /dev/null
+++ b/corporate/tests/stripe_fixtures/free_trial_not_available_for_ended_legacy_customer--checkout.Session.list.1.json
@@ -0,0 +1,82 @@
+{
+ "data": [
+ {
+ "after_expiration": null,
+ "allow_promotion_codes": null,
+ "amount_subtotal": null,
+ "amount_total": null,
+ "automatic_tax": {
+ "enabled": false,
+ "liability": null,
+ "status": null
+ },
+ "billing_address_collection": "required",
+ "cancel_url": "http://selfhosting.testserver/server/6cde5f7a-1f7e-4978-9716-49f69ebfc9fe/upgrade/?manual_license_management=false&tier=1",
+ "client_reference_id": null,
+ "client_secret": null,
+ "consent": null,
+ "consent_collection": null,
+ "created": 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_NORMALIZED0001",
+ "customer_creation": null,
+ "customer_details": {
+ "address": null,
+ "email": "[email protected]",
+ "name": null,
+ "phone": null,
+ "tax_exempt": null,
+ "tax_ids": null
+ },
+ "customer_email": null,
+ "expires_at": 1000000000,
+ "id": "cs_test_NORMALIZED02eR4SBMTHiYbN8Dzr91OpRWqldiSzH4RQaETbiRVzGUTQ5G",
+ "invoice": null,
+ "invoice_creation": null,
+ "livemode": false,
+ "locale": null,
+ "metadata": {
+ "remote_server_user_id": "1",
+ "type": "card_update"
+ },
+ "mode": "setup",
+ "object": "checkout.session",
+ "payment_intent": null,
+ "payment_link": null,
+ "payment_method_collection": "always",
+ "payment_method_configuration_details": null,
+ "payment_method_options": {},
+ "payment_method_types": [
+ "card"
+ ],
+ "payment_status": "no_payment_required",
+ "phone_number_collection": {
+ "enabled": false
+ },
+ "recovered_from": null,
+ "setup_intent": "seti_1OmTnLDEQaroqDjsYfcrAlYn",
+ "shipping": null,
+ "shipping_address_collection": null,
+ "shipping_options": [],
+ "shipping_rate": null,
+ "status": "open",
+ "submit_type": null,
+ "subscription": null,
+ "success_url": "http://selfhosting.testserver/server/6cde5f7a-1f7e-4978-9716-49f69ebfc9fe/billing/event_status/?stripe_session_id={CHECKOUT_SESSION_ID}",
+ "total_details": null,
+ "ui_mode": "hosted",
+ "url": "https://checkout.stripe.com/c/pay/cs_test_NORMALIZED02eR4SBMTHiYbN8Dzr91OpRWqldiSzH4RQaETbiRVzGUTQ5G#fid1d2BpamRhQ2prcSc%2FJ1ZqcHdmYCVWZGt2JVV3aicpJ2R1bE5gfCc%2FJ3VuWnFgdnFaXVRmMU5zNkldQTY9SnNRY09XZml2UXNQJyknY3dqaFZgd3Ngdyc%2FcXdwYCknaWR8anBxUXx1YCc%2FJ3Zsa2JpYFpmamlwaGsnKSdga2RnaWBVaWRmYG1qaWFgd3YnP3F3cGB4JSUl"
+ }
+ ],
+ "has_more": true,
+ "object": "list",
+ "url": "/v1/checkout/sessions"
+}
diff --git a/corporate/tests/test_stripe.py b/corporate/tests/test_stripe.py
index f913c76be71..019b404649b 100644
--- a/corporate/tests/test_stripe.py
+++ b/corporate/tests/test_stripe.py
@@ -92,6 +92,7 @@ from corporate.models import (
get_current_plan_by_realm,
get_customer_by_realm,
get_customer_by_remote_realm,
+ is_legacy_customer,
)
from corporate.tests.test_remote_billing import RemoteRealmBillingTestCase, RemoteServerTestCase
from corporate.views.remote_billing_page import generate_confirmation_link_for_server_deactivation
@@ -633,7 +634,18 @@ class StripeTestCase(ZulipTestCase):
return upgrade_json_response
is_self_hosted_billing = not isinstance(self.billing_session, RealmBillingSession)
- if invoice or not talk_to_stripe or is_free_trial_offer_enabled(is_self_hosted_billing):
+ customer = self.billing_session.get_customer()
+ assert customer is not None
+ if (
+ invoice
+ or not talk_to_stripe
+ or (
+ is_free_trial_offer_enabled(is_self_hosted_billing)
+ and
+ # Free trial is not applicable for legacy customers.
+ not is_legacy_customer(customer)
+ )
+ ):
# Upgrade already happened for free trial, invoice realms or schedule
# upgrade for legacy remote servers.
return upgrade_json_response
@@ -7729,6 +7741,97 @@ class TestRemoteServerBillingFlow(StripeTestCase, RemoteServerTestCase):
f"INFO:corporate.stripe:Change plan status: Customer.id: {customer.id}, CustomerPlan.id: {customer_plan.id}, status: {CustomerPlan.ACTIVE}",
)
+ @responses.activate
+ @mock_stripe()
+ def test_free_trial_not_available_for_active_legacy_customer(self, *mocks: Mock) -> None:
+ with self.settings(SELF_HOSTING_FREE_TRIAL_DAYS=30):
+ self.login("hamlet")
+ hamlet = self.example_user("hamlet")
+
+ self.add_mock_response()
+
+ with time_machine.travel(self.now, tick=False):
+ send_server_data_to_push_bouncer(consider_usage_statistics=False)
+ # Test that free trial is not available for customers with active legacy plan.
+ end_date = add_months(self.now, months=3)
+ self.billing_session.migrate_customer_to_legacy_plan(self.now, end_date)
+
+ result = self.execute_remote_billing_authentication_flow(
+ hamlet.delivery_email, hamlet.full_name
+ )
+ self.assertEqual(result.status_code, 302)
+ self.assertEqual(result["Location"], f"{self.billing_session.billing_base_url}/plans/")
+ with time_machine.travel(self.now, tick=False):
+ response = self.client_get(
+ f"{self.billing_session.billing_base_url}/plans/", subdomain="selfhosting"
+ )
+ self.assert_not_in_success_response(["free trial"], response)
+
+ with time_machine.travel(self.now, tick=False):
+ result = self.client_get(
+ f"{self.billing_session.billing_base_url}/upgrade/?tier={CustomerPlan.TIER_SELF_HOSTED_BASIC}",
+ subdomain="selfhosting",
+ )
+ self.assert_not_in_success_response(["free trial"], response)
+
+ with time_machine.travel(self.now, tick=False):
+ self.add_card_and_upgrade(
+ tier=CustomerPlan.TIER_SELF_HOSTED_BASIC, schedule="monthly"
+ )
+
+ with time_machine.travel(self.now + timedelta(days=1), tick=False):
+ response = self.client_get(
+ f"{self.billing_session.billing_base_url}/billing/", subdomain="selfhosting"
+ )
+ self.assert_not_in_success_response(["(free trial)"], response)
+
+ @responses.activate
+ @mock_stripe()
+ def test_free_trial_not_available_for_ended_legacy_customer(self, *mocks: Mock) -> None:
+ with self.settings(SELF_HOSTING_FREE_TRIAL_DAYS=30):
+ self.login("hamlet")
+ hamlet = self.example_user("hamlet")
+
+ self.add_mock_response()
+
+ with time_machine.travel(self.now, tick=False):
+ send_server_data_to_push_bouncer(consider_usage_statistics=False)
+ # Test that free trial is not available for customers with active legacy plan.
+ end_date = add_months(self.now, months=3)
+ self.billing_session.migrate_customer_to_legacy_plan(self.now, end_date)
+ CustomerPlan.objects.filter(customer__remote_server=self.remote_server).update(
+ status=CustomerPlan.ENDED
+ )
+
+ result = self.execute_remote_billing_authentication_flow(
+ hamlet.delivery_email, hamlet.full_name
+ )
+ self.assertEqual(result.status_code, 302)
+ self.assertEqual(result["Location"], f"{self.billing_session.billing_base_url}/plans/")
+ with time_machine.travel(self.now, tick=False):
+ response = self.client_get(
+ f"{self.billing_session.billing_base_url}/plans/", subdomain="selfhosting"
+ )
+ self.assert_not_in_success_response(["free trial"], response)
+
+ with time_machine.travel(self.now, tick=False):
+ result = self.client_get(
+ f"{self.billing_session.billing_base_url}/upgrade/?tier={CustomerPlan.TIER_SELF_HOSTED_BASIC}",
+ subdomain="selfhosting",
+ )
+ self.assert_not_in_success_response(["free trial"], response)
+
+ with time_machine.travel(self.now, tick=False):
+ self.add_card_and_upgrade(
+ tier=CustomerPlan.TIER_SELF_HOSTED_BASIC, schedule="monthly"
+ )
+
+ with time_machine.travel(self.now + timedelta(days=1), tick=False):
+ response = self.client_get(
+ f"{self.billing_session.billing_base_url}/billing/", subdomain="selfhosting"
+ )
+ self.assert_not_in_success_response(["(free trial)"], response)
+
@responses.activate
@mock_stripe()
def test_upgrade_user_to_basic_plan_free_trial_remote_server(self, *mocks: Mock) -> None:
diff --git a/corporate/views/portico.py b/corporate/views/portico.py
index 9d914f20d81..57f306915e0 100644
--- a/corporate/views/portico.py
+++ b/corporate/views/portico.py
@@ -21,7 +21,12 @@ from corporate.lib.stripe import (
get_configured_fixed_price_plan_offer,
get_free_trial_days,
)
-from corporate.models import CustomerPlan, get_current_plan_by_customer, get_customer_by_realm
+from corporate.models import (
+ CustomerPlan,
+ get_current_plan_by_customer,
+ get_customer_by_realm,
+ is_legacy_customer,
+)
from zerver.context_processors import get_realm_from_request, latest_info_context
from zerver.decorator import add_google_analytics, zulip_login_required
from zerver.lib.github import (
@@ -168,9 +173,6 @@ def remote_realm_plans_page(
if context.customer_plan is None:
context.on_free_tier = not context.is_sponsored
else:
- if context.customer_plan.tier == CustomerPlan.TIER_SELF_HOSTED_LEGACY:
- # Free trial is disabled for legacy customers.
- context.free_trial_days = None
context.on_free_tier = (
context.customer_plan.tier
in (
@@ -191,6 +193,10 @@ def remote_realm_plans_page(
status=CustomerPlan.NEVER_STARTED,
)
+ if is_legacy_customer(customer):
+ # Free trial is disabled for legacy customers.
+ context.free_trial_days = None
+
context.is_new_customer = (
not context.on_free_tier and context.customer_plan is None and not context.is_sponsored
)
@@ -234,9 +240,6 @@ def remote_server_plans_page(
if context.customer_plan is None:
context.on_free_tier = not context.is_sponsored
else:
- if context.customer_plan.tier == CustomerPlan.TIER_SELF_HOSTED_LEGACY:
- # Free trial is disabled for legacy customers.
- context.free_trial_days = None
context.on_free_tier = context.customer_plan.tier in (
CustomerPlan.TIER_SELF_HOSTED_LEGACY,
CustomerPlan.TIER_SELF_HOSTED_BASE,
@@ -253,6 +256,10 @@ def remote_server_plans_page(
status=CustomerPlan.NEVER_STARTED,
)
+ if is_legacy_customer(customer):
+ # Free trial is disabled for legacy customers.
+ context.free_trial_days = None
+
context.is_new_customer = (
not context.on_free_tier and context.customer_plan is None and not context.is_sponsored
)