#arpu_payment-element-eventdata
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/1293992255694307360
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hi ๐
You should be able to get this information by listening to the change event on the Payment Element: https://docs.stripe.com/js/element/events/on_change?type=paymentElement
hi @proud agate yes and on ready? but there are no values return in the event
hmm looks like the event is not complete
Hmmm.. I see what you mean. I can only see the the Payment Method type
this is the event from ready
The ready event is only emitted when the element is fully rendered. SO at that point we have no information from the user
would be nice to get the selected defaultCountry in this state
But even for the change event, there isn't much data provided
yes, wonder how to get the infos
would be nice to get the selected defaultCountry in this state
That does not make any sense to me. Thereadyevent fires before your customer has done anything
But I do think the change event should include that detail
stripe automatic sets the country in the first load
and if the user do not change the country we do not get the value
ok if change give me all data if the user adds the card than all should work with change event
I see what you mean. Unfortunately we do not expose that data unless the customer selects a saved payment method
at this state this is the first time the user subscribe
Right, so unfortunately we do not currently have any events that provide these details
It is a known issue that has been raised and is being reviewed internally
I will be happy to add your request for this feature
the problem is i need to set the country in the customer_address field, because without the country all other fields are now shown in the generated invoice pdf
Okay, wait. Now I'm confused a bit.
Where are you trying to specify the country?
workflow is like this:
generate the payment intent on server ( no infos from user)
load the PaymentElement with the secret in the frontend , if user submit update the customer with address info like country address name line1 line2 on the server with stripe api
use .confirmPayment
confirm with webhook on server
the first problem is if the costumer address country is not set no address is shown in the invoice
second problem to get the country ( default selected or user changed it ) value from the PaymentElement
Okay so you want to update customer's country before you confirm the payment intent?
yes
Okay there is a way you can do this but it would require reworking your front-end code.
becasue i need this info on the invoice
And I will still file your feedback about the Payment Element
We have an integration pattern where you create a preview of the Payment Method before you create the Payment Intent
https://docs.stripe.com/payments/build-a-two-step-confirmation
Specifically in this step https://docs.stripe.com/payments/build-a-two-step-confirmation#create-ct
you create a ConfirmationToken object and it is returned to your code. This Confirmation Token will include the country associated with the payment method they used in the payment_method_preview.card.country parameter here:
https://docs.stripe.com/api/confirmation_tokens/object#confirmation_token_object-payment_method_preview-card-country