From 761602b3d2a8d3f8db79843ec6e37424759d2c5f Mon Sep 17 00:00:00 2001 From: Baptiste Arnaud Date: Thu, 26 Jun 2025 09:19:42 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Better=20manage=20newly=20create?= =?UTF-8?q?d=20subscription=20in=20stripe=20webhook?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/billing/src/api/webhookHandler.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/billing/src/api/webhookHandler.ts b/packages/billing/src/api/webhookHandler.ts index c2204b55b..750e5df89 100644 --- a/packages/billing/src/api/webhookHandler.ts +++ b/packages/billing/src/api/webhookHandler.ts @@ -120,6 +120,11 @@ export const webhookHandler = async ( const subscription = event.data.object as Stripe.Subscription; const previous = event.data.previous_attributes; + if (previous?.status === "incomplete") + return res.send({ + message: "Subscription just created, skipping.", + }); + const existingWorkspace = await prisma.workspace.findFirst({ where: { stripeId: subscription.customer as string,