#tonybhai

1 messages · Page 1 of 1 (latest)

wet isleBOT
frigid birch
#

Hi, that response means you would need stripe.js or other SDKs (ie. iOS/Android) since it says use_stripe_sdk

#

How are you confirming client-side? If you use stripe.js already it should be able to handle all the authentication process

fringe orchid
#

I am bit confused how to confirm from client side I have sent client secret from backend but how to use it on client side

frigid birch
#

This is PaymentElement, and you will use its client secret to confirm using the confirmPayment method. It will handle 3DS for you seamlessly

fringe orchid
#

I already using this
const { error , paymentIntent } = await stripe.confirmPayment({
elements,
confirmParams: {
// Make sure to change this to your payment completion page
// return_url: ${window.location.origin}/my-tasks,
receipt_email: email,
},
redirect:"if_required"
});

<PaymentElement id="payment-element" options={paymentElementOptions} />

But in this it is showing full card element to enter card details but I have already given payment method in Creatent and now have to authorize BS 3D secure

frigid birch
#

I see, that means you are mixing things up. If you already have PaymentElement on clientside, don't pass confirm=true server-side.

#

Otherwise, is that because you already have a Customer Id and a PaymentMethod Id?

#

How did you collect that PaymentMethod Id earlier?

fringe orchid
#

I had the user's cards saved which I did when he made the first time payment I gave the option to the user that with which card he wants to make the payment Send the payment method of the card the user selected to the server side given and create new payment intent on server side

\Stripe\PaymentIntent::create([
'amount' => 1099,
'currency' => 'inr',
'customer' => '{{CUSTOMER_ID}}',
'payment_method' => '{{PAYMENT_METHOD_ID}}',
]);

and after that i got the status of require confirmation then i called

$stripe->paymentIntents->confirm(
'pi_1GszZg2eZvKYlo2C2X6lMOre',
['payment_method' => 'pm_card_visa']
);

and i got this status "status" => "requires_action"

and this

next_action" => array:2 [
"type" => "use_stripe_sdk"
"use_stripe_sdk" => array:3 [
"source" => "src_1NI2HDSGMxcvQmIS18zcbv9w"
"stripe_js" => "https://hooks.stripe.com/redirect/authenticate/src_1NI2HDSGMxcvQmIS18zcbv9w?client_secret=src_client_secret_xWCy7XY6PegFZZnHlpeBJPtF&source_redirect_slug=test_YWNjdF8xTWYxUUtTR014Y3ZRbUlTLF9PNEFjdUk5MTkwdVhPZEYyV3U5dEVJTmhIOWlyZzlo0100aYgrLJbt"
"type" => "three_d_secure_redirect"
]
]

Now I want user to confirm 3D secure from client side and I get this status "require_capture"

#

All I want to do is that if the user has already saved his cards then I should give him the option from which card he wants to pay.

frigid birch
#

Ah okie

fringe orchid
frigid birch
fringe orchid
frigid birch
fringe orchid
#

req_gMy6gA2GcMnT9Y

#

my serverside code:-

#

first we create paymentIntent ->>

#

$data = $stripe->paymentIntents->create([
// 'amount' => 100,
// 'currency' => 'AUD',
// 'customer' => 'cus_O3rsqfdfdsfsdcd1zr1QPL',
// 'payment_method' => 'pm_1NHk9WSdfdsfdsfdsGMxcvQmISZR06qF6n',

    // ]);
#

2:--- confirm

#

$data = $stripe->paymentIntents->confirm(
'pi_3NI4qcSGMxcvQmISdsfds0iZbdwwo',
['payment_method' => 'pm_1NHk9dadasdsaWSGMxcvQmISZR06qF6n']
);

frigid birch
#

I only see succeed requests. Did you get the error on client-side? Any screenshot?

fringe orchid
#

No see error in my browser then i call handlecardAction function

frigid birch
#

Could you screenshot?

#

Not sure but if you can just try the 2nd approach of using an URL, it would be faster

fringe orchid
fringe orchid
#

can i add this 'confirm' => true,
// // 'error_on_requires_action' => true,

#

in paymentIntentCreate in serversise

wet isleBOT
strange agate
#

Hey! Taking over for my colleague. Let me catch up.

#

Can you please share a complete flow of your payment please? and share a PaymentIntent Id ?

fringe orchid
#

pi_3NI5itSGMxcvQmIS0VwyjpJp

fringe orchid
strange agate
#

Ok so after you did the confirmation of the payment method in server side (req_wWNjdlwwrQjNFg) you got a 3ds action.

#

in frontend you were using handle_card_action and you got that error in the screenshot right ?

#

try passing confirm: "true" when creating the PaymentIntent

fringe orchid
strange agate
#

Ah wait you account is in India.

fringe orchid
#

no

#

but then i click on this url it is not working

#

Now url is working and give this screeen

strange agate
#

That means the PaymentIntent is now authenticated.

fringe orchid
#

but it is not show card 3d secure window

strange agate
#

This is because your account in india, that 3ds action is just a frontend redirection.

wet isleBOT
fringe orchid
#

can you tell me how to check customer default payment method and change default payment mehtod