#idhruv-3DS
1 messages · Page 1 of 1 (latest)
sure
you confirmed the PI in the backend right?
means? right now i have this code in backend
// creates paymentIntent
paymentIntent = await stripe.paymentIntents.create( { amount: //some-amount, currency: 'eur', payment_method_types: ['card'], payment_method: payload.cardId, customer: userData.stripeCustomerId.toString(), application_fee_amount: fee, transfer_data: { destination: stripeAccountId } }, { idempotencyKey: uuidv4() });
// confirms paymentIntent
paymentIntentConfirm = await stripe.paymentIntents.confirm( paymentIntent ?.id, { payment_method: paymentIntent ?.payment_method });
and after these two steps I send response of paymentIntentConfirm to the UI side
so ye PI(PaymentIntent) is confirmed in this case
I mean , stupid question, but did you actually click the "complete" button in that screenshot to actually do the 3DS action?
and when you did what did the Promise in your code from calling the stripe.js library return?
this i dont know
stripe.js library part is not implemented i think
strange but then howcome popup is opening
you'd have to tell me, since it would be your code doing it.
generally it's because you use stripe.js and call stripe.confirmCardPayment or stripe.handleCardAction etc
actually this functionality is done by someone else and i am extending it but i still do not locate ui code anywhere
let me check this and revert
none of these methods are called anywhere
i am checking on ui side
my guess is either you're not actually clicking the button, or you're using a different PaymentIntent.
no no i am clicking on the button for sure
and when you do what happens? the popup closes?
popup closes and the logic goes ahead to our next page
and in that logic, add a console.log to print the ID of the PaymentIntent being used and check other details like what the Promise resolved.
yep that is it, looking at your logs. You built this in the wrong/weird way, where you create + confirm a SetupIntent (that's what your popup and screenshot is), and then you try to do a PaymentIntent on the backend.
that's wrong, you should just use a PaymentIntent immediately according to our documented guides, you shouldn't be sending the PaymentMethod to the backend to create the PaymentIntent, you should be sending the PaymentIntent to the frontend and confirming that.
sucks, okay. this code was submitted by someone else and we are working to make it better so its really difficult to locate such flaws
let me see how i can improve this
https://stripe.com/docs/payments/accept-card-payments?platform=web&ui=elements would be the overall guide that matches what you're trying to do.
so how about this:
// 1st step creates paymentIntent on backend
paymentIntent = await stripe.paymentIntents.create( { amount: //some-amount, currency: 'eur', payment_method_types: ['card'], payment_method: payload.cardId, customer: userData.stripeCustomerId.toString(), application_fee_amount: fee, transfer_data: { destination: stripeAccountId } }, { idempotencyKey: uuidv4() });
// 2nd step send paymentIntent response to UI immediately
// 3rd step - confirm the paymentIntent on UI
i shall remove confirm code from backend and implement it on frontend
how would you get payload.cardId?
I mean there are multiple ways to do this flow , one of them that's closest to what you backend does today is https://stripe.com/docs/payments/accept-a-payment-synchronously?platform=web
where you
- create PaymentMethod on frontend
- send to backend and create+confirm PaymentIntent
- send back to frontend if 3DS is required
- notify backend when complete
okk
that might work better for you but it's more legacy approach. But in general it's the wrong integration to do a SetupIntent to accept the card and then immediately try to use a PaymentIntent to charge the card(as you seem to do right now).
hmm okk