#MarkoBoras
1 messages · Page 1 of 1 (latest)
Hi there!
Can I pass payment intent id?
Yes: https://stripe.com/docs/api/refunds/create#create_refund-payment_intent
which event should I listen on webhook endpoint when refund succeeds
A refund succeeds by default, but you can listen tocharge.refund.updatedin case the refunds fails. This is covered here: https://stripe.com/docs/refunds#failed-refunds
Refund always succeeds? I don't understand that?
I need to do some database updates on successful refund.
Sorry I wasn't clear.
When you create the refund you will direclty get a reponse from Stripe that contains the refund status: https://stripe.com/docs/api/refunds/object#refund_object-status
So no need for a webhook event, just check the status. But if the status is succeeded, note that it can sometimes fail later. That's why we recommend listening to charge.refund.updated
aaaaa
so you recommend to do like this
Create refund in my backend function.
Listen for charge.refund.updated event
Update my database on charge.refund.updated
?
Oh wait I was wrong. What we recommend doing is:
- Listen to
charge.refundedto mark the refund as successful - And listen to
charge.refund.updatedto update the refund status accordingly
what property should I read in charge.refund.updated to know if refund went successfull or failed?
This event will contain a charge object. So just check the status of the refund https://stripe.com/docs/api/refunds/object#refund_object-status