#tarantino-47_api

1 messages ยท Page 1 of 1 (latest)

fleet ivyBOT
#

๐Ÿ‘‹ Welcome to your new thread!

โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

๐Ÿ”— This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1304088493194215478

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

quartz apex
#

hi! it's possible yes, you just have to handle it and let the customer complete 3D Secure.
in your example you're doing an off_session payment on a saved card so you'd contact the customer, get them back on your site where you confirm the PaymentIntent on the frontend. See https://docs.stripe.com/payments/save-and-reuse-cards-only?platform=web&payment-ui=direct-api&lang=java#web-create-payment-intent-off-session
really, the same thing you'd do in general if you tried to place a hold on a saved card and it declined.

tall roost
#

I see, so on the front end I can handle such case by checking payment intent status?

like if "A request to create a PaymentIntent failed" I still return it to the front end and on the front endI check if payment intent status equals authentication_required than I need to initiate 3DS by handleNextAction and confirm the intent

quartz apex
#

well why are you passing off_session=true when the frontend (and presumably the customer) is present? ๐Ÿ™‚
usually you create the PaymentIntent on the backend, and use confirmPayment in the frontend to process the payment. off_session=true and confirm=true are only for if you're processing a backend payment on a saved card.

like if "A request to create a PaymentIntent failed" I still return it to the front end and on the front endI check if payment intent status equals authentication_required than I need to initiate 3DS by handleNextAction and confirm the intent
it's sort of like that but make sure to read the doc I linked in detail , because when you use off_session=true you do not get an action and can't use handleNextAction, instead you re-confirm the PaymentIntent.

tall roost
#

let me think

#

I haven't build this by my own, but from what I know even if the product price is 0$ we still wanna make sure customer has some amount of money on it as there is an autopay logic, we'll charge them later

I'm assuming that's why we need off_session=true and confirm=true

quartz apex
#

possibly! I would say in general I don't think we/card networks like Visa/Mastercard encourage that kind of "check" since it's often treated as "card testing" fraud. It's generally better to just authorise the actual amount you want, and to handle declines, rather than do things like "auth a tiny amount to test if the card is good".

tall roost
#

do not get an action and can't use handleNextAction, instead you re-confirm the PaymentIntent.
looks like it's doable, just check appropriate fields in the payment intent and then use handleNextAction or re-confirm the PaymentIntent?

#

I see

quartz apex
#

yes it's totally do-able to handle a case like your example

tall roost
#

one more question, how to determine if I can use handleNextAction or not?
I see there is a field in the payment intent: "next_action": null,

so in order to handle my case I need to check these two fields:
"decline_code": "authentication_required", and
"next_action": null,
it that correct?

fleet ivyBOT
quartz apex
#

the doc https://docs.stripe.com/payments/save-and-reuse-cards-only?platform=web&payment-ui=direct-api&lang=java#web-create-payment-intent-off-session does explicitly address this :

the request also fails with a 402 HTTP status code and the status of the PaymentIntent is requires_payment_method
...
Check the code of the Error raised by the Stripe API library or check the last_payment_error.decline_code on the PaymentIntent to inspect why the card issuer declined the payment.

If the payment failed due to an authentication_required decline code

#

so yes, you check the decline code