From 35923215b9ace10dfc196689a08a214f8214eef8 Mon Sep 17 00:00:00 2001 From: Baptiste Arnaud Date: Wed, 1 Jun 2022 12:29:36 +0200 Subject: [PATCH] =?UTF-8?q?fix(stripe):=20=F0=9F=90=9B=20Subscription=20ca?= =?UTF-8?q?ncel=20webhook?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/builder/pages/api/stripe/webhook.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/apps/builder/pages/api/stripe/webhook.ts b/apps/builder/pages/api/stripe/webhook.ts index d3b0f5eaf..8af6f37d6 100644 --- a/apps/builder/pages/api/stripe/webhook.ts +++ b/apps/builder/pages/api/stripe/webhook.ts @@ -54,12 +54,9 @@ const webhookHandler = async (req: NextApiRequest, res: NextApiResponse) => { } case 'customer.subscription.deleted': { const subscription = event.data.object as Stripe.Subscription - const { metadata } = subscription - if (!metadata.workspaceId) - return res.status(500).send(`workspaceId not found`) await prisma.workspace.update({ where: { - id: metadata.workspaceId, + stripeId: subscription.customer as string, }, data: { plan: Plan.FREE,