#funkthat-addresselement
1 messages ยท Page 1 of 1 (latest)
Hi ๐
Are you attempting to use the Stripe Address Element for this?
https://stripe.com/docs/elements/address-element
Hi @short apex, thank you for your reply - correct I am attempting to add this element.
And you are not trying to charge funds or save a payment method like a credit card?
i already have all this created, so basically i have created my own billing/customer portal and when customer need to update their address or shipping address, I want them to be able to do this
In that case I would recommend you create a Setup Intent and use that client secret.
https://stripe.com/docs/api/setup_intents/create
ok great wasn't sure about that as when I read about setup intent it referred to using it for payment's, but if it is the correct way to retrieve a secret, that is good to know ๐
and thank you ๐
Oh wait..
A colleague of mine just showed me an example of creating an Address Element without a client secret
ohhh sounds awesome
You do not have to include a client secret in your options
So then you would just listen for the address input like we describe here: https://stripe.com/docs/elements/address-element/collect-addresses to get the address from the user and send it to your server
so the idea here is retrieve the current address using an api call and display this via js after we have created this element?
i'd like the fields populated with existing data so a customer can then update if required
In that case you would pass that data to your front-end in JS and use it to populate the defaultValues parameter when you create teh Address Element: https://stripe.com/docs/js/elements_object/create_address_element#address_element_create-options-defaultValues
Perfect thank you, I'll give that a shot, if there are any further questions, is it ok to reach out here or should I raise a new question?
Thanks!
It depends on the timing. If you have a new Q in a few minutes you can come back here. Otherwise you can start a new thread.
Also if it's related to this conversation it makes sense to ask here
Thank you @short apex
Happy to help ๐