#stephchl_code
1 messages ยท Page 1 of 1 (latest)
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
๐ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1336796196865576971
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hi there ๐ let me step through those questions.
While testing, the PaymentElement's onChange event did not provide any details on the country selected. Is this expected?
Yes, this is expected.valueonly tells you which type of payment method was selected, and not all payment methods collect address information from customers.
https://docs.stripe.com/js/element/events/on_change?type=paymentElement#element_on_change-handler-value
That field only contains a Payment Method if your integration allows the use of saved payment methods and your customer selects one of those.
https://docs.stripe.com/payments/save-customer-payment-methods
Can the AddressElement omit fields beyond phone number?
No,phoneis the only field that can be suppressed.
https://docs.stripe.com/js/elements_object/create_address_element#address_element_create-options-fields
Thank you for confirming! My follow up q would then be - do you have any examples or recommended approaches for conditionally capturing full address details based on the country selected?
๐ stepping in
The only real way to do that would be to collect the user country up front here.
You may just want to collect the Address using your own form in this case.
And then you can pass it in as the billingDetails without needing to collect it from Payment Element.
Awesome, thank you both for your help! We considered our own form field for the country, but wanted to see if there was a way to leverage stripe elements for this. Appreciate hearing your thoughts!
And also good to know this is a pattern that stripe elements can't support out of the box, as that saves some investigation time ๐