diff --git a/public/success.html b/public/success.html index 136dab91..2c4c8e21 100644 --- a/public/success.html +++ b/public/success.html @@ -3,9 +3,46 @@ - Document + Payment Successful + -

Success

+
+

Payment Successful!

+

Thank you for your purchase.

+ Return to Homepage +
diff --git a/src/controllers/handlePaymentsController.ts b/src/controllers/handlePaymentsController.ts index 25bb0ee4..4c589c80 100644 --- a/src/controllers/handlePaymentsController.ts +++ b/src/controllers/handlePaymentsController.ts @@ -60,11 +60,14 @@ export const handlePayments = async (req: Request, res: Response) => { } } } - + const successURL = + process.env.FRONT_END_BASEURL === '' + ? `${process.env.URL_HOST}/success.html` + : `${process.env.FRONT_END_BASEURL}/payment/success?ok=true`; const session = await stripe.checkout.sessions.create({ payment_method_types: ['card'], mode: 'payment', - success_url: `${process.env.URL_HOST}/success.html`, + success_url: successURL, line_items: lineItems, cancel_url: `${process.env.URL_HOST}/cancel.html`, metadata: {