#daan_webhooks

1 messages ¡ Page 1 of 1 (latest)

upper vineBOT
#

👋 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/1308360929205026836

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

solid zealot
#

hi there!

#

I know there is a refunds array on the charge object but it's not expanded for webhooks.
two options:

chrome lance
#

But then how will I know what refund the webhook is for? I have my own refund objects for my API that store a list of products the refund is for, the object also stores the chargeID and the refundID

#

Is there a way to get the refundID from the charge object?

solid zealot
#

But then how will I know what refund the webhook is for?
what do you mean? you get a Charge object in the webhook event. so you know the ID of the charge.
then you call https://docs.stripe.com/api/refunds/list?lang=go with the ID of the Charge, and you get all the refunds for that charge.

chrome lance
#

Yes but you can have multiple refunds for a single charge, so how do I know which refund was successful? Or do I need to fetch all of them after the webhook is received to see which one was successful

solid zealot
#

the list endpoint will return all refunds in reverse chrolological order. so the first one is the list is the latest one.

chrome lance
#

Ahh alright, that good to know. I'll probably just loop trough them and find the matching one. Thanks for your help!