From 381ca3205590b3e433fcec39ed29d88130bfa256 Mon Sep 17 00:00:00 2001 From: Etienne <45695613+etiennejouan@users.noreply.github.com> Date: Mon, 1 Jun 2026 15:55:06 +0200 Subject: [PATCH] Billing - Fix credit upgrade invoice error (#21097) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- .../billing/stripe/services/stripe-invoice.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/twenty-server/src/engine/core-modules/billing/stripe/services/stripe-invoice.service.ts b/packages/twenty-server/src/engine/core-modules/billing/stripe/services/stripe-invoice.service.ts index 183875b1e3..f91b4807ac 100644 --- a/packages/twenty-server/src/engine/core-modules/billing/stripe/services/stripe-invoice.service.ts +++ b/packages/twenty-server/src/engine/core-modules/billing/stripe/services/stripe-invoice.service.ts @@ -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);