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:
Etienne
2026-06-01 15:55:06 +02:00
committed by GitHub
parent 6029847491
commit 381ca32055
@@ -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);