From a33779ce53ab9a2881a419d6077629309a41775c Mon Sep 17 00:00:00 2001 From: Josh Creek <8179928+jcreek@users.noreply.github.com> Date: Tue, 22 Oct 2024 19:16:09 +0100 Subject: [PATCH] fix(#45): Re-add email --- src/routes/api/subscribe/+server.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/routes/api/subscribe/+server.ts b/src/routes/api/subscribe/+server.ts index 403f5e4..bcd7168 100644 --- a/src/routes/api/subscribe/+server.ts +++ b/src/routes/api/subscribe/+server.ts @@ -50,6 +50,9 @@ export const POST: RequestHandler = async ({ request, cookies, locals: { safeGet if (stripeCustomerId) { // If the user has a Stripe customer ID, attach it to the checkout session stripeCheckoutSessionObject.customer = stripeCustomerId; + } else { + // If the user doesn't have a Stripe customer ID, create a new customer with their email + stripeCheckoutSessionObject.customer_email = userEmail; } // Create a subscription checkout session with Stripe