Fix: Cast Stripe subscription to correct type
All checks were successful
Trigger Cloudarix Deploy / call-webhook (push) Successful in 1s
All checks were successful
Trigger Cloudarix Deploy / call-webhook (push) Successful in 1s
This commit is contained in:
parent
2e41bbc149
commit
09f0ea8aa7
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user