Callback to execute additional logic before opening the Payment Pequest UI #91
-
Hello, We're using the React component and we have a requirement that we need to do some additional logic when user clicks the Google Pay button before opening the popup. It would be nice if there was a possibility to use some of components callback to achieve that, something such as <GooglePayButton
environment="TEST"
paymentRequest={{...}}
onSelect={() => {
// Additional logic that should happen before popup is open
}}
/> |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
@nielsengoncalves, this is something we've considered and haven't implemented as this request hasn't previously been requested. FYI, it would likely be called One of the things I would like to better understand is what you are planning to use this. A challenge with this is the fact that the payment sheet must be triggered by a user gesture and some browsers have different ways for determining if the sheet was triggered by a user gesture. I've previously run into issues with browsers where some latency between the click and displaying the payment sheet can cause the browser to think that the payment sheet was triggered without a user gesture and therefore error out without displaying the payment sheet. An example of this includes making a network request Depending on what you are trying to do, there may be other alternatives. For example, if you would like to dynamically calculate total price, the |
Beta Was this translation helpful? Give feedback.
@nielsengoncalves, this is something we've considered and haven't implemented as this request hasn't previously been requested. FYI, it would likely be called
onClick
.One of the things I would like to better understand is what you are planning to use this.
A challenge with this is the fact that the payment sheet must be triggered by a user gesture and some browsers have different ways for determining if the sheet was triggered by a user gesture.
I've previously run into issues with browsers where some latency between the click and displaying the payment sheet can cause the browser to think that the payment sheet was triggered without a user gesture and therefore error out without display…