#cryptoacp_api
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/1352040337593471036
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hi Palamedes, I need to find the stripe documentation to integrate the new places API. Not the legacy one
Recently google has stopped enabling legacy version of Google Places API
Instead they have replaced with Google Places (New) API
Is there way I can update the Stripe Address Element?
Only way I can think of is to add custom Input Field, when user type I can get the suggestion from the Google Places (New) API
And when user select any suggestion,
I can update the various fields like Address, City, State, Country, Zip of Stripe Address Element
Taking a step back, what do you want to do? What problem are you trying to solve? Do you just want for the Stripe Address Element to use Google Maps autocomplete?
yes I want to support something like this
https://docs.stripe.com/elements/address-element
But I have Google Places(New) API
With legacy Google Places API it works fine, but the problem is this is not working with Google Places(New) API
So that when user type in, it sugges the address and populate the selected address fields in Stripe Address Element
Hi! I'm taking over for my colleague.
If I understand this correctly, you want to have a field in your checkout flow that uses the Google Places API to get a 'proper' address, and then pre-fill the Address Element with that info?
yes
Is there a reason you don't want to use the Address Element's autocomplete (which is powered by Google under the hood)?
it supports Google Legacy Places API only
which is disabled for new Google Console Accounts
Instead google has provided Google Places(New) API
and that Places(New) API is not supported in Address Element's autocomplete
Cool. I don't think Stripe uses your Google account for the lookup, so that shouldn't affect anything.
I am using this, as I am implementing custom checkout form
and it does need Google Places API
If you use the Address Element alone, you must use your own Google Maps API Places Library key, which is managed separately from your Stripe account. Pass the key in the autocomplete.apiKey option.
If you use the Address Element and the Payment Element together, Stripe enables autocomplete with no configuration required. This is done using a Stripe-provided Google Maps API key.
Are you also using the Payment Element?
yes
const addressElement = elements.create("address", {
mode: "shipping",
autocomplete: {
mode: "google_maps_api",
apiKey: "{YOUR_GOOGLE_MAPS_API_KEY}",
},
});
Is there way I can pass the fields to Address Element? I can add my Auto Complete field using Google Places(New) API
Like this we can pass the default values while creating
const addressElement = elements.create("address", {
mode: "shipping",
defaultValues: {
name: 'Jane Doe',
address: {
line1: '354 Oyster Point Blvd',
line2: '',
city: 'South San Francisco',
state: 'CA',
postal_code: '94080',
country: 'US',
},
},
});
is there way to update these values on the fly? Say I implement my custom Auto Complete field and widget, and when user select the address, I can pass these fields to Address Element
If you're also using the Payment Element, you don't need your own Google API key for autocomplete.
Can you send me the some reference?
And if we have to use combination of Address Element and Card Element?
there?
You do have to use a combination of Address Element and Card or Payment Element in the same group.
Are you using React Native?
I am using PHP
I have to use combination of Address Element and Card for now as this is already implemented
Later I will migrate to combination of Address Element and Payment Element when 3DS support + Apple Pay is required
but for now Address Element and Card
I'm not sure if using the same elements instance for both Address and Card will let you use Stripe's Google API Key, but it's worth a try - have you tried it yet?
I have tried, with Legacy key its working
but that one is not accepting the new places API key
new places api key works differently via sessions
It won't work with the new key then.
Is there way I can update the Stripe Address element fields?
I have implemented the custom autocomplete, but could not find any way to pass the selected address to Stripe Address Element
There is way to pass Default
const addressElement = elements.create("address", {
mode: "shipping",
defaultValues: {
name: 'Jane Doe',
address: {
line1: '354 Oyster Point Blvd',
line2: '',
city: 'South San Francisco',
state: 'CA',
postal_code: '94080',
country: 'US',
},
},
});
but could not find a way to update
there?
No, you can't update the fields.
so what is the way then?
You can either have a legacy Google API key, or use a payment element at the same time and make use of Stripe's API key.
can you give me reference for this?