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

There's no way to filter out countries

Open skywalkerlw opened this issue 4 years ago • 8 comments

Hi I noticed we have an option availableCountries in source codes. I tried to use it via but obviously does not work

var configuration = PaymentSheet.Configuration()
configuration.customer = .init(
     id: params["customerId"]!, ephemeralKeySecret: params["customerEphemeralKeySecret"]!
)
configuration.returnURL = paymentSuccessRedirectStr
configuration.availableCountries // this does not exist

What's the right way to configure the available country list in SwiftUI?

Thank you

skywalkerlw avatar Jun 19 '21 21:06 skywalkerlw

Hi @skywalkerlw,

We don't offer this configuration today. Can you tell us more your use case to help us evaluate adding this? Thank you!

yuki-stripe avatar Jun 21 '21 17:06 yuki-stripe

We are developing a SwiftUI based app and payment only supports the Australian region. Currently, there comes a country list as shown below, which confuses end-users. The possible worse thing is the finance issue if users select the unexpected country, making things more complicated.

So in short, our expectation is to have a function to show the country list that we support, rather than all.

By the way, we are following your SwiftUI guideline here: https://stripe.com/docs/payments/accept-a-payment?platform=ios

image

skywalkerlw avatar Jun 22 '21 02:06 skywalkerlw

any release date planned?

Appreicate so much

skywalkerlw avatar Jun 25 '21 07:06 skywalkerlw

Hi @skywalkerlw,

I can't share a timeline but we've heard this request from other users too, and are prioritizing support for this!

yuki-stripe avatar Jun 28 '21 18:06 yuki-stripe

@yuki-stripe is there some workaround for now? For example, can I by default select Australia region?

skywalkerlw avatar Jul 05 '21 04:07 skywalkerlw

@skywalkerlw If your iPhone region is set to Australia, it will default to that. Unfortunately there's no workaround at this time.

yuki-stripe avatar Jul 06 '21 21:07 yuki-stripe

@yuki-stripe

If we added a configuration (ex. availableCountries) to PaymentSheet.Configuration and then fed that value into CountryPickerDataSource, would that be sufficient?

The one problem I see is that the value (availableCountries) has to travel through a lot of different initializers - it gets a little hairy.

For context, I can open a PR to add this feature.

kgaidis avatar Nov 15 '21 15:11 kgaidis

That would be a perfect @kgaidis Thanks :)

skywalkerlw avatar Nov 19 '21 21:11 skywalkerlw