#Gizmo
1 messages · Page 1 of 1 (latest)
Hi! Let me help you with this.
Hi Vanya, thank you!
I believe we use the more generic Payment Element but I can check (it's been a while since I implemented it)
I would appreciate if you could check
Yes, it's a payment element
const paymentElement = elements.create('payment');
Does that help?
Are you still there, vanya?
Yes, sorry for delay. Please give me a few moments to check.
No worries, thanks I appreciate it!
I don't think it's possible, unfortunately. There's a change event that you can listen to, but it only gives your the Payment Method type: https://stripe.com/docs/js/element/events/on_change?type=paymentElement
Thanks for checking for me. So if I want that data I would basically need to request it twice from the customer - in a form of my own and then as part of the payment element?
You can try using Address Element, but only enabling the postal code: https://stripe.com/docs/elements/address-element
Thank you. Even with the address element, it would be a different form field than the zip code requested by the Payment element, right?
If you have an Address Element, it might not be displayed on the Payment Element. It's best to check
I see, thank you. So if I use the Address Element, I can access the Country and Zipcode via JavaScript unlike the Payment Element?
Yes
Great! Can you tell me what the syntax should look like / how i would retrieve the values entered into the Address Element on the frontend before it is submitted?
👋 taking over for my colleague. Let me catch up.
Hi tarzan, thanks for your help!
it's explained here https://stripe.com/docs/elements/address-element/collect-addresses?platform=web#web-retrieve-address
Terrific, thank you!
To be sure, if I add the Address Element to the page where the Payment Element is, the Country and Zip fields won't be duplicated in the Payment Element?
yes
Perfect, this should do the trick in that case. Thanks again for your help, tarzan.