stripe-react-native icon indicating copy to clipboard operation
stripe-react-native copied to clipboard

Payment sheet crashes on iOS when initialising payment sheet with p24.

Open remonh87 opened this issue 2 years ago • 4 comments

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:

  1. Create payment intent with p24
  2. use the paymentsheet with the client secret of step 1
  3. 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: Screenshot 2022-06-21 at 20 36 06

Desktop (please complete the following information):

  • iOS 15.5
  • Any device

remonh87 avatar Jun 21 '22 18:06 remonh87

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

grzesebe avatar Jun 22 '22 11:06 grzesebe

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 avatar Jun 22 '22 17:06 charliecruzan-stripe

@charliecruzan-stripe I can confirm that this workaround works but I would expect indeed a StripeException in this case.

remonh87 avatar Jun 26 '22 13:06 remonh87

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

bionanek avatar Aug 17 '22 15:08 bionanek

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

eurias-stripe avatar Oct 13 '22 23:10 eurias-stripe

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

king-faraz avatar Oct 19 '22 11:10 king-faraz

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.

kostas64 avatar Dec 30 '22 10:12 kostas64