From 82e846baf86eb0795d0334eada0e03b204a8cd71 Mon Sep 17 00:00:00 2001 From: Baptiste Arnaud Date: Thu, 11 Sep 2025 10:59:47 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20auto=20cancel=20at=20period=20en?= =?UTF-8?q?d=20when=20subscription=20becomes=20"unpaid"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/billing/src/api/webhookHandler.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/billing/src/api/webhookHandler.ts b/packages/billing/src/api/webhookHandler.ts index aa71b815a..990500da3 100644 --- a/packages/billing/src/api/webhookHandler.ts +++ b/packages/billing/src/api/webhookHandler.ts @@ -208,6 +208,10 @@ export const webhookHandler = async ( previous.status !== "unpaid" && !existingWorkspace.isQuarantined ) { + if (!subscription.cancel_at_period_end) + await stripe.subscriptions.update(subscription.id, { + cancel_at_period_end: true, + }); await prisma.workspace.updateMany({ where: { id: existingWorkspace.id,