#idhruv-3DS

1 messages · Page 1 of 1 (latest)

hasty phoenix
#

👋 happy to help

#

taking a look at your PI

ebon veldt
#

sure

hasty phoenix
#

you confirmed the PI in the backend right?

ebon veldt
#

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

sweet turtle
#

I mean , stupid question, but did you actually click the "complete" button in that screenshot to actually do the 3DS action?

ebon veldt
#

yep

#

it is in test mode using test card

sweet turtle
#

and when you did what did the Promise in your code from calling the stripe.js library return?

ebon veldt
#

this i dont know

#

stripe.js library part is not implemented i think

#

strange but then howcome popup is opening

sweet turtle
#

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

ebon veldt
#

actually this functionality is done by someone else and i am extending it but i still do not locate ui code anywhere

ebon veldt
#

none of these methods are called anywhere

#

i am checking on ui side

sweet turtle
#

my guess is either you're not actually clicking the button, or you're using a different PaymentIntent.

ebon veldt
#

no no i am clicking on the button for sure

sweet turtle
#

and when you do what happens? the popup closes?

ebon veldt
#

popup closes and the logic goes ahead to our next page

sweet turtle
#

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.

ebon veldt
#

okay actually the code that opens this popup i still cannot locate

#

trying it

sweet turtle
#

ok, look for confirmSetup then

#

or confirmCardSetup.

ebon veldt
#

confirmCardSetup this worked

#

okay i located it

sweet turtle
#

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.

ebon veldt
#

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

ebon veldt
sweet turtle
ebon veldt
#

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

sweet turtle
#

how would you get payload.cardId?

ebon veldt
#

okk

sweet turtle
#

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).

ebon veldt
#

hmm okk