#pallpointben

1 messages · Page 1 of 1 (latest)

mellow coral
quasi kite
#

Thank you for the quick reply. In that case, what is best practice for figuring out which refund a charge.refunded event applies to?

mellow coral
#

I don't think there's a way to attribute a specific charge.refunded event to a specific Refund if the Charge has multiple Refunds that happen all at once. Can you provide more details about your use case? Maybe there's an alternative I can suggest?

quasi kite
#

Sure. We are maintaining a credit balance in-app that users can "deposit" credits into through stripe. If for some reason a refund is required, we want to automatically remove an amount of credits proportional to the amount refunded

mellow coral
#

I am not a lawyer or anything, but flagging your use case sounds like it would be prohibited on Stripe per our restricted businesses list: https://stripe.com/restricted-businesses

That said, you can look at the refunds on a Charge to see all of the refunds associated with it: https://stripe.com/docs/api/charges/object#charge_object-refunds

You can check that list every time you get a charge.refunded event, process all the Refunds there you haven't previously processed, keep track of the ones you have processed in your DB, and that way every event you get will allow you to process all Refunds while ignoring the ones you've already handled.

quasi kite
#

The credit balance analogy is for simplification of the use case 🙂

Got it. Thank you for your help!