stripe-js: IntegrationError: show() must be called from a user gesture handler (Apple Pay)
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.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 16 (6 by maintainers)
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.