stripe-ios
stripe-ios copied to clipboard
[BUG] NSLocalizedDescription contains generic message while `com.stripe.lib:ErrorMessageKey` contains an informative message
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
Hi @netaiVia 👋 Thanks for reporting this. We’ll have a look at how we can fix this!