ECE/GooglePay/ApplePay JS error when payment fails from backend #9990
Labels
component: payment request button
Apple Pay, Google Pay, etc
focus: checkout payments
priority: high
The issue/PR is high priority—it affects lots of customers substantially, but not critically.
type: bug
The issue is a confirmed bug.
Describe the bug
I observed this both in the non-tokenized and the tokenized ECE.
When the backend fails a payment, we call the
paymentFailed( { reason: 'fail' } )
method:woocommerce-payments/client/express-checkout/blocks/hooks/use-express-checkout.js
Line 49 in cf6d2c1
woocommerce-payments/client/express-checkout/index.js
Line 109 in cf6d2c1
When this is triggered, a JS error occurs in the console:
To Reproduce
woocommerce-payments/client/express-checkout/event-handlers.js
Line 86 in cf6d2c1
Screenshots
The screenshot shows the reCaptcha plugins failing, but I can reproduce it also without said plugin.
Expected behavior
No JS error should appear when a payment fails.
It seems that we're calling
paymentFailed()
incorrectly.Additional context
The text was updated successfully, but these errors were encountered: