#intelagent_webhooks
1 messages ¡ Page 1 of 1 (latest)
đ Welcome to your new thread!
â˛ď¸ We'll be here soon! We typically respond in a few minutes, but in some cases we might need a bit more time (e.g., server's busy, you've got a complex question, etc.).
âąď¸ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can 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/1254964817274474517
đ Have more to share? Add 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.
- intelagent_webhooks, 2 hours ago, 19 messages
I chatted a bit in that thread linked, but the issue mentioned above is not solved by just looking at the timestamps
Hi, can you share the request id please? Here's how you can find a request ID: https://support.stripe.com/questions/finding-the-id-for-an-api-request
This isn't about a specific request, really. But I can grab a request for you sure
Here is the event for example: evt_3PV3UERbUz80Wmly0aV3gDDR
Also, it looks like you guys have figured this out: but I don't see a great way currently. But notice how each event links to a specific amount refunded
I guess technically that description ("The refund... has been compled...) could actually be coming from the previous attributes, which in this case won't help me uniquely identify the refund
What are you exactly trying to do?
I am trying to update a refund in my application when I get a charge.refunded event
When a user initiates a refund I
- create a refund object in my application
- initiate the refund with stripe
- update the application refund with the stripe id
I want to add resiliency for a scenario when the 3rd call fails and update the refund with the re_id from the event received via webhook
I see, yes each refund object is tired to the uniqur charges you're refunding. On the event, you can attain the charge id/ payment intent id: evt_3PV3UERbUz80Wmly0aV3gDDR and tie that re_ id on your end
Hmm I'm not sure I understand. I do maintain a mapping of refunds to payment intent on my end. But when I get the charge.refunded how can I understand which of the refunds to update, since there may be any number of refunds?
Are you referring to a charge needing multiple refunds?
Yes, a charge with multiple refunds might be sent as the payload in the charge.refunded
If every charge had max of 1 refund it'd be easy, I'd receive the charge, grab the refund and update in my database.
Ah, you should add metadata when you create the refunds: https://docs.stripe.com/api/refunds/create#create_refund-metadata
so this way, you can map these multiple refunds and make the necessary update your on end
Right, I do I add my refundId in the metadata. But this still doesn't solve the problem of knowing which refund to update when I get a list of refunds on the charge
When you create the refund initially, you can pass any data you want.
Then, on the event, you would see the metadata
Then, you would know which refund id to update
No that's not true though really, I would first need to fetch the charge with the refund list expanded. After I do that I might get back 50 refunds
Right?
Or are you suggesting I update all the refunds that come back after I fetch them
Are you making the refund requests on your end for one charge?
Yes, one charge, but we might refund several times
20%, 30%, then 50% or however it might work out
And then when I grab the refunds on the charge I might have N refunds come back and not understand which one generated the event, and thus which refund would need updating
So you only want to update one of the refunds? Why?
Well that might be a good question. I want to update the ones that changed. If I got 50 back I wouldn't want to update them all
Changed in which way?
Maybe changed isn't the right word. But I want to ensure I have their stripe re_id linked to my application objects
In theory for the charge.updated event there is no change. Should be what I created + a re_id. I guess I could just grab all refunds without a re_id and see if they are in the list of refunds from the charge and update them if not..?
I do not think I fully understand what you want to do maybe. If you want to be update the refund ids on your application, you can pass the metadata when you create the refund. When you get the charge.refunded event, the matadata will be surfaced. So you only pass the metadata on the refunds you want to update on your application.
I guess what I was trying to avoid was updating all N refunds that might be on a charge. I would have liked to just grab the 1 refund that caused the charge.refunded event and be done with it
That is what I do not understand. On the charge.refunded event, you would see all the objects. If a refund was not issued charge.refunded event would not be sent.
But back to this:
- create a refund object in my application
- initiate the refund with stripe
- update the application refund with the stripe id
It's possible the application cannot update the refund to include the re_id as soon as it's made (step 3 fails). to cover that case we can populate the re_id on the application refund when we get a webhook event.
Appreciate you taking the time to help by the way
So on 3, if the application cannot update the refund with the Stripe id, you would already have the refund id at this moment right?
Yes correct