#sreekanth_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/1232594041921605692
đ 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.
- sreekanth_api, 1 day ago, 80 messages
- sreekanth_api, 2 days ago, 46 messages
hi
for customers we are showing saved cards in the ui to select existing card to make payment... we are handling the payment with const paymentIntent = await stripe.paymentIntents.create({
amount: req?.body?.amount * 100,
currency: "GBP",
payment_method: req?.body?.paymentMethod,
customer: req?.body?.customerId,
off_session: true,
confirm: true
});
for some card error is coming as last_payment_error: {
charge: 'ch_3P9068JKyfLg4PX00d3ZbBcT',
code: 'authentication_required',
decline_code: 'authentication_required',
doc_url: 'https://stripe.com/docs/error-codes/authentication-required',
message: 'Your card was declined. This transaction requires authentication.',
payment_method: [Object],
type: 'card_error'
},
how to handle this in backend ?
You are charging them correctly, using confirm: true and off_session: true. It's just that the issuer bank declined this transaction. How did you collect this Payment Method Id ?
Using SetupIntent?
no, based on customerid we are fetching
we are adding customer and his card details before payment... to the stripe
During signup, we collect the user's card details. When the user wants to make a payment, we present their saved cards using a custom UI. The user can then select one of their saved cards and proceed with the payment.
I see. When you collect the user's card via signup, how did you do that?
I think you are using Card Element. It's not well suited for 3DS
You would want to change to the SetupIntent flow and Payment Element
const token = await stripe.tokens.create({
card: {
number: req.body['card[number]'],
exp_month: req.body['card[exp_month]'],
exp_year: req.body['card[exp_year]'],
cvc: req.body['card[cvc]'],
name: req.body.cardholder_name,
},
});
console.log("card token", token);
const customer = await stripe.customers.create({
name: req.body.cardholder_name,
email: req.body.email
// source: token // Specify the source parameter with the card token
});
const card = await stripe.customers.createSource(
customer.id,
{ source: token.id }
);
console.log("carddetails",card);
const updatedCustomer = await stripe.customers.update(customer.id, {
invoice_settings: {
default_payment_method: card.id
}
})
res.json({
message: "customer creates successfull",
success: true, customer: updatedCustomer,
card: card
});
Yes this is Token and Source, which doesn't support 3DS
Please look at PaymentElement + SetupIntent https://docs.stripe.com/payments/save-and-reuse?platform=web
okay thanks, let me check this
here user can setup his cards details during setupintent flow?
here how can we charge customers with already saved cards with custom ui ?
Yes, and you will have the Payment Method Id inside the confirmed SetupIntent
then do the same thing you are doing
We have other flows where users can add cards without using setup intents. If we implement this setup intent for adding cards, will it affect those flows if we integrate this ?
no, but you should change those flows to use SetupIntents.
is there another method to determine if a card requires authentication for payment?
so, that we will not show those cards in the custom ui, he can pay using payment elements with payment intent