#arn4v_best-practices

1 messages ยท Page 1 of 1 (latest)

slate marshBOT
#

๐Ÿ‘‹ 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.

shrewd frigate
#

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

tired surge
#
    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?

shrewd frigate
#

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.

tired surge
#

Sure, no worries. Thanks ๐Ÿ‘๐Ÿฝ