stripe-android icon indicating copy to clipboard operation
stripe-android copied to clipboard

Localized error message for end users

Open pvarry opened this issue 6 years ago • 13 comments

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

pvarry avatar Jun 10 '20 12:06 pvarry

Hi @pvarry. Thanks for filing. Can you point me to the specific error messages you're looking for from the iOS SDK? Thanks!

smaskell-stripe avatar Jun 17 '20 20:06 smaskell-stripe

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

pvarry avatar Jun 18 '20 07:06 pvarry

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) Screenshot_1592507698

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

smaskell-stripe avatar Jun 18 '20 19:06 smaskell-stripe

Please note that this only applies to SDK versions >= 14.0.0

smaskell-stripe avatar Jun 18 '20 20:06 smaskell-stripe

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

pvarry avatar Jun 23 '20 10:06 pvarry

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.

smaskell-stripe avatar Jun 24 '20 23:06 smaskell-stripe

Tanks you for your answer, I hope you will find time to add this

pvarry avatar Jun 29 '20 15:06 pvarry

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.

jayjun avatar Jun 30 '20 16:06 jayjun

Hello, do you have any news about this issue ?

pvarry avatar Aug 26 '20 09:08 pvarry

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.

smaskell-stripe avatar Aug 27 '20 17:08 smaskell-stripe

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!

smaskell-stripe avatar Sep 14 '20 23:09 smaskell-stripe

Thanks you for taking this in considerations

pvarry avatar Sep 15 '20 09:09 pvarry

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

michelleb-stripe avatar Nov 11 '21 12:11 michelleb-stripe