#marcin_best-practices
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/1341502653762506773
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hello
A refund could fail, yes and yeah you can listen to refund.updated or refund.failed events & check the refund status
https://docs.stripe.com/refunds#refund-events
I need to use sdk v79 which does not have refund.failed. Will change from pending->failed trigger refund.updated webhook?
It should. You can test it out with the test card here - https://docs.stripe.com/testing#refunds
a refund can appear to succeed and later fail, or can appear as pending at first and later succeed
^ quote from doc you've sent.
pending -> failed/succeed seems obvious, but what's the best practice to handle succeed->failed?
I need to maintain an internal state of a payment and notify other services if there is a successful/failed refund.
Then, should I ignore the refund status that API returns on refund create, treat refund as pending and always listen for either refund.updated or charge.refunded webhook?
Yeah I'd listen for refund webhook events and update the internal state accordingly rather than polling refunds API for the status
Since the failure is async, you'd want to rely on webhook events as source of truth
Thanks a lot