#mike-willay_confirmation-token-billing-details

1 messages ยท Page 1 of 1 (latest)

violet oakBOT
#

๐Ÿ‘‹ 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/1387754746621726873

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

valid bloom
#

hi there!

#

can you share your code calling createConfirmationToken?

pale juniper
#

Hi
Below is the code for strip initilization
const elements = this.stripe.elements(options);
this.cardNumberElement = elements.create('payment', {
fields: {
billingDetails: {
address: 'never',
},
},
wallets: {
applePay: 'auto',
googlePay: 'auto',
},
paymentMethodOrder: [
'card',
'amazon_pay',
'google_pay',
'klarna',
'affirm',
'afterpay_clearpay',
'crypto',
],
});

#

const el = this.cardNumberElement;
const { error, confirmationToken } =
await this.stripe.createConfirmationToken({
el,
paymentMethodParams,
});

valid bloom
#

well, el is not a property of createConfirmationToken. so that explains the error.

pale juniper
#

but we need to pass the element right

pale juniper
#

I am taking it's referance from the payment initlisation

valid bloom
#

can you replace el by elements?

pale juniper
#

let me check

#

still same error

valid bloom
#

can you console.log the elements variable just before you pass it to createConfirmationToken?

pale juniper
#

yes

#

added whole object values

valid bloom
#

can you share your new createConfirmationToken code?

pale juniper
#

const elements = this.cardNumberElement;
const { error, confirmationToken } =
await this.stripe.createConfirmationToken({
elements,
paymentMethodParams,
});

valid bloom
#

why did you do const elements = this.cardNumberElement;?
the elements you need to pass is the original one: const elements = this.stripe.elements(options);

pale juniper
#

Okay, let me check with that one as well

#

IntegrationError: You specified "never" for fields.billing_details.address when creating the payment Element, but did not pass params.payment_method_data.billing_details.address.country when calling stripe.createConfirmationToken(). If you opt out of collecting data via the payment Element using the fields option, the data must be passed in when calling stripe.createConfirmationToken().
Now throwing this error

valid bloom
#

good, so we are making progress, since now the elements is correct passed.

#

I think the error message you shared is pretty clear and explains how to fix things.

pale juniper
#

Yes, and it is necessary to calll await elements.submit(); method when user has clicked on pay button when we are perfroming the action from different buttons ?

#

before calling createConfirmationToken method

valid bloom
#

when we are perfroming the action from different buttons
what does that mean?

#

can you explain your flow in more details?

pale juniper
#

when user click on this button then we calling custom click event, so to proceed with createConfirmationToken method, first we need to call the elements.submit method

valid bloom
pale juniper
valid bloom
pale juniper
#

still I am not able to get rid of this error
IntegrationError: You specified "never" for fields.billing_details.address when creating the payment Element, but did not pass params.payment_method_data.billing_details.address.country when calling stripe.createConfirmationToken(). If you opt out of collecting data via the payment Element using the fields option, the data must be passed in when calling stripe.createConfirmationToken().

#

payment_method_data: {
billing_details: {
address: {
city: null,
country: 'US',
line1: null,
line2: null,
postal_code: null,
state: null,
},
},
},
return_url: this.window.location.href,

I am passing this as nill for the address

#

and while creating the paymetn elements
create('payment', {
fields: {
billingDetails: {
address: 'never',
},
},

I set it to never

valid bloom
#

the error message tells you the answer:

the data must be passed in when calling stripe.createConfirmationToken().
so you need to pass the full address in createConfirmationToken

pale juniper
#

is there any feasibility so it allow

#

without passing the adderss

valid bloom
pale juniper
#

We are not collenting any addrees from the user so we don;t need that such details to passed

valid bloom
#

then don't set address: 'never', and Stripe will only collect the necessary information depending on the payment method selected.

pale juniper
#

Okay let me check this

violet oakBOT