#stephchl_code

1 messages ยท Page 1 of 1 (latest)

austere wingBOT
#

๐Ÿ‘‹ 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.

sage valveBOT
outer tundra
#

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. value only 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

austere wingBOT
stable plinth
#

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?

glass perch
#

๐Ÿ‘‹ 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.

stable plinth
#

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 ๐Ÿ™‚