#sudhanshu-3ds-test

1 messages · Page 1 of 1 (latest)

wanton kayakBOT
digital thicket
#

Hello @jade quarry ! I'm happy to try adn help but I'm going to need a lot more information and context beyond this one short sentence

jade quarry
#

sure

#

so first we are creating a user and then adding a payment method to that user and then allowing the user to slelect any of the payment methods and proceed with payments but when we are using test cards for authentication we are getting 'your card was declined'

digital thicket
#

Which exact test card are you using? How did you collect and attach it? Which exact end to end doc are you using?

#

sudhanshu-3ds-test

jade quarry
#

4000000000003220

#

this one

digital thicket
#

I'm sorry I ask multiple separate questions. Please try and provide all information at once to be clear about the overall issue so that I can help you!

wanton kayakBOT
jade quarry
#

so we are using react native sdk to collect payments

surreal wadi
#

👋 stepping in here as koopajah needed to step away

jade quarry
surreal wadi
#

Can you provide me a PaymentIntent ID that you tested with?

jade quarry
#

pi_3NezIxHBzVLseUqK11CZeprj

#

and could you please provide us any proper documentation from which we can initiate 3d secure?

#

we are not able to add this feature

surreal wadi
#

The React Native SDK handles this all for you assuming you are integrated correctly. Let me take a look at what you are doing based on the PI above, one sec.

jade quarry
#

yes please , we are using php for backend

surreal wadi
#

Ah okay actually you are just using the 3220 card and attempting to charge it off session. That specific card will require 3DS every time regardless of how it was set up. I can see that you are correctly setting up PaymentMethods using a SetupIntent so in this case you should test with the 4000002500003155 card

#

That said, is your flow going to charge immediately or charge later on with regards to when you actually collect these payment methods?

jade quarry
#

not immediately , we are asking user to select from one of the payment method then we are generating the payment intent based on payment method selected by user

#

and if we integrate this will it ask every cards for authentication?

surreal wadi
#

Ah okay so the customer is still within the flow when you are doing this though?

jade quarry
#

yes

#

but the setup intent UI is closed now

#

and card has been added

surreal wadi
jade quarry
#

what exactly it will do?

#

actually we are facing an issue where lot of fraud payments are happening , so we wanted to make sure that the card owner should authenticate every single transaction and if that is not authenticated the transaction should not happen

#

will this solution help me to achieve the goal?

surreal wadi
#

Yes if you want to force 3DS then you can pass payment_method_options.request_three_d_secure: 'any' when you create the PaymentIntent

jade quarry
#

'amount' => ($data['amount']+ 3) * 100 + ($data['amount']*100)*0.03,
'currency' => 'usd',
'customer' => $customer,
'payment_method' => $data['payment_method_id'],
'off_session' => true,
'confirm' => true, this is how i am creating the payment intent no w where i am suppose to add the request for 3d secure?

surreal wadi
#

Yeah in that example you are passing off_session => true

#

This means the customer isn't there

#

So they can't complete 3DS

#

If the customer is going to be present each time then you should not pass off_session => true

jade quarry
#

and confirm => true?

surreal wadi
#

That is dependent on whether you are going to confirm server-side or client-side.

jade quarry
#

okay

surreal wadi
#

If you pass confirm => true and request_three_d_secure => 'any' then the PaymentIntent is going to move to requires_action

#

At which point you will need to handle 3DS on the client

#

So really I would just not confirm on the server and instead just create the PI and pass the client secret to the client and then confirm there

jade quarry
#

'amount' => ($data['amount']+ 3) * 100 + ($data['amount']*100)*0.03,
'currency' => 'usd',
'customer' => $customer,
'payment_method' => $data['payment_method_id'],
'confirm' => true,
'request_three_d_secure'=> 'any',

#

is this okay?

surreal wadi
#

Personally I'd remove confirm => true

jade quarry
#

okay after that it will ask client to authenticatre if i send the PI and client secrete?

surreal wadi
#

Yep you would use confirmPayment() on the client

#

Sorry wait a second

#

We are getting mixed up here.

jade quarry
#

okay

#

okay please clear this out

surreal wadi
#

You said this is when you are collecting a PaymentMethod

jade quarry
#

i need to fix this

#

asap

surreal wadi
#

The first time, yes?

#

Not a "re-use" scenario.

jade quarry
#

yes we are collecting the payment method for first time , now it depend on user which exact payment method he/she chose the new one or already added one

surreal wadi
#

Okay so you aren't going to have a PaymentMethod at all yet and you don't need to worry about that. You just create a PaymentIntent like: ```'amount' => ($data['amount']+ 3) * 100 + ($data['amount']100)0.03,
'currency' => 'usd',
'customer' => $customer,
'request_three_d_secure'=> 'any',

jade quarry
#

and then i have to return the payment intent and client secrete to frontend right?

#

where they can use the confirmPayment() method?

surreal wadi
jade quarry
surreal wadi
#

Ignore the confirmPayment() part

jade quarry
#

by the user

jade quarry
surreal wadi
#

You won't use that since you are using PaymentSheet

jade quarry
#

okay

surreal wadi
#

As long as you select customFlow: truethen when const { error, paymentOption } = await presentPaymentSheet(); resolves you will know the PaymentMethod based on paymentOption

jade quarry
#

so i have to keep the payment method part while creating the payment intent right?

surreal wadi
#

After that you use const { error } = await confirmPaymentSheetPayment();

jade quarry
#

'amount' => ($data['amount']+ 3) * 100 + ($data['amount']*100)*0.03,
'currency' => 'usd',
'customer' => $customer,
'payment_method' => $data['payment_method_id'];
'request_three_d_secure'=> 'any',

#

this will be my create payment intent?

surreal wadi
#

No you won't have the PaymentMethod ID

#

Because you are handling all of this client side.

#

The PaymentSheet will show the saved PaymentMethods for you.

jade quarry
#

no we are not using that payment sheet

#

we have our own

#

custom payment sheet were we are showing all of the cards(payment methods) which are added

#

by the user

surreal wadi
#

So I'm confused.

jade quarry
#

okay i will explain

#

the payment sheet opens and user create new payment method or edit the existing one

#

then we close that sheet and show all the payment methods on out custom screen

#

from that screen user select a particular card( which has a payment method)

#

now we use that payment method to initiate the poyment intent

#

now what should we do next to authorize the payment since we are going to use request_three_d_secure = any now as an argument

#

forget about the previous PI which i sent

surreal wadi
#

Okay you are going to run into issues with this flow where the Customer has to complete 3DS twice in a row. For instance, they will oftentimes be required to complete 3DS when you save the new card. Then if they attempt to pay with that card immediately and you force 3DS then they will have to complete it again.

jade quarry
#

is there any possible way to use this flow only and integrate 3d?

#

because this is how our flow is

#

what if we are okay with authenticating user twice?

surreal wadi
#

If you are okay with it then that's fine

#

Just will be a bad customer experience

jade quarry
#

okay if we authenticate user while adding the card only , then is it okay if we dont ask user to authenticate while payment?

#

or will it ask to authenticate again?

jade quarry
surreal wadi
#

Yeah if you are going to go the route you are suggesting right now i would basically just not pass request_three_d_secure: 'any' if the customer selects the card they just added. Otherwise, if they select a previously added payment method then you can pass that param to force 3DS.

surreal wadi
#

Just omit off_session => true

#

So that the PaymentIntent then moves to requires_action and you can then handle 3DS on your client via confirmPayment()

jade quarry
#

incase if i pass request_three_d_secure: 'any' it will ask the user again to authenticate right?

surreal wadi
#

Yes

jade quarry
#

okay got it thankyou so much for helping out one more question how to keep this conversation pinned ? just by pinning this thread?