#cryptoacp_api

1 messages ¡ Page 1 of 1 (latest)

rough duneBOT
#

👋 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.

dull steeple
#

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

unique arch
#

Hi there - what is your question?

#

jinx!

#

looking

dull steeple
#

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

unique arch
#

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?

dull steeple
#

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

Use the Address Element to collect complete billing and shipping addresses.

#

So that when user type in, it sugges the address and populate the selected address fields in Stripe Address Element

rough duneBOT
versed ember
#

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?

dull steeple
#

yes

versed ember
#

Is there a reason you don't want to use the Address Element's autocomplete (which is powered by Google under the hood)?

dull steeple
#

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

versed ember
#

Cool. I don't think Stripe uses your Google account for the lookup, so that shouldn't affect anything.

dull steeple
#

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.

versed ember
#

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?

dull steeple
#

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

versed ember
#

If you're also using the Payment Element, you don't need your own Google API key for autocomplete.

dull steeple
#

Can you send me the some reference?

#

And if we have to use combination of Address Element and Card Element?

#

there?

versed ember
#

You do have to use a combination of Address Element and Card or Payment Element in the same group.

#

Are you using React Native?

dull steeple
#

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

versed ember
#

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?

dull steeple
#

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

versed ember
#

It won't work with the new key then.

dull steeple
#

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?

versed ember
#

No, you can't update the fields.

dull steeple
#

so what is the way then?

versed ember
#

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.

dull steeple
#

can you give me reference for this?

dull steeple
#

this has below snippet

const addressElement = elements.create("address", {
mode: "shipping",
autocomplete: {
mode: "google_maps_api",
apiKey: "{YOUR_GOOGLE_MAPS_API_KEY}",
},
});

#

but you are saying that we can use the autocomplete without google map api key