#gunwant-Order
1 messages · Page 1 of 1 (latest)
I'm using Payment element.
const options = {
clientSecret: clientSecret,
// Fully customizable with appearance API.
appearance: {
theme: 'flat',
variables: {
fontWeightNormal: '500',
borderRadius: '2px',
colorBackground: 'white',
colorPrimary: '#DF1B41',
colorPrimaryText: 'white',
spacingGridRow: '15px'
},
rules: {
'.Label': {
marginBottom: '6px'
},
'.Tab, .Input, .Block': {
boxShadow: '0px 3px 10px rgba(18, 42, 66, 0.08)',
padding: '12px'
}
}
},
};
const elements = stripe.elements(options);
// Create and mount the Payment Element
const paymentElement = elements.create('payment');
paymentElement.mount('#payment-element');
In the card, elements have an option to hide/show zipcode.
hidePostalCode: true,
whats about payment element?
Here's the equivalent option for payment element https://stripe.com/docs/js/elements_object/create_payment_element#payment_element_create-options-fields-billingDetails-address-postalCode
You can set it to never to hide the postal code
Hi there
I have applied both options 'auto' and 'never' but the stripe payment element does not respond to anything.
const options = {
clientSecret: clientSecret,
// Fully customizable with appearance API.
appearance: {
theme: 'flat',
variables: {
fontWeightNormal: '500',
borderRadius: '2px',
colorBackground: 'white',
colorPrimary: '#DF1B41',
colorPrimaryText: 'white',
spacingGridRow: '15px'
},
rules: {
'.Label': {
marginBottom: '6px'
},
'.Tab, .Input, .Block': {
boxShadow: '0px 3px 10px rgba(18, 42, 66, 0.08)',
padding: '12px'
}
}
},
fields: {
billingDetails: {
address: {
postalCode: 'never' / 'auto'
}
}
}
};
const elements = stripe.elements(options);
Anything wrong?
Not all country requires postal code. i.e., India doesn't
Change the country to United States or United Kingdom, and the payment element will display the postal code.
Okay.
Thank you
Got it
But when I have selected county US and how can I off zipcode?
Set postalCode to never.
I have set postalCode: 'never', still shows in the stripe payment element.
Your code looks correct, can you clear the build/cache and run again?
Try it in incognito mode?
Okay
Oh wait
The options param that includes the fields should be passed to elements.create('payment', options);, not stripe.elements(options);
Okay
Let me check it.
Thank you.
Now, its working
Thank you so much.
Nice to talk with you
No problem! happy to help.