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