#sofi-kry_code
1 messages ¡ Page 1 of 1 (latest)
đ 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/1342159003462930473
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- sofi-kry_code, 1 hour ago, 19 messages
- sofi-kry_docs, 4 hours ago, 9 messages
- sofi-kry_customer-sheet-selected-pm, 21 hours ago, 47 messages
Hello there
You likely want to read through https://docs.stripe.com/payments/paymentintents/lifecycle
That talks about the different statuses of a PaymentIntent
I read that already, but it's not clear how to deal with those states when the callback is expecting either a success or failure
Basically anything that isn't succeeded would be failed.
how come? if it's requires action we need to do the intent confirmation, don't we?
Sorry let's pause for a second.
What flow are you trying to accomplish here? The deferred-intent where you are showing PaymentSheet and then calling your backend to confirm the SetupIntent?
And are you confirming client-side or server-side?
I have a payment sheet with intent configuration
I have 2 endpoints, one for creating the intent and one for confirming
so what I had understood is that the createIntentCallback is supposed to first create the intent, and based on the status we need to do some more requests
Ah okay I see the confusion
The easiest and recommended path here is to create the PaymentIntent or SetupIntent and then you pass back its client secret to the frontend to confirm on the frontend as we show here: https://docs.stripe.com/payments/mobile/accept-payment?platform=android&type=payment#confirm-the-payment
At that point you don't have to worry about the PaymentIntent status at all, you just receive the onPaymentSheetResult() callback.
I've followed that documentation but it doesn't specify everything I need. If I don't pay attention to the PaymentIntent status, how do I know when to trigger the intent confirmation?
The intent confirmation is handled on the client automatically based on CreateIntentResult.Success(response.clientSecret)
You only return an error to the client if your PaymentIntent creation request fails.
The actual status is irrelevant -- it will always be in requires_payment_method at that point.
(Assuming it is created successfully)
I'm a bit lost... I had to add an endpoint to confirm the intent, which receives the confirmRequiredActionUrl and clientSecret, is that not needed?
No you don't need a separate endpoint to confirm the intent.
You just need an endpoint to create the intent and that endpoint returns the clientSecret to the frontend.
When I comment out the call to confirm, and use the 3d secure test card and mark the checkbox to save it, it doesn't get saved
Are you passing setup_future_usage when you create your PaymentIntent?
And do you have an example PaymentIntent ID you can share where you tested that?
No, I'm not passing setup_future_usage
Gotcha, then yeah the PaymentMethod won't be saved if you don't do that.
I think this is from the last test pm_1QucULF0F6bEajPq3LZaLWJB
Why are you passing confirmation_method: 'manual'?
I'm not doing that on Android side, maybe on the backend? I don't know why
Yes that is happening on the backend.
So yeah this is why you thought you needed a confirm endpoint.
But overall, that is our legacy server-side confirmation flow.
so if we change it to automatic we wouldn't need any confirmation?
Yes correct
If you change that to automatic then it would be the flow I described above.
Where confirmation happens on the client without needing to do anything else on the server afterwards.
ok I will need to discuss this with other devs
Could we get a support ticket from this conversation to continue tomorrow?
If you do want to do server-side confirmation then you should follow this guide: https://docs.stripe.com/payments/mobile/finalize-payments-on-the-server
You really shouldn't use confirmation_method: 'manual' at all as that is legacy.
No but you can pop back in here tomorrow and someone will be here to help and this thread will be referenced in that new message.
alright, thank you