#arn4v_best-practices
1 messages ยท Page 1 of 1 (latest)
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always 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/1263571727213006908
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Charges have a refunds property that is hidden by default and only shows if you specify to expand that field https://docs.stripe.com/api/charges/object#charge_object-refunds
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 you can add that to your list of expanded fields. Refunds do also have their own balance transactions, but I forget if you can expand deep enough to get those as part of the same call here
const invoices = await StripeAPI.invoices.list({
customer: customerId,
expand: [
'data.charge',
'data.charge.balance_transaction',
'data.charge.refunds',
],
status: 'paid',
limit: 100,
});
Ah got it! Thank you.
So I'd need to add 'data.charge.refunds.balance_transaction' here. IIRC up-to 4 levels of expansion is allowed. I think this would be valid?
I think that's correct
Ah I think we are one level too short. Our properties that contain arrays will have those arrays in a data property. So you would need to put refunds.data instead of just refunds which would mean you would need 'data.charge.refunds.data.balance_transaction'
Would you mind trying that in test mode just to see? A bit too busy to test myself now.
Sure, no worries. Thanks ๐๐ฝ