#morey-paymentintents-3ds
1 messages · Page 1 of 1 (latest)
Just to make sure I know all the background, is there a particular reason you're using this flow? This is not the default most integrations go through
Hey sure. It's becuase i have a video call service. and the amount isn't known until end of the call. So i have a build a custom flow.
If the checkout fails at end of the call with "require_action" then I want the 3ds to show up on the end_call screen.
Credit cards and stripe customers were created and attached before the call started.
Ah I see - so your flow is one where you're charging a saved card later, and you want to make sure you properly handle when additional actions like 3DS are needed?
yes 😄
Gotcha, so the flow you described is close, but not quite correct. You wrote "Client open 3ds link in new tab next_action.use_tripe_sdk.stripe_js", which isn't exactly how it works. With 3DS you should either be using our Stripe.JS library to trigger/display the authentication page for you, or you'll pass in a return_url when you create the Payment Intent to indicate that you want to handle the redirect yourself.
If you want to handle the redirect yourself the flow would go like this:
- Customer wants to pay
- Server creates a Payment Intent w/ the amount,
confirm: true, and setreturn_url - If additional action is required, redirect your user to the 3DS page specified in
next_action.redirect_to_url.url(see https://stripe.com/docs/payments/3d-secure#manual-redirect) - Payment is complete after they've authenticated on the 3DS page
Is your goal to handle displaying the 3DS page yourself?
Well, I just want to display it whenever a charge fails. Which can happen on 2 screen my app.
- After a call
- Customer depositing to wallet themselves.
fails with next_actions*
for 2. Server creates a Payment Intent w/ the amount, confirm: true , and set return_url
The object I am getting looks like this:
"next_action":{
"type":"use_stripe_sdk",
"use_stripe_sdk":{
"type":"three_d_secure_redirect",
"stripe_js":"https://hooks.stripe.com/redirect/authenticate/src_1Jh5GPLXSN9kljfYyiPEXx2S?client_secret=src_client_secret_OLB60Q1uTLhJTUcCZ0gKFSAo&source_redirect_slug=test_YWNjdF8xSGl0SmhMWFNOOWtsamZZLF9LTG1xNlV3VGpRUDJSQ2JiV0t3Q1NoRDlmR2lPc3la0100IR69OVPr",
"source":"src_1Jh5GPLXSN9kljfYyiPEXx2S"
}
},```
isn't return_url and stripe_js same?
No, those are different - if you want to just direct a user to a URL to complete authentication you need to pass in a return_url (see https://stripe.com/docs/api/payment_intents/create#create_payment_intent-return_url). When next_action.type: use_stripe_sdk that means you should be using Stripe.js to handle the next action and it's what you'll get back if you don't specifiy a return_url
Yeah definitely read through https://stripe.com/docs/payments/3d-secure#manual-redirect
I have something like this now returned:
return_url should be the page a customer sees right after 3ds success?
"next_action":{
"redirect_to_url":{
"return_url":"https://lysterium-web-client-dev.vercel.app",
"url":"https://hooks.stripe.com/redirect/authenticate/src_1Jhjv1LXSN9kljfYVKx5iGMT?client_secret=src_client_secret_qc8oDcNijRpbvG1UWArBPzle&source_redirect_slug=test_YWNjdF8xSGl0SmhMWFNOOWtsamZZLF9LTVNxUGNPdVNiUzRBNlVkejBad24zNDBiMTFoUDhy0100RsCalZFL"
},
"type":"redirect_to_url"
},
If this looks right I'll follow the rest of your process from
2. Server creates a Payment Intent w/ the amount, confirm: true , and set return_url
3. If additional action is required, redirect your user to the 3DS page specified in next_action.redirect_to_url.url (see https://stripe.com/docs/payments/3d-secure#manual-redirect)
4. Payment is complete after they've authenticated on the 3DS page