#Guillaume - Refund Amount
1 messages ยท Page 1 of 1 (latest)
Hello! I think that's correct, but let me confirm...
Yep, that should be it. Are you seeing an unexpected value there?
I've handled refunds manually up to now and am adding some automatic DB updating when receiving the event.
So not sure what I should be using.
Will the net value be the amount removed? or the net amount for this payment since it was charged and then refunded, like shown on the dashboard?
The Balance Transaction should have type set to refund and net should be the net change to your balance.
Ok. And related question, the balance_transaction object isn't included in the webhook event right? I need to query it via the API?
I believe that's correct, it needs to be expanded, yep.
Ok. Is there anywhere on the dashboard where I can actually look at these balance_transaction objects? Every time I try searching for one from its id in a related event, it just brings up the payment summary. I would like to inspect the actual object so that I understand how to handle them properly.
I don't believe they're visible in the Dashboard, no, you would need to fetch them from the API.
Ah ok, so it's not me being blind then, gotcha. ๐
Are you wanting to do this in test mode or live mode?
Either. I would have just looked at a couple refund objects and it would have shown me everything I needed to know instead of bothering you! ๐
So this might be useful if you don't know about it: you can use Stripe CLI right from the docs. Click on the little command prompt icon in the lower right corner to bring it up.
You can then do stuff like this:
Interesting, I hadn't really paid attention to this before, it's pretty cool! Can I use it in Live mode or is that too dangerous?
The version in the docs is for test mode only. If you install Stripe CLI on your computer I think you can do some things in live mode, but I believe we're planning to remove that functionality, so I wouldn't count on it sticking around. ๐
Ok, understood. It will be very useful even only in Test mode, so thank you!
One last question (I think)!
I refunded a P24 payment and after the charge.refunded event I received a charge.refund.updated event.
What's the updated event for? The docs aren't clear about this.
And which one should I use to query the balance_transaction?
Can you give me the ID of that Event?
Yes. Safe here?
Yep, Event IDs are safe to share.
pyr_1L3O4REib9TdzxSqPjpnZBIZ
Ah, that's the actual refund ID (which is also safe to share, don't worry!). I was hoping for the charge.refund.updated Event ID, which would start with evt_. I think I can get to it from here though, hang on...
evt_1L3O6HEib9TdzxSqQTDXgbet
Thanks!
Looks like that Event was triggered when the Refund's status went from pending to succeeded.
To clarify a bit further, we trigger a charge.refund.updated Event whenever a Refund object changes.
Ok. I understand this isn't immediate for certain types of payments.
So does the updated event have a new balance_transaction?
should I be handling this one too, or does the first event already tell me what amount has changed?
Nope, it's the same Balance Transaction.
Ok. So is it safe for me to ignore the updated event if all I want to do is add the refunded amount to my DB?
Are you handling Refund failures?
I'm not sure if P24 refunds specifically can fail or not, but generally speaking a refund can fail, yeah.
I've never had that happen. Is this an outlier event that would be safe to handle manually?
I can't speak to what would be safe or not for you, I can only help you with the Stripe side of things. ๐
right.
So but if a refund fails, what happens to the original payment amount?
do I get it back?
Yep, it goes back into your Stripe balance.
is there then a new balance_transaction?
Ok. So I would need to look at charge.refund.updated and check if its status is failed. If so, get the new balance_transaction to update my DB, and figure out another way to refund the customer. Correct?
Not quite, see the link above.
There's a separate property on the Refund that will have the Balance Transaction representing the funds returning to you.
Yep.
Ok this is all very helpful. I think I should be able to implement this now! Thanks for much for your help Rubeus.
No problem!
Btw does the company track how helpful you guys are on here? I hope so cause you've helped me a bunch of times and I hope you get good bonuses! ๐
We keep an eye on it, yeah. ๐ Thank you very much for the kind words, really glad to hear we've been helpful!