From 985687ca8961a421f280e2d40314541aae6ebb54 Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 19 Jul 2023 18:30:22 -0400 Subject: [PATCH] minor bug fixed --- .env.sample | 3 ++- lib/api/paymentCheckout.ts | 4 ++-- types/enviornment.d.ts | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.env.sample b/.env.sample index 3413f7c..2140dd2 100644 --- a/.env.sample +++ b/.env.sample @@ -21,4 +21,5 @@ EMAIL_SERVER= STRIPE_SECRET_KEY= PRICE_ID= TRIAL_PERIOD_DAYS= -NEXT_PUBLIC_STRIPE_BILLING_PORTAL_URL= \ No newline at end of file +NEXT_PUBLIC_STRIPE_BILLING_PORTAL_URL= +BASE_URL=http://localhost:3000 \ No newline at end of file diff --git a/lib/api/paymentCheckout.ts b/lib/api/paymentCheckout.ts index 34f8e86..5610130 100644 --- a/lib/api/paymentCheckout.ts +++ b/lib/api/paymentCheckout.ts @@ -28,8 +28,8 @@ export default async function paymentCheckout( ], mode: "subscription", customer_email: isExistingCostomer ? undefined : email.toLowerCase(), - success_url: "http://localhost:3000?session_id={CHECKOUT_SESSION_ID}", - cancel_url: "http://localhost:3000/login", + success_url: `${process.env.BASE_URL}?session_id={CHECKOUT_SESSION_ID}`, + cancel_url: `${process.env.BASE_URL}/login`, automatic_tax: { enabled: true, }, diff --git a/types/enviornment.d.ts b/types/enviornment.d.ts index 0f32eb7..9655328 100644 --- a/types/enviornment.d.ts +++ b/types/enviornment.d.ts @@ -21,6 +21,7 @@ declare global { PRICE_ID?: string; NEXT_PUBLIC_STRIPE_BILLING_PORTAL_URL?: string; TRIAL_PERIOD_DAYS?: string; + BASE_URL?: string; } } }