Reputation: 19444
I want to set by default country as UAE
. is it possible to set it? and also is it possible to set it server-side?
All the time it's set United State. But this problem is only on Android and Ios SDK. It's automatically set UAE on web.
Upvotes: 4
Views: 4005
Reputation: 19444
To set the country in the Stripe Payment Sheet using the Flutter SDK, you have two options:
You can specify the country code directly. Note that for Dubai, the country code 'UAE' might not work as expected. Instead, use 'AE':
billingDetails: BillingDetails(
address: Address(
country: 'AE',
city: 'Dubai',
line1: '',
line2: '',
postalCode: '',
state: ''
)
),
You can also configure the billing details to never prompt for a country:
billingDetailsCollectionConfiguration: BillingDetailsCollectionConfiguration(
address: AddressCollectionMode.never
),
This should help you set the country correctly or remove the country selection in the Stripe Payment Sheet.
Upvotes: 0
Reputation: 472
If want to change the country code then
defaultValues={{countryCode:'IN'}}
<CardForm
defaultValues={{countryCode:'none'}}
onFormComplete={cardDetails => {
console.log('card details', cardDetails);
setCard(cardDetails);
}}
postalCodeEnabled={true}
placeholder={{
number: '4242 4242 4242 4242',
}}
cardStyle={{
backgroundColor: '#000001',
textColor: '#f2f2f2f2',
borderRadius: 8,
borderWidth: 1,
textErrorColor: 'red',
placeholderColor: 'grey',
borderColor: '#ffffff',
}}
autofocus={false}
style={{
width: windowWidth-8,
height: windowHeight / 2,
alignItems: 'center',
marginHorizontal: 4,
}}
/>
Upvotes: 1
Reputation: 11
For React Native, please provide the defaultBillingDetails when initPaymentSheet
You can refer below example
const {error} = await initPaymentSheet(
{
defaultBillingDetails: {
address: {
country: 'HK',
},
}
}
);
Upvotes: 1
Reputation: 326
Follow this: https://github.com/stripe/stripe-android/issues/4845 Increase your stripe lib version into
Gradle (implementation 'com.stripe:stripe-android:20.2.1')
Upvotes: 0
Reputation: 5078
Specify default values for billing details collected in the payment sheet by setting defaultBillingDetails
. PaymentSheet
pre-populates its fields with the values provided.
for iOS Swift
var configuration = PaymentSheet.Configuration()
configuration.defaultBillingDetails.address.country = "US"
configuration.defaultBillingDetails.email = "[email protected]"
for Android Kotlin:
var configuration = PaymentSheet.Configuration(...)
configuration.defaultBillingDetails.address.country = "US"
configuration.defaultBillingDetails.email = "[email protected]"
Upvotes: 4