From 7aa6dab78a80baf7ceb131d74c2d05c74c807ed3 Mon Sep 17 00:00:00 2001 From: Baptiste Arnaud Date: Tue, 31 May 2022 11:59:21 +0200 Subject: [PATCH] =?UTF-8?q?fix(integration):=20=F0=9F=90=9B=20Empty=20rece?= =?UTF-8?q?ipt=20email?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/api/integrations/stripe/createPaymentIntent.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/viewer/pages/api/integrations/stripe/createPaymentIntent.ts b/apps/viewer/pages/api/integrations/stripe/createPaymentIntent.ts index 54ee530b2..9386947a0 100644 --- a/apps/viewer/pages/api/integrations/stripe/createPaymentIntent.ts +++ b/apps/viewer/pages/api/integrations/stripe/createPaymentIntent.ts @@ -58,12 +58,13 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => { ) if (isNaN(amount)) return badRequest(res) // Create a PaymentIntent with the order amount and currency + const receiptEmail = parseVariables(variables)( + inputOptions.additionalInformation?.email + ) const paymentIntent = await stripe.paymentIntents.create({ amount, currency: inputOptions.currency, - receipt_email: parseVariables(variables)( - inputOptions.additionalInformation?.email - ), + receipt_email: receiptEmail === '' ? undefined : receiptEmail, automatic_payment_methods: { enabled: true, },