#cnguyen-payments
1 messages ยท Page 1 of 1 (latest)
Hi. I don't give a lot of information but I have to make 2 payments.
- Transaction 1 is an authorize on-session
- Transaction 2 is an authorize (and capture 7 days later)
- If T2 failed, I cancel T1
- If T2 success, I capture T1 (and I will capture T2 7 days later)
For now, my flow is to make :
- Back > Create PI for T1
- Front > confirmCardPayment T1
- Front > If T1 is OK, call WS to create PI for T2
- Back > Create the PI for T2
- Front > confirmCardPayment T2
- Front > If OK, I capture T1 and keep PI T2 for 7 days later
- Front > if NOK, I cancel T1
But, reading the documentation, see that (maybe) I can avoid the confirmCardPayment T2 by using confirm: true with the previous pm_XXX ?
So to be brief - yes, you can use the synchronous server-side confirmation flow that you linked to for T2.
OK. This is the best option or it's good to keep my first idea ? Or it's the same
What's your goal here? Is it to just have two transactions that are tightly coupled together (so that either both succeed, or both fail)?
Both need to succeed (that's why I authorize T1 and I make the capture only if auth T2 succeed). But if T1 failed, I don't launch T2 at all (so it's yes for both fail if it's what you mean).
So both are being done with a separate auth and capture?
Yes
T1 => I capture only if T2 OK. And T2 => I need to capture 7 days later only.
I suppose that the 2 solutions are the same, it's just server side or client side.
Gotcha - so yeah, really either option will work. The server-side confirmation flow could potentially save you a few extra calls since you can avoid the second confirmCardPayment T2 if no additional authentication is needed. But if additional action does end up being needed, you'll need to take them through that flow anyways
OK thank you. I would like to be sure/
๐ Yeah this lines up with what we recommend for charging saved cards as well (see https://stripe.com/docs/payments/save-during-payment?platform=web#web-create-payment-intent-off-session). You take the saved Payment Method and create a new Payment Intent w confirm:true
I have 2 other question:
- To capture T2, 7 days is the maximum for an authorize ? And it's by day or day/hour? To know when it's the last time to launch the capture. And I need to manage it by myself (save in DB with creation date and make a CRON)?
- For T1, after the PI creation, on the client side, when the confirmCardPayment is successful (after 3DS validation if needed), it means that the amount is on hold. Correct ? So, I can launch the PI creation of T2 with the previous saved customer + payment_method. Just ask for confirmation.
You speak about that for which part ? T2 ? Because it's another new solution (off-session) for me. Because the other solution are the both, on-session (T1 and T2). And this solution is T1 on-session then T2 off-session. Right?
Sorry I should've been clearer - I was speaking specifically for T2 that it would be a very similar flow except you wouldn't be specifying off_session: true.
Ah ok. For me it's like here => https://stripe.com/docs/payments/accept-a-payment-synchronously but it's the same
- To capture T2, 7 days is the maximum for an authorize ? And it's by day or day/hour? To know when it's the last time to launch the capture. And I need to manage it by myself (save in DB with creation date and make a CRON)?
I'm pretty certain it's by the hour. Out of curiousity, is there a reason you're waiting the full seven days?
- For T1, after the PI creation, on the client side, when the confirmCardPayment is successful (after 3DS validation if needed), it means that the amount is on hold. Correct ? So, I can launch the PI creation of T2 with the previous saved customer + payment_method. Just ask for confirmation.
Yes, once confirmCardPayment is done and T1 has a status of requires_capture that means the amount is on hold and the Payment Method should be properly configured to be used for future payments
I'm pretty certain it's by the hour. Out of curiousity, is there a reason you're waiting the full seven days? => No reason, it would be 5 days. Just for now, the business choose 7 days. That's why I ask to you to be sure to launch the capture before the end of the authorize.
- And I need to manage it by myself (save in DB with creation date and make a CRON)?
Yes you would need to manage the capturing yourself