From ebf9a0564b237e152cff9a8963f09524dee64b2b Mon Sep 17 00:00:00 2001 From: andrewHEguardian <114918544+andrewHEguardian@users.noreply.github.com> Date: Fri, 25 Oct 2024 11:58:45 +0100 Subject: [PATCH] add check for recaptcha token if stripe card --- .../assets/pages/[countryGroupId]/oneTimeCheckout.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/support-frontend/assets/pages/[countryGroupId]/oneTimeCheckout.tsx b/support-frontend/assets/pages/[countryGroupId]/oneTimeCheckout.tsx index 516faaeaee..05b613e1ac 100644 --- a/support-frontend/assets/pages/[countryGroupId]/oneTimeCheckout.tsx +++ b/support-frontend/assets/pages/[countryGroupId]/oneTimeCheckout.tsx @@ -395,7 +395,12 @@ function OneTimeCheckoutComponent({ elements, }); } - if (paymentMethod === 'Stripe' && stripe && cardElement) { + if ( + paymentMethod === 'Stripe' && + stripe && + cardElement && + recaptchaToken + ) { paymentMethodResult = await stripe.createPaymentMethod({ type: 'card', card: cardElement, @@ -448,7 +453,6 @@ function OneTimeCheckoutComponent({ billingPostcode, ), publicKey: stripePublicKey, - // ToDo: validate recaptchaToken for card payments recaptchaToken: recaptchaToken ?? '', paymentMethodId: paymentMethodResult.paymentMethod.id, };