#salimgt
1 messages · Page 1 of 1 (latest)
i have a button named button. Here after gpay check passed and user sign up, i add event listener to this button via this code:
button.addEventListener('click', paymentRequest.show);
so in this case paymentRequest.show will be fired, only when you click on button
it is first method of opening gpay popup
but, instead of adding event listener to button, i can run paymentRequest.show manually in code, to not click button
and this not works
works only 1st method
you need click button to run paymentRequest.show method
is there a way, how to run paymentRequest.show method without clicking on button
got it?
Nope
This method must be called as the result of a user interaction (for example, in a click handler).
From the above link
what do you suggest?
i have 3 steps.
i want when user click gpay button, i want to register him first and then the gpay popup will opened
how i can achieve that?
You can have multiple actions in a click handler
So first register the user then call show()
button.addEventListener('click', paymentRequest.show);
Instead of passing paymentRequest.show, pass a function. Within that function, you should be able to both register the user and call paymentRequest.show()