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: Only attempt payment if invoice is not paid.

Aman Agrawalfbec6ab1236c
diff --git a/corporate/lib/stripe.py b/corporate/lib/stripe.py
index 27d9dd49843..174e0a19370 100644
--- a/corporate/lib/stripe.py
+++ b/corporate/lib/stripe.py
@@ -1189,8 +1189,8 @@ class BillingSession(ABC):
is_created_for_free_trial_upgrade=current_plan_id is not None and on_free_trial,
)
- if charge_automatically:
- # Stripe takes its sweet hour to charge customers after creating an invoice.
+ if stripe_invoice.status != "paid" and charge_automatically:
+ # Stripe can take its sweet hour to charge customers after creating an invoice.
# Since we want to charge customers immediately, we charge them manually.
# Then poll for the status of the invoice to see if the payment succeeded.
stripe_invoice = stripe.Invoice.pay(stripe_invoice.id)