From 09f0ea8aa79e7e4d1c1fc17cc604cd672a79ff52 Mon Sep 17 00:00:00 2001 From: Ahmed Darrazi Date: Fri, 5 Dec 2025 23:07:13 +0100 Subject: [PATCH] Fix: Cast Stripe subscription to correct type --- app/api/webhooks/stripe/route.ts | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/app/api/webhooks/stripe/route.ts b/app/api/webhooks/stripe/route.ts index a6f5578..d19af57 100644 --- a/app/api/webhooks/stripe/route.ts +++ b/app/api/webhooks/stripe/route.ts @@ -40,11 +40,7 @@ export async function POST(request: Request) { if (event.type === "checkout.session.completed") { const subscription = await stripe.subscriptions.retrieve( session.subscription as string - ); - - if (!subscription.current_period_end) { - return new Response("Invalid subscription data", { status: 400 }); - } + ) as Stripe.Subscription; const updatedData = { stripeSubscriptionId: subscription.id, @@ -85,11 +81,7 @@ export async function POST(request: Request) { // Retrieve the subscription details from Stripe. const subscription = await stripe.subscriptions.retrieve( session.subscription as string - ); - - if (!subscription.current_period_end) { - return new Response("Invalid subscription data", { status: 400 }); - } + ) as Stripe.Subscription; // Update the price id and set the new period end. await db