#kristineannmon
1 messages · Page 1 of 1 (latest)
So you want to filter the list of balance transactions by type=refund? https://stripe.com/docs/api/balance_transactions/list#balance_transaction_list-type
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
I'll be listening to charge.refunded webhook event and the Balance Transaction ID from that payload will be used for matching transactions under a Payout record. But the problem is that it is not the actual Balance Transaction ID of the refund record.
So I was thinking that maybe I'll use "List all refunds" API just to get the actual Balance Transaction ID of the refund record.
Ah, I see, so you want to get the balance transaction that associated with the refund, not the charge
So based on the API documentation, I'll either provide a Payment Intent ID or Charge ID. But the problem is that there is a possibility that a Payment Intent/Charge will have multiple refund linked to it so how can I identify the Balance Transaction ID?
Yes, that is correct.
When you receive charge.refunded event, you should expand the refunds list https://stripe.com/docs/api/charges/object#charge_object-refunds and get the balance_transaction from the refund object
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
So that means I'll be using the "Retrieve a charge" API?
Yes
Is there a reason why "refunds" list is not included in the response?
By the way, this is the whole timeline of the payment.
It's not included by default, and you expand it https://stripe.com/docs/api/expanding_objects#expanding_objects
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
I can set the "refunds" list now.
But I still have a problem.
In my scenario, we will be only creating a record when the charge.refunded webhook event is triggered. So based on that payload, I got the necessary details to execute the "Retrieve a charge" API but the problem is it might have multiple linked refund records. So is it safe to use "created" to match refund record from the charge.refunded webhook event payload to the retrieved refund records from the response of the API callout?
Can you tell me why multiple refunds is a problem here?
Because I want to track down the exact refund record based on the refund record from the charge.refunded webhook event payload. I mean how can I know which is which. So I was thinking I'll be using "created".
A charge object may have multiple refunds because you can create partial refunds for one charge. I'd suggest you to update your data strcture to accommodate this.
Okay Jack, thank you so much for your help. Your help gives me a clearer picture on how I will approach this one. Again, thank you.