From 5b5881183385b33819ad65e98e686bb883a1f2cc Mon Sep 17 00:00:00 2001 From: Laurent Cozic Date: Thu, 7 Oct 2021 14:19:40 +0100 Subject: [PATCH] Server: Add support for promotion codes --- Assets/WebsiteAssets/templates/plans.mustache | 10 +++--- packages/server/src/routes/index/stripe.ts | 34 +++++++++++++++---- 2 files changed, 32 insertions(+), 12 deletions(-) diff --git a/Assets/WebsiteAssets/templates/plans.mustache b/Assets/WebsiteAssets/templates/plans.mustache index f70c0ccf2..1a8579b02 100644 --- a/Assets/WebsiteAssets/templates/plans.mustache +++ b/Assets/WebsiteAssets/templates/plans.mustache @@ -59,7 +59,7 @@ + Promotion code:
@@ -455,7 +473,9 @@ const getHandlers: Record = { } function createSessionAndRedirect(priceId) { - createCheckoutSession(priceId).then(function(data) { + var promotionCode = document.getElementById('promotion_code').value; + + createCheckoutSession(priceId, promotionCode).then(function(data) { // Call Stripe.js method to redirect to the new Checkout page stripe .redirectToCheckout({