Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Google pay express onPaymentDataChanged not stopping the user from trying to pay while running #2804

Closed
joakimmillen opened this issue Aug 21, 2024 · 3 comments
Labels
Needs more info Further information is requested

Comments

@joakimmillen
Copy link

Describe the bug
Trying to upgrade 5.x to 6.x I noticed an issue with the google pay express callback onPaymentDataChanged.

The behaviour for us with 5.x was that while onPaymentDataChanged was running, you could still click the "pay" button in the google pay window. This seemed to queue up the onSubmit callback for when after the onPaymentDataChanged promise was resolved and then just carry on correctly after that.

With 6.x the behaviour is that if I click "pay" before the onPaymentDataChanged is done it will either start "loading" and then stop loading when the onPaymentDataChanged is resolved. Not triggering onSubmit or any other callback, just acting as though I never clicked on Pay. It might also throw an error:

Screenshot 2024-08-21 at 13 12 30

which makes sense, since I try to submit while the change handler is still running.

Expected behavior
The ideal solution would be if the google pay window would actually be in a loading state while the onPaymentDataChanged callback is running. I made sure that it was actually returning a promise that was resolved 5 seconds later to be sure that it was actually still running while the google pay window seemed to be "ready". I would assume that the reason for onPaymentDataChanged to return a promise is so that google knows that it is busy and should be loading.

The other behaviour would be the 5.x way where I can click the button but it seems to queue up the callbacks somehow? We have the same issue there with onPaymentDataChanged still running but I can click the pay button. This never results in the error in the provided image though, that only happens on 6.x.

Desktop (please complete the following information):

  • Mac OS Sonoma 14.1.2
  • Google Chrome
@ribeiroguilherme
Copy link
Contributor

Hi @joakimmillen ,

I tested on 6.x and I noticed the following: there are 2 moments that the onPaymentDataChanged is executed:

  • when the GooglePay overlay is initialized and it opens up: For this situation, I managed to reproduce the error that you showed above: onPaymentDataChanged is executed and the loader goes away even though the Promise is not resolved;
  • when the shopper changes the shipping address / delivery option: For this situation, it works as you described in the expected behavior. There is a loader in the UI (handled by the GooglePay overlay) and it goes away as soon as the Promise returned by the onPaymentDataChanged is resolved.

Can you tell me if you are experiencing the same flow on your side?

@ribeiroguilherme ribeiroguilherme added the Needs more info Further information is requested label Aug 22, 2024
@joakimmillen
Copy link
Author

@ribeiroguilherme yes I have the same experience, thank you

@ribeiroguilherme
Copy link
Contributor

@joakimmillen that is an issue on the GooglePay side - they are working on the fix. The GooglePay github issue is linked here, so you can follow up there if you wish. Thanks for flagging it

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Needs more info Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants