From cd76b9fb6d3204fcaf02e03b1bd08cafaf8d5c82 Mon Sep 17 00:00:00 2001 From: Rishabh Date: Tue, 24 May 2022 20:14:51 +0530 Subject: [PATCH] Removed empty customer email from checkout session payload - removes customerEmail sent as empty string when missing in some cases, which causes Stripe error in checkout session creation --- ghost/portal/src/utils/api.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ghost/portal/src/utils/api.js b/ghost/portal/src/utils/api.js index 006905717f..fb4bcc1ba4 100644 --- a/ghost/portal/src/utils/api.js +++ b/ghost/portal/src/utils/api.js @@ -335,9 +335,13 @@ function setupGhostApi({siteUrl = window.location.origin, apiUrl, apiKey}) { identity: identity, metadata: metadataObj, successUrl, - cancelUrl, - customerEmail: customerEmail + cancelUrl }; + + if (customerEmail) { + body.customerEmail = customerEmail; + } + if (tierId && cadence) { delete body.priceId; body.tierId = offerId ? null : tierId;