Localized error message for end users
Summary
There is a way to have localized error message returned by Stripe SDK and directly displayable to the end user ?
This is to avoid create error message for every error in multiples languages. I search on the documentation but I found only one thing, a error message only usable internally and not localized : result.intent.lastSetupError?.message.
One other thing, SDK for iOS have localized error messages directly packaged in to the lib files.
SDK version
14.5.0
Hi @pvarry. Thanks for filing. Can you point me to the specific error messages you're looking for from the iOS SDK? Thanks!
Thanks for your answer, I miss understand the implementation of iOS SDK. I though the iOS SDK have a lot of translated error but it didn't. And please don't take in consideration the sentence in original message.
The main point is : can you return translated and user ready error message on every error.
For exemple, the app try to make a payment with confirmPayment but the bank block the payment. The best will be to return a localized error message in the result so the app can directly display this error message to the user. I think this will be very useful for every application that use the SDK
Thanks. That makes sense. I agree! Error messages should be localized and in most cases, they are.
Typically, these error messages are communicated via the ApiResultCallback (e.g. the one you pass to onPaymentResult). If onError is called, the Exception should have a localized message.
For an example, see our example - https://github.com/stripe/stripe-android/blob/master/example/src/main/java/com/stripe/example/activity/StripeIntentActivity.kt#L223
I tried setting my device language to french and I see this error in "Simple Payment Method Confirmation Activity" (note: I get an error because P24 is not enabled for my merchant account)

Does that work for you?
If there are any specific cases where you are unable to get a localized error message, please let me know! I'm happy to look into it if you can give me a code sample that reproduces the issue.
cc @shengwei-stripe who may be able to help with any integration issues
Please note that this only applies to SDK versions >= 14.0.0
I use SDK 14.5.0
In the localized of your exemple, the term SetupIntent is used, for me this is a engineer term and specific of how Stripe is working and cannot be show to the people using the app in real-life (end-user).
I'am looking for a error message who can be display to End Users, this message must be easily comprehensible by everyone and without any technical concepts (SetupIntent, payment_method_types ...)
That makes sense. You are correct that many error messages are intended for engineers, not end users. I do not believe we have a holistic strategy around end-user messaging. I'll see if I can get this on the roadmap. Thanks again for filing this issue. We always appreciate the feedback! This is definitely an area where Stripe can improve.
Tanks you for your answer, I hope you will find time to add this
English strings are unsuitable for end users too. The iOS SDK shows suitable ones. For comparison, result.intent.lastPaymentError?.message shows
Android SDK
The provided PaymentMethod has failed authentication. You can provide payment_method_data or a new PaymentMethod to attempt to fulfill this PaymentIntent again.
iOS SDK
We are unable to authenticate your payment method. Please choose a different payment method and try again.
To reproduce, use the 4000 0025 0000 3155 test card then fail authentication.
Hello, do you have any news about this issue ?
Hey @pvarry. Sorry for the delay here. We don't have any updates at the moment but I've added as task to our next sprint to revisit this.
I've attempted to re-create some of the logic we have in the iOS SDK in #2849 and have sent these strings for translation. Thanks for pointing out this disparity! In general, Stripe is not committed to providing end-user messaging but I hope this is still useful. I'll try to remember to update this ticket when the translations are available. Let me know if you have additional feedback!
Thanks you for taking this in considerations
@pvarry The two error message strings for: stripe_failure_reason_authentication stripe_failure_reason_timed_out
Have been translated. Please reopen if you are still experiencing any issues.