Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] NSLocalizedDescription contains generic message while com.stripe.lib:ErrorMessageKey contains an informative message #3179

Open
netaiVia opened this issue Jan 17, 2024 · 1 comment
Labels
kind:bug triaged Issue has been reviewed by Stripe and is being tracked internally

Comments

@netaiVia
Copy link

Summary

It looks like whenever we get invalid_bank_account_iban error in here stripeErrorMessage is not nil and the function doesn't add the correct value to NSLocalizedDescription. Instead of containing the The IBAN you entered is invalid. string it contains the generic message.

We want to display a relevant message to our users based on the error but NSLocalizedDescription doesn't give us any information

Code to reproduce

Call

        let sepaDebitParams = STPPaymentMethodSEPADebitParams()
        sepaDebitParams.iban = ibanField.text

        let billingDetails = STPPaymentMethodBillingDetails()
        billingDetails.name = nameField.text
        billingDetails.email = emailField.text

        let paymentIntentParams = STPPaymentIntentParams(clientSecret: paymentIntentClientSecret)

        paymentIntentParams.paymentMethodParams = STPPaymentMethodParams(sepaDebit: sepaDebitParams,
                                                                         billingDetails: billingDetails,
                                                                         metadata: nil)

        STPPaymentHandler.shared().confirmPayment(paymentIntentParams, with: self) { (handlerStatus, paymentIntent, error) in
            print(error)
        }

and the error we get is

Error Domain=com.stripe.lib Code=50 "There was an unexpected error -- try again in a few seconds" UserInfo={com.stripe.lib:ErrorMessageKey=The provided IBAN is invalid., com.stripe.lib:StripeErrorTypeKey=invalid_request_error, NSLocalizedDescription=There was an unexpected error -- try again in a few seconds, com.stripe.lib:StripeErrorCodeKey=invalid_bank_account_iban}

iOS version

all

Installation method

pod

SDK version

23.19.0

@tillh-stripe
Copy link
Contributor

Hi @netaiVia 👋 Thanks for reporting this. We’ll have a look at how we can fix this!

@davidme-stripe davidme-stripe added the triaged Issue has been reviewed by Stripe and is being tracked internally label May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug triaged Issue has been reviewed by Stripe and is being tracked internally
Projects
None yet
Development

No branches or pull requests

3 participants