#krs_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/1263751371702931476
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
hello! Maybe can you share why you are looking to use confirmation tokens with SetupIntents?
When the user inputs the card details, we need to find the funding type of the card (like credit or debit card), when we use confirmation token api, the response has the funding information of the payment method.
And we use the SetupIntent to create the payment method and save the payment method id in our platform.
Since the elements is pased in confirmSetup api, and also confirmation token API, we are exploaring if we can pass the elements via confirmation token and use the token with confirmSetup, instead of passing elements on both instances.
Sorry, I'm quite confused here - generally, you need to find the funding of the card before you accept payment. In the case of a SetupIntent, you're saving the card for future use, not accepting payment yet. Once the SetupIntent is confirmed, you would have the PaymentMethod and can examine it to know the funding type
We have a screen to show the processing fees at the time of card input, so we wanted to show processing fees based on cards, before we proceed further.
if we are able to get the fudding directly from the stripe JS, then it would reduce the number of API calls and makes the processing faster.
Is there a option to examine the PaymentMethod via StripeJS itself (with public stripe API key)?
hrm, i see. To answer your question, the SetupIntent does accept a confirmation token : https://docs.stripe.com/api/setup_intents/create#create_setup_intent-confirmation_token
If you want to examine the PaymentMethod from the frontend, I suggest that you also look into the deferred flow :
Build an integration where you can render the Payment Element prior to creating a PaymentIntent or SetupIntent.
Build an integration where you can render the Payment Element prior to creating a PaymentIntent or SetupIntent.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
This is what we are trying to do - create confirmation token by passing elements and the use the confirmation token to confirm the setup. When we do that, we are hit with this error message - https://dashboard.stripe.com/test/logs/req_qyFeAWQHDvU1wu
in the confirmation token, i don't see you defining the data to be prefetched?
do you have an example on how i should pass that?
payment_method_types=["card", "us_bank_account"],
payment_method_options={
"us_bank_account": {
"financial_connections": {
"permissions": ["payment_method", "balances"],
"prefetch": ["balances"],
},
"verification_method": "instant",
},
},
confirm=False
)
i'm guessing that you're initializing elements with an options object right?
this is how we create the setup intent and pass the client secret to frontend
so generally, on the frontend, you should have something like
const options = {
mode: 'setup',
paymentMethodCreation: 'manual',
...
};
right?
you should include the prefetch parameter in there too
clientSecret: clientSecret,
redirect: 'if_required',
confirmParams: {
confirmation_token: id,
},
});
};```
this is how our confirm setup in the frontend is..
well, the id for the confirmation_token has to come from somewhere - look for something like stripe.createConfirmationToken in your code
elements,
params: {
payment_method_data: {
billing_details: {
address: {
country: 'US',
},
},
},
},
});
const { id = '' } = confirmationToken || {}
this is how the confirmation token id is created
okay, so there should be an options object that is being passed into elements i.e. something like what is shown in this section : https://docs.stripe.com/payments/build-a-two-step-confirmation#add-and-configure-the-elements-provider-to-your-checkout-page
can you find that?