question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

IntegrationError: show() must be called from a user gesture handler (Apple Pay)

See original GitHub issue

Summary

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:closed
  • Created 2 years ago
  • Comments:14

github_iconTop GitHub Comments

1reaction
christopher-stripecommented, Feb 18, 2022

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.

0reactions
pcothenetcommented, Jul 15, 2022

@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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found