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

Error adding a new card: You passed an empty string for 'billing_details[address][country]' ... #1752

Closed
Ariandr opened this issue Jan 21, 2021 · 5 comments
Labels
triaged Issue has been reviewed by Stripe and is being tracked internally

Comments

@Ariandr
Copy link

Ariandr commented Jan 21, 2021

Summary

I migrated from SDK v.19.4.0 to 21.2.0.

While using 21.2.0 I get this error. It shows this message: 'You passed an empty string for 'billing_details[address][country]' ... . Please, look at the screenshot.

When using 19.4.0 I didn't get this error and everything worked fine with the same logic, the code was changed only to make the project compile.

I set in App Delegate:
STPPaymentConfiguration.shared.requiredBillingAddressFields = .none
Apart from that, I don't specify that any other billing details must be collected in any place in the app as far as I can see.

Screenshot 2021-01-21 at 15 27 44

Code to reproduce

I initialize customer and payment contexts in this way not specifying anything extra.

self.customerContext = STPCustomerContext(keyProvider: StripeAPIClient.shared)
let configuration = STPPaymentConfiguration.shared
self.paymentContext = STPPaymentContext(customerContext: customerContext, configuration: configuration, theme: STPTheme.defaultTheme)

iOS version

14.3

Installation method

Cocoapods, 1.10.1

SDK version

21.2.0

Question:

How do I solve it? Should I set some properties somewhere?
I didn't change behavior in any way after installing 21.2.0. I just implemented necessary migration steps for the project to compile.

Thanks in advance!

@Ariandr
Copy link
Author

Ariandr commented Jan 27, 2021

Hi @davidme-stripe
Have you had a chance to look into it?

It's a blocking issue which persists.
By the way, in this example I used a test card 4242 4242 4242 4242.

@davidme-stripe
Copy link
Contributor

Hi, sorry for the delay! This is a combination of a bug on our end and an issue with the iOS Simulator.

  1. The iOS Simulator sometimes returns nil as the current locale's country code. You can fix this by going into the Simulator's Settings -> General -> Language & Region -> Region and setting a country code (even if one is already set, just re-set the one that's selected).

  2. Our SDK doesn't correctly handle a nil current locale in all situations. We'll fix that in an update soon. I don't think users would hit this in the wild, as real devices should always have a valid locale.

@davidme-stripe davidme-stripe added the triaged Issue has been reviewed by Stripe and is being tracked internally label Jan 27, 2021
@Ariandr
Copy link
Author

Ariandr commented Jan 27, 2021

Hi @davidme-stripe
Thank you!
I will try tomorrow and get back to you.

@Ariandr
Copy link
Author

Ariandr commented Jan 29, 2021

Hi @davidme-stripe
I tried resetting the region and it works now on the Simulator, thanks.

I'm closing the issue, maybe it will be useful for folks if they face the same issue.

@Ariandr Ariandr closed this as completed Jan 29, 2021
@davidme-stripe
Copy link
Contributor

This was fixed in 21.2.1, so it should now work again with invalid regions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triaged Issue has been reviewed by Stripe and is being tracked internally
Projects
None yet
Development

No branches or pull requests

2 participants