#Guillaume - Refund Amount

1 messages ยท Page 1 of 1 (latest)

obsidian rampart
#

Hello! I think that's correct, but let me confirm...

#

Yep, that should be it. Are you seeing an unexpected value there?

harsh sonnet
#

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?

obsidian rampart
#

The Balance Transaction should have type set to refund and net should be the net change to your balance.

harsh sonnet
#

Ok. And related question, the balance_transaction object isn't included in the webhook event right? I need to query it via the API?

obsidian rampart
#

I believe that's correct, it needs to be expanded, yep.

harsh sonnet
#

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.

obsidian rampart
#

I don't believe they're visible in the Dashboard, no, you would need to fetch them from the API.

harsh sonnet
#

Ah ok, so it's not me being blind then, gotcha. ๐Ÿ˜„

obsidian rampart
#

Are you wanting to do this in test mode or live mode?

harsh sonnet
#

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! ๐Ÿ™‚

obsidian rampart
#

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:

harsh sonnet
#

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?

obsidian rampart
#

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. ๐Ÿ™‚

harsh sonnet
#

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?

obsidian rampart
#

Can you give me the ID of that Event?

harsh sonnet
#

Yes. Safe here?

obsidian rampart
#

Yep, Event IDs are safe to share.

harsh sonnet
#

pyr_1L3O4REib9TdzxSqPjpnZBIZ

obsidian rampart
#

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...

harsh sonnet
#

evt_1L3O6HEib9TdzxSqQTDXgbet

obsidian rampart
#

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.

harsh sonnet
#

Ok. I understand this isn't immediate for certain types of payments.

obsidian rampart
#

Correct.

harsh sonnet
#

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?

obsidian rampart
#

Nope, it's the same Balance Transaction.

harsh sonnet
#

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?

obsidian rampart
#

Are you handling Refund failures?

harsh sonnet
#

oh god

#

๐Ÿ˜„

#

they can fail?

obsidian rampart
#

I'm not sure if P24 refunds specifically can fail or not, but generally speaking a refund can fail, yeah.

harsh sonnet
#

I've never had that happen. Is this an outlier event that would be safe to handle manually?

obsidian rampart
#

I can't speak to what would be safe or not for you, I can only help you with the Stripe side of things. ๐Ÿ™‚

harsh sonnet
#

right.

#

So but if a refund fails, what happens to the original payment amount?

#

do I get it back?

obsidian rampart
#

Yep, it goes back into your Stripe balance.

harsh sonnet
#

is there then a new balance_transaction?

harsh sonnet
#

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?

obsidian rampart
#

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.

harsh sonnet
#

failure_balance_transaction

#

Ok.

obsidian rampart
#

Yep.

harsh sonnet
#

Ok this is all very helpful. I think I should be able to implement this now! Thanks for much for your help Rubeus.

obsidian rampart
#

No problem!

harsh sonnet
#

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! ๐Ÿ™‚

obsidian rampart
#

We keep an eye on it, yeah. ๐Ÿ™‚ Thank you very much for the kind words, really glad to hear we've been helpful!

harsh sonnet
#

Awesome, you guys srsly rock. If all I had was Paypal I would have abandoned ship years ago. ๐Ÿ˜„

#

(in case that's not clear, my webstore uses both, and I hate dealing with Paypal. Api is a mess, can't ever find someone to talk to, etc... so keep up the great job! ๐Ÿ™‚