#salman971-prbutton
1 messages · Page 1 of 1 (latest)
@urban saffron I'm pretty sure that's impossible, the browser enforces that the PaymentRequest popup can only be triggered by an actual button press so a direct event handler
if you have something else happening async then it looks like a programatic opening of the sheet and the browser blocks that
I might be misunderstanding you, seeing some of the actual code you have would help!
Actually there is a final confirmation modal which has to be shown to the customer before the widget actually loads. It has to be after the payment button click and before the widget loads.
yeah that is not possible!
unless your modal then has the actual PaymentRequestButton itself inside it and the user clicks that
This is my jsx:
if (paymentRequest) {
return <PaymentRequestButtonElement onClick={validatePayment} options={{ paymentRequest }} />
}
and validatePayment method:
const validatePayment = async (e) => {
try {
await waitForConfirmationModal()
} catch (err) {
e.preventDefault()
}
}
but you can not call the .show() method from anything except an event handler for a direct user interaction
So PaymentRequestButtonElement has to be the only button through which the widget will be loaded? there is no way to have a slight pause or a way to trigger it programmatically?
nope, because browsers block that as a way to prevent abuse(like a site or an advert that tries to popup the sheet to confuse the user into paying)
they enforce the button has to be triggered from a direct click. It also goes against the concept of things like Google/Apple Pay — they're meant to be 'one click' payment options so adding your own interstitial confirmation goes against that. You should try to design the page so that nothing needs to be confirmed by the time you are showing the user this button as an option so they can just hit it and then check out.