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

`customerEphemeralKeySecret` format does not match expected client secret formatting.

Open GustavoLucero opened this issue 1 year ago • 3 comments

Describe the bug The error "customerEphemeralKeySecret format does not match expected client secret formatting." is thrown when trying to do initPaymentSheet(). This only happens on iOS, the same code works perfectly on Android. I'm only working with CC, no ApplePay or GooglePay.

Expected behavior Initialize the payment sheet and proceed to the next step where the payment sheet is displayed through presetPaymentSheet();

Screenshots This is the error thrown by initPaymentSheet() image

Implementation image You can be sure I'm properly getting and sending customerId, customerEphemeralKeySecret and setupIntentClientSecret. I wan to highlight the fact this same code is working on Android, it only fails on iOS.

I'm using the version 0.19.0 of this plugin. This is the version I need for iOS 12.4 which is the target the project has setup on xCode, so I cannot update the version of this library.

Do you guys know why this happens only on iOS? I can't find anything on the internet. I'm lost.

I'll appreciate your help.

GustavoLucero avatar Oct 07 '23 18:10 GustavoLucero

@GustavoLucero , have you found a solution? I'm also encountering the same issue on iOS. Initially, it was functioning correctly, but now I'm suddenly receiving this error. It's working fine on Android.

manish-demo avatar Nov 15 '23 05:11 manish-demo

Are you sure, you are not passing the ephemeralKeyId rather than the ephemeralKey itself? I encountered an issue for that.

jonno85 avatar Nov 22 '23 00:11 jonno85

If you hit this error, it's almost certainly due to the fact that you are passing the wrong value as your EphemeralKey secret. Many developers mistakenly pass the EphemeralKey id which looks like ephkey_123456 instead of passing the EphemeralKey secret that looks like ek_test_abc123 instead. On Android, we incorrectly don't validate the value the same way which makes it look like it works.

remi-stripe avatar Jan 22 '24 19:01 remi-stripe