#camilo-dominguez_error
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/1342570598769102869
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hi, which document are you seeing this?
Our document: https://docs.stripe.com/elements/address-element#create-an-address-element does show a client_secret being passed
Hey how is it going?
You can see on the Docs that the Elements object says that clientSecret is optionally required nad it specify that it is required for Payemnt and Link Auth but not for the Address element.
BTW here is the link for the stripe.js Elements object as well. https://docs.stripe.com/js/elements_object/create
Yeah, you're creating the elements without creating the PaymentIntent so I see what you're saying here and that should work.
From your code, what does your elements creation look lke?
Can you double check that please?
yeah
remember this is not for payment this is for the address element.
const appearance = stripeStyling;
const element = this.stripe.elements({
locale: this.locale,
appearance,
fonts: stripeFonts,
});```js
const addressElement = element.create("address", {
mode: this.formType,
autocomplete: {
mode: "google_maps_api",
apiKey: "OUR_KEY",
},
display: {
name: "split",
},
blockPoBox: true,
allowedCountries: [getCountryAbbreviation(this.billingCountry)],
defaultValues: this.setAddressDefaultValues(),
});```js
Let me test this, it might be a while as it does not look like I have a working integration path with this specific flow.
Hang tight
thanks
Ok, it works when I pair the Address Element with with the 'Accept a Payment' flow: https://docs.stripe.com/payments/accept-a-payment-deferred?platform=web&type=payment#collect-addresses
I just followed this integration guide: https://docs.stripe.com/payments/accept-a-payment-deferred?platform=web&type=payment#collect-addresses
- added the Address Elements:
const addressElement = elements.create("address", {
mode: "billing",
allowedCountries: ["NO", "CA", "US"],
autocomplete: {mode: 'disabled'},
validation: { phone: { required: 'always', }, },
fields: { phone: 'always', },
});
addressElement.mount("#address-element");
So the address and the payment element needs to be on the same page?
We are using this on our shipping page and later on the payment page we dont load the address element.
Hi taking over as pgskc has to step away
You should be able to load the address element by itself
Not sure why you are getting this
Do you have a published test page I can look at?
No, sorry it is a private page.
The element loads but then this error crops up. It is not blocking or anything but the error is there.
How are you collecting address and passing it along to the payment element though?
It was really designed to be on the same page
Assuming you're using payment element in your flow
So for the payment page we just pre-populate the billing address information, not the shipping.
We use this on our shipping page just for the ease of use and the autocomplete.
How do you collect it and pass it through though
const manualPaymentMethod = this.useManualPaymentMethodCreation ? { paymentMethodCreation: "manual" } : {};
this.element = stripe.elements({
locale: this.locale,
appearance,
clientSecret: this.clientSecret,
fonts: this.fonts,
...manualPaymentMethod,
});
const paymentElement = this.element.create("payment", {
defaultValues: {
billingDetails: {
email: this.billingDetails.email,
name: this.fullName,
address: this.billingDetailsStripe.address,
},
},
business: {
name: "Our Business",
},
fields: {
billingDetails: {
address: {
country: "never",
},
},
},
wallets: {
applePay: "never",
googlePay: "never",
},
});
So basically we store the information that comes from the event in our db and then we pass that back from the backend to the front when we load the payment element.
yeah, which spends our budget from our sentry allocation.
Ok interesting
I'm not sure
Let me check with a colleague
Can you try passing:
mode: 'payment',
amount: 1000,
currency: 'usd',
}}```
into your Elements options for the Address Element? Just to see if the error goes away
yeah
But why do I need to pass mode payment if the mode is "shipping", I can pass amount and currency and see.
Now we get this error
Hopping back on here. I see you're using the elements separately. I think the previous advice was given to see if it ruled something out which it does not appear to be the case.
I see that this is not blocking you to collect the address. I'll share this with the product owning team as I was able to reproduce this as well on my test. Thank you for bringing this to our attention.
You are welcome!
@buoyant falcon instead of passing that mode:payment information under the address element, can you pass it in the Elements container?
const element = this.stripe.elements({
mode: 'payment',
amount: 1000,
currency: 'usd',
locale: this.locale,
appearance,
fonts: stripeFonts,
});