#amrux
1 messages · Page 1 of 1 (latest)
Hi there!
A) it depends on the payment method you are using. For card the postal code is mandatory with the Payment Element
B) If you set the postalCode to never here: https://stripe.com/docs/js/elements_object/create_payment_element#payment_element_create-options-fields-billingDetails-address-postalCode and then pass the postal code yourself when confirming the PaymentIntent it should work.
Ah yeah it's the card I'm referring to
B) Yeah I've done that, however it asks for other things such as "state" and "line1" I believe behind the scenes when creating the paymentMethod
I'm surprised about this, let me try to reproduce
Thank! I'll send what Im doing if that helps too :)
Oh, I think I've just worked out the problem...
as opposed to doing:
fields: {
billingDetails: {
address: {
postalCode: 'never',
country: 'never',
},
},
},
I was doing:
fields: {
billingDetails: {
address: 'never'
},
},
Which meant that it expected the whole object to be passed along
rather than just the specific values
Just a separate question then, if there is an issue with the postcode... we want to show it. Is there a specific error from the confirmPaymentIntent response if the postcode passed up has an issue, and do you know how to identify that error if so?
Ah yes indeed, you need to be more granular into the information you don't want to collect
Makes perfect sense, sorry for the trouble on that one!
But yeah as you can see from the above , we want to prompt the user to try entering their postcode if there is any issues in the background, is there an exception we can "latch onto" that's specific to address / postcode failures?
Just a separate question then, if there is an issue with the postcode... we want to show it. Is there a specific error from the confirmPaymentIntent response if the postcode passed up has an issue, and do you know how to identify that error if so?
No I don't think so. Stripe doesn't do any validation on the postcode itself. It's just that the bank may decide to decline the payment