Adyen / adyen-web

Adyen Web Drop-in and Components
https://docs.adyen.com/online-payments
MIT License
180 stars 129 forks source link

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

Closed joakimmillen closed 2 weeks ago

joakimmillen commented 3 weeks ago

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):

ribeiroguilherme commented 3 weeks ago

Hi @joakimmillen ,

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

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

joakimmillen commented 2 weeks ago

@ribeiroguilherme yes I have the same experience, thank you

ribeiroguilherme commented 2 weeks ago

@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