#dhruv_api
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/1496565333341769878
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hi there! You can't manipulate a PaymentIntent's status directly
and canceled is a terminal state
Ohk, can you please tell me how we can fix this and not get this error
So you created this PaymentIntent and then confirmed it and then it became canceled 7 days later
And then you tried to capture it after that, but it is already canceled. So there are sort of two quesitons - how do you prevent that scenario and how do you react to that scenario
Yes
As far as prevention, I think this is probably cancelled because the authorization is only good for 7 days, but let me check on that
Yeah that seems to be correct
If you need to hold an authorization for longer than 7 days, you can see these documents:
https://docs.stripe.com/payments/place-a-hold-on-a-payment-method#auth-capture-limitations
https://docs.stripe.com/payments/extended-authorization
As far as recovering from this situation, you can preempt by listening to the payment_intent.canceled webhook events (https://dashboard.stripe.com/test/events/evt_3TKgsXPXKItCHxUU0swhBSfr)
We give you a cancellation_reason in that event
But ultimately you'll need to proceed by creating a new PaymentIntent. If you know the amount you want to capture at that point you can just create and confirm a PaymentIntent in a single API call by passing confirm: true - see our api reference
And what should be the value of confirmation_method
you would omit it
Got it
So just pass the confirm true and that should automatically capture as well, right?
Yep; automatic capture is the default on the PaymentIntents api. You only get manual capture by explicitly requesting it