#salimgt
1 messages · Page 1 of 1 (latest)
Hello! Not sure I understand, can you provide more specific details? What specific thing are you stuck on?
how to make google pay button register user before open gpay popup?
now i see when i click on it, i see google pay popup
i want to do some actions before showing google pay popup
What actions?
Like you want to run code when that button is clicked before showing the payment sheet?
Is that the Payment Request Button?
yes
yes
You would need to stop using the Payment Request Button and build your own custom button instead, then use paymentRequest.show() to show the payment sheet after running your other code: https://stripe.com/docs/js/payment_request/show
ok great, how to keep same button styles?
That's something you would need to handle on your end since you wouldn't be using the Payment Request Button anymore.
Can you tell me more about what you want to do though?
It's somewhat unusual to run code when the button is clicked before the payment sheet is displayed.
What code do you want to run there?
as you see in step 2, i need to register user first
What if you didn't display the button, or didn't make it active, until that step was complete?
hmmm yeah possible, but i prefer all in same page
i will stop using Payment Request Button
can you suggest something for the style?
i need a copy of your style
It depends on what you want. The Payment Request Button is designed to show the Apple Pay button in Safari and the Google Pay button in Chrome, and the Link button when those aren't available. If you want those same things to happen with your custom button you would need to handle all of that on your end.
To clarify, I do not recommend this approach at all.
You should use the Payment Request Button.
I think there are other ways to solve this issue that don't involve running custom code when the button is clicked.
I recommend only showing the Payment Request Button when you're ready for people to click on it.