fix stripe configuration
This commit is contained in:
@@ -40,21 +40,20 @@ export async function createCheckoutSession(
|
||||
userId: string,
|
||||
email: string,
|
||||
priceId: string,
|
||||
successUrl: string,
|
||||
cancelUrl: string,
|
||||
returnUrl: string,
|
||||
) {
|
||||
const customerId = await getOrCreateCustomer(userId, email);
|
||||
|
||||
const session = await stripe.checkout.sessions.create({
|
||||
customer: customerId,
|
||||
mode: "subscription",
|
||||
ui_mode: "embedded_page",
|
||||
line_items: [{ price: priceId, quantity: 1 }],
|
||||
success_url: successUrl,
|
||||
cancel_url: cancelUrl,
|
||||
return_url: `${returnUrl}?session_id={CHECKOUT_SESSION_ID}`,
|
||||
metadata: { userId },
|
||||
});
|
||||
|
||||
return { url: session.url, sessionId: session.id };
|
||||
return { clientSecret: session.client_secret ?? "", sessionId: session.id };
|
||||
}
|
||||
|
||||
export async function createPortalSession(customerId: string, returnUrl: string) {
|
||||
|
||||
Reference in New Issue
Block a user