stripe-react-native
stripe-react-native copied to clipboard
Payment sheet crashes on iOS when initialising payment sheet with p24.
Describe the bug In our Flutter repo we got the following bug: https://github.com/flutter-stripe/flutter_stripe/issues/796 . P24 payments cannot be executed on iOS but work on Android when using paymentsheet.
To Reproduce Steps to reproduce the behavior:
- Create payment intent with p24
- use the paymentsheet with the client secret of step 1
- observe the index out of range error .
Expected behavior No crash and the paymentsheet should work with p24 like on Android.
Screenshots
Breakpoint of crash:
Desktop (please complete the following information):
- iOS 15.5
- Any device
Hi, I have exact same issue using https://github.com/capacitor-community/stripe I've changed stripe pod version to 21.13.0. It should be compatible with p24.
Only using p24
hi- thanks for the report. It looks like it's grabbing the first payment method, but there are no supported payment methods found. Since it's working on Android, it's likely that iOS is filtering out the p24 payment method since there's no returnURL
set for the payment sheet. You can set the returnURL with:
await initPaymentSheet({
...
returnURL: 'your-app://stripe-redirect',
...
});
We'll improve this experience on the iOS side since we probably shouldn't just hard crash if no payment methods are found
@charliecruzan-stripe I can confirm that this workaround works but I would expect indeed a StripeException
in this case.
@charliecruzan-stripe same here, without returnURL app crashes without any notice but after adding returnURL it works fine. Too bad try catch didn't catch any error in this case... would save me so much time 😅
@remonh87 I added error handling that should prevent you from creating a PaymentSheet
if there are no payment methods available, instead of crashing the app, you should get back an Exception. This is available in the latest release.
add merchantIdentifier="merchant.com.{{YOUR_APP_NAME}}" in stripe provider worked for me marchant identifier is required for apple pay https://stripe.com/docs/payments/accept-a-payment?platform=react-native&ui=payment-sheet written in stripe doc for react native
In my case the problem with the payment sheet was the amount. Stripe is accepting amount in cents. I was passing "10" as amount in "eur" currency. For stripe this amount is 10 cents and minimum amount is 0.50euro so 50 cents. When i passed 1000 as amount which equals to 10euro everything worked like a charm. You can check logs of Stripe for further error messages.