While doing google pay using stripe in react If any Backend API taking some more time then paymentrequest.show() method is throwing below error. Failed to execute 'postMessage' on 'Window': Delegation is not allowed without transient user activation
Anyone have any idea ?
Thanks
The
paymentrequest.show()
method call, should be called within a user gesture. There mustn't be any delay between the user gesture action (button click) and the call to that method. This is something to align with the user UI expectation/experience of 'I click, then a visual thing happens', also in order to protect the user from being shown the pay button without his explicit request. That could lead to security vulnerability.Unfortunately, you need to prevent any treatment (aka API call) to add significant delay between the user button’s click and the show() function call, maybe you should redesign your APIs calls before the user clicks the Google Pay button.