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

Production issue with Apple Pay

Open ScreamZ opened this issue 1 year ago • 16 comments

Hello,

One year ago I made a thread having an issue with Apple Pay: https://github.com/stripe/stripe-react-native/issues/945. One year later I'm working back on that project and I'm trying to fix things but nothing seems to have changed.

A bit of context

My customer is "renting" power banks, for free in fact, but I need to take a Hold of 35€ in case people don't bring back the power bank after two days to the station.

I followed the doc using initPaymentSheet from https://stripe.com/docs/payments/accept-a-payment?platform=react-native&ui=payment-sheet#react-native-apple-pay.

Google pay

For Google Pay, everything works so far.

Apple pay

  • I've no issue in staging (com.stride.power.staging), the validation seems to pass.
  • But in production, things get worse… And this is really annoying because we are losing a lot of user conversions due to this case.

The only difference is the PUBLISHABLE_KEY (pk_test vs real one) and the bundle identifier (between apps). I've shared a lot of screenshots with the configuration and code below.

Here is the log from Stripe, I've no idea what the CVC has to do with apple pay, this is not asked anywhere. (https://dashboard.stripe.com/logs/req_fMMpcFFZtn0oFh)

Screenshot 2023-05-03 at 19 04 22

IMG_A6317638AC18-1

Thanks !

Side note

  • I'm using two app IDs: com.stride.power.staging (works with that config) and com.stride.power (production, doesn't work)
  • ✅ I've been able to use Apple Pay without any issue from the Stripe customer portal (now it's proposed, but some months ago it wasn't). So I guess it's related to some configuration. This can be a workaround for waiting for a fix of my issue

Context

  • App link (if you want to try) https://apps.apple.com/fr/app/stride-recharge-%C3%A0-linfini/id1596882572
  • OS: iOS
  • "@stripe/stripe-react-native": "0.23.3",

Additional screenshots

IMG_1493 IMG_1494 IMG_1495 Screenshot 2023-05-03 at 19 09 50 Screenshot 2023-05-03 at 19 10 19 Screenshot 2023-05-03 at 19 11 06 Screenshot 2023-05-03 at 19 11 14 Screenshot 2023-05-03 at 19 12 07 Screenshot 2023-05-03 at 19 13 00 Screenshot 2023-05-03 at 19 14 59

ScreamZ avatar May 03 '23 17:05 ScreamZ

hey @ScreamZ , do you only get this error when attempting to use apple pay? Inputting the card data directly into payment sheet results in a success?

If it's not working in production then I do think there's an actual validation issue happening here...

charliecruzan-stripe avatar May 25 '23 20:05 charliecruzan-stripe

Yes, this works most on time with payment sheet, but Apple Pay fails (and sometime works I don't know why). Invalid CVC they said but it's never prompted and the whole user base is getting this error.

Not only my card, what I don't get is how it can be related to cvc using Apple Pay this is non-sens

ScreamZ avatar May 25 '23 20:05 ScreamZ

Hm, I'm not sure what could be causing that in the Stripe React Native library. Maybe you have some radar rules set that are causing this?

Could you share an example setup intent ID with me that I can look into?

charliecruzan-stripe avatar May 25 '23 21:05 charliecruzan-stripe

Hm, I'm not sure what could be causing that in the Stripe React Native library. Maybe you have some radar rules set that are causing this?

No radar on this account enabled

Could you share an example setup intent ID with me that I can look into?

Yeah you have one on first screenshot isn't ?

ScreamZ avatar May 26 '23 09:05 ScreamZ

I've exactly the same error.

Have you found a solution?

Kai599 avatar Aug 03 '23 10:08 Kai599

I've switched to the customer portal to add card, this way stripe manage the signature and this works on their side

ScreamZ avatar Aug 03 '23 14:08 ScreamZ

Hey folks, I did some digging and the decline is not from Stripe, but from the card network. It shouldn't have anything to do with your iOS certs either. If you try a non-visa card, does it work?

charliecruzan-stripe avatar Aug 03 '23 19:08 charliecruzan-stripe

I don't have access to a non-visa card.

But: I've tried two different visa cards, same error (invalid_cvc). Both cards work fine when you pay directly with the card and not trough ApplePay. Both cards even work with ApplePay when you pay for something (createStripePayment). The payment method is saved afterwards, so I can do paments in the future without getting the Stripe payment sheet. The error (invalid_cvc) only appears if you want to add the card as a payment method without paying for something (createSetupIntent).

Kai599 avatar Aug 04 '23 08:08 Kai599

EDIT: The problem really only exists with visa cards. A mastercard works fine. Thus, the deadly combination is ApplePay + createSetupIntent + Visa card.

Kai599 avatar Aug 04 '23 11:08 Kai599

I don't have access to a non-visa card.

But: I've tried two different visa cards, same error (invalid_cvc). Both cards work fine when you pay directly with the card and not trough ApplePay. Both cards even work with ApplePay when you pay for something (createStripePayment). The payment method is saved afterwards, so I can do paments in the future without getting the Stripe payment sheet. The error (invalid_cvc) only appears if you want to add the card as a payment method without paying for something (createSetupIntent).

I didn't had this case, i was only setting setupIntent, but sometimes its works, its very random, even on my own visa card, sometime it works, sometime it doesn't. (I've made multiple try).

Maybe stripe you should reach visa network and escalade the issue with them. There is no CVC involved in apple payment. Also i can confirm that using apple pay with a visa on the customer portal interface (from your) works.

ScreamZ avatar Aug 04 '23 13:08 ScreamZ

@charliecruzan-stripe Can you escalate this?

ScreamZ avatar Aug 15 '23 19:08 ScreamZ

I have, we've reached out to the card networks

charliecruzan-stripe avatar Aug 15 '23 19:08 charliecruzan-stripe

Also having this problem. Comparing the UX of the Stripe sheet vs another app where this exact flow works (register visa card as a payment method using Apple Pay "without payment") I see this potential hint:

  • Stripe Apple Pay sheet shows "{CompanyName}\nAmount Pending".
  • Other app shows "Pay {CompanyName}\n0 {Currency}".

Not sure if that makes any difference behind the scenes, but at least VISA cards seem to work in the other app and not ours. Note, the other app is not using Stripe, or at least not Stripe's payment sheet.

EDIT: Found a workaround. Pass paymentSummaryItems (or I guess cartItems in the latest version) to initPaymentSheet with the "Immediate" paymentType. This works for me:

await initPaymentSheet({
  applePay: {
    merchantCountryCode,
    paymentSummaryItems: [
      {
        paymentType: 'Immediate',
        amount: '0',
        label: 'Some Label',
        isPending: true,
      },
    ],
  },
})

This shows the same UI as before but you can also skip isPending to show a payment of 0. We have yet to deploy this and I don't know if there are side effects of this change.

eirikurn avatar Sep 03 '23 00:09 eirikurn

Also having this problem. Comparing the UX of the Stripe sheet vs another app where this exact flow works (register visa card as a payment method using Apple Pay "without payment") I see this potential hint:

  • Stripe Apple Pay sheet shows "{CompanyName}\nAmount Pending".
  • Other app shows "Pay {CompanyName}\n0 {Currency}".

Not sure if that makes any difference behind the scenes, but at least VISA cards seem to work in the other app and not ours. Note, the other app is not using Stripe, or at least not Stripe's payment sheet.

EDIT: Found a workaround. Pass paymentSummaryItems (or I guess cartItems in the latest version) to initPaymentSheet with the "Immediate" paymentType. This works for me:

await initPaymentSheet({
  applePay: {
    merchantCountryCode,
    paymentSummaryItems: [
      {
        paymentType: 'Immediate',
        amount: '0',
        label: 'Some Label',
        isPending: true,
      },
    ],
  },
})

This shows the same UI as before but you can also skip isPending to show a payment of 0. We have yet to deploy this and I don't know if there are side effects of this change.

Stripe is generally not working well with payment intent = 0 because they don't support it as it doesn't allow them to proceed money cut on their purpose. This could be nice if this is working.

ScreamZ avatar Sep 04 '23 12:09 ScreamZ

Stripe is generally not working well with payment intent = 0 because they don't support it as it doesn't allow them to proceed money cut on their purpose. This could be nice if this is working.

Well it is working for me. Maybe because we have a custom pricing plan.

eirikurn avatar Sep 04 '23 12:09 eirikurn

@ScreamZ sorry for the of top question, but maybe you can leave some recommendations for me in my question

https://github.com/stripe/stripe-react-native/issues/1494

Thank you a lot in advance :)

VTSingle avatar Sep 11 '23 14:09 VTSingle