7👍
Country is a field required by Checkout, and depending on the country selected, the postal code is automatically displayed as a requirement for specific countries. You cannot remove these fields in Checkout.
If you do not want to collect the country and postal code, you can choose to use Payment Element [0] to collect the payment method details instead. You can disable collection of those details by specifying never
in the relevant fields [1][2].
[0] https://stripe.com/docs/payments/payment-element
[1] https://stripe.com/docs/js/elements_object/create_payment_element#payment_element_create-customized_fields-fields-billingDetails-address-country
[2] https://stripe.com/docs/js/elements_object/create_payment_element#payment_element_create-customized_fields-fields-billingDetails-address-postalCode
6👍
Further expounding on makoto’s answer as the docs did not fully explain, here is how you would do it in JS:
// Create and mount the Payment Element
var paymentElement = elements.create('payment', {
fields: {
billingDetails: {
address: {
country: 'never',
postalCode: 'never'
}
}
}
});
Be warned however: If you leave the zip code, removing only the country, the zip box will be ginormous.
- [Django]-Create a facebook notification with Django package facepy : [15] (#15) This method must be called with an app access_token
- [Django]-Django Compressor on a multi-server deployment
- [Django]-How to modify django-ckeditor inline styles?
2👍
According to Stripe’s documentation, Country is a field required by Checkout, but if you are hiding the country, you will need to set a default value.
// Create and mount the Payment Element
const paymentElement = elements.create('payment', {
fields: {
billingDetails: {
address: {
country: 'never'
}
}
},
});
// Confirm the card payment that was created server side:
const {error} = await stripe.confirmPayment({
elements,
confirmParams: {
return_url: `your_return_url`,
payment_method_data: {
billing_details: {
address: {
country: 'HK'
}
}
},
}
});
https://stripe.com/docs/js/elements_object/create_payment_element
- [Django]-Any clue on this error with generic relation using Django Orm?
- [Django]-Does Neomodel support modelform? If so, why isn't it picking up default meta attributes / how do I set them?
- [Django]-How to use Apache to serve Django server and React client?
- [Django]-How to solve UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte
- [Django]-Install hstore extension for django tests
0👍
In React native CardForm
If want to change the country code then
defaultValues={{countryCode:'IN'}}
OR
<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,
}}
/>
- [Django]-Django: how to map the results of a raw sql query to model instances in admin list view?
- [Django]-How much flexibility is there in a Django for loop?