Billing - Fix credit upgrade invoice error (#21097)
In createImmediateUpgradeInvoice, the invoice is finalized with auto_advance: true, which causes Stripe to automatically attempt payment asynchronously. Then the explicit stripe.invoices.pay(invoice.id) call races against that auto-payment — if Stripe already paid it, this throws "Invoice is already paid". The fix is to finalize with auto_advance: false and keep the explicit pay call
This commit is contained in:
+1
-1
@@ -68,7 +68,7 @@ export class StripeInvoiceService {
|
||||
});
|
||||
|
||||
await this.stripe.invoices.finalizeInvoice(invoice.id, {
|
||||
auto_advance: true,
|
||||
auto_advance: false,
|
||||
});
|
||||
|
||||
await this.stripe.invoices.pay(invoice.id);
|
||||
|
||||
Reference in New Issue
Block a user