IntegrationError: show() must be called from a user gesture handler (Apple Pay)
See original GitHub issueSummary
I’m unable to process a payment using Apple Pay on the new Stripe Payment Element form. Entering a card manually and Google pay work fine but Apple pay on Safari gives me the following error when confirmPayment() is fired:
IntegrationError: show() must be called from a user gesture handler (such as a click handler, after the user clicks a button)
show() is only present on the paymentRequest Object. But because I’m using the Payment element I’m never creating a payment request button. With that being said how am I supposed to use Apple pay with the payment element when confirming the payment intent? I’m not able to find any documentation on this scenario.
Issue Analytics
- State:
- Created 2 years ago
- Comments:14
Top Results From Across the Web
Cannot call paymentRequest.show() with Apple Pay, Google ...
Basically im trying to use paymentRequest.show to trigger the dialog ... show to be called from within a user gesture handler for Apple...
Read more >iOS 13 Apple Pay button click throws error: "Must create a new ...
The exception error "Must create a new ApplePaySession from a user gesture handler" appears. So in your case, you must create an apple...
Read more >Apple Pay as Payment Requests not working - WPPizza
[Error] IntegrationError: show() must be called from a user gesture handler (such as a click handler, after the user clicks a button).
Read more >Apple pay gives an error InvalidAccessError: Must create a ...
The error your getting is an error reported by Apple. Are you not calling applePay.tokenize() from inside a user gesture handler such as...
Read more >Creating an Apple Pay Session
... "Must create a new ApplePaySession from a user gesture handler" appears. After the session is created, call its begin method to show...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
We use the Payment Request API to implement Apple Pay, which requires a user activation in order to show the payment sheet: https://www.w3.org/TR/payment-request/#user-protections-with-show-method
So unfortunately I don’t think there is an easy way around it. Perhaps you could collect a tip/update the amount before the user clicks the button that calls
confirmPayment
.@GuoXiaoyang I’m not sure. We assumed Apple strengthened a requirement for Apple Pay in Safari for iOs, but didn’t have time to dig into the details.