Skip to content

Commit

Permalink
add check for recaptcha token if stripe card
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewHEguardian committed Oct 25, 2024
1 parent 8924e28 commit ebf9a05
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -448,7 +453,6 @@ function OneTimeCheckoutComponent({
billingPostcode,
),
publicKey: stripePublicKey,
// ToDo: validate recaptchaToken for card payments
recaptchaToken: recaptchaToken ?? '',
paymentMethodId: paymentMethodResult.paymentMethod.id,
};
Expand Down

0 comments on commit ebf9a05

Please sign in to comment.