Open a-danae opened 1 year ago
Reported in 7213708-zen
in 7353108-zen, the user has alerted us that:
when using this button a coupon does not work properly
Can testing with a coupon be added to the testing instructions when a fix for this is made?
It's coming up to a year since this issue has been opened, any idea on when or if this will be fixed?
Describe the bug
The Google Pay UPE element (and likely Apple Pay too) fails to process the payment.
After investigation, this is happening due to the delay between the user gesture and the triggering of the wallet's modal.
To Reproduce Solve a higher-level issue:
Replication steps:
Something went wrong. Unable to show Google Pay. Please choose a different payment method and try again.
and an error in the browser console sayingUncaught DOMException: Failed to execute 'postMessage' on 'Window': Delegation is not allowed without transient user activation.
Expected behavior The payment must be processed successfully when selecting Google Pay.
Screenshots
https://github.com/woocommerce/woocommerce-gateway-stripe/assets/41606954/e52ec777-5c94-4785-8e68-502066ec40bd
Additional context This happens because the wallet’s payment modal must be triggered soon after a user gesture, and we need to run some API requests before the modal is triggered. In some cases, these requests delay displaying the modal longer than what’s allowed by the delegation’s threshold, thus triggering this error.
We’d need to reduce that delay to solve this problem. This likely means moving the API requests before the modal is triggered since we can’t control the time until the API responds. This would deserve a spike because it may or may not be feasible.
You can comment out this request for testing to make the button work in the block checkout. It's worth noting that this is just for testing and isn't an actual solution. There are other scenarios where this problem cannot be solved by commenting out a request.