#robinc_api

1 messages ยท Page 1 of 1 (latest)

night robinBOT
#

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

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

slender rover
cold trellis
#

Hi, thank you. What is the best way to then display if an invoice was (partly) disputed? We don't want to do an API call per invoice since this is not scalable.

#

You guys do this very well and we want to be able to do the same ๐Ÿ™ˆ

slender rover
#

yeah I can understand your point but I'm afraid since the Invoice object doesn't directly contain a reference to the PaymentIntent, the API call is necessary to check the payment's status

cold trellis
#

If we can expand this field (inside invoice.payments) I think we are helped

#

stripe invoices list --customer="cus_UDHQ1sHNHIaPoB" --expand="data.payments.data.payment.payment_intent"

You cannot expand more than 4 levels of a property. Property: data.payments.data.payment.payment_intent

#

It says expandable in the docs, how does this then work?

slender rover
#

yes it's possible to expand the payments.data.payment.payment_intent property on the Invoice object

so for example, if you're retrieving an Invoice via the API, you can pass expand: ['payments.data.payment.payment_intent] as a param and your response will include the full PaymentIntent object, nested within data.payment in the payments hash

https://docs.stripe.com/api/invoices/retrieve

cold trellis
slender rover
#

so if you're already retrieving or listing Invoices, this is an option for you, but you would still need to make an API call to get this data from the Invoice object

#

try `expand: ['data.payments.data.payment.payment_intent']

cold trellis
#

๐Ÿซ 

#

So close to the solution ๐Ÿ™

slender rover
#

ahh yes sorry it's because you're listing invoices, so you have an extra level to go through

#

if you retrieve the invoice directly it works, but not with listing for this reason - I was mistaken above

#

what's your starting point here? are you trying to get the payment state from the customer ID?

cold trellis
#

Getting the invoices from the customer, to display them

#

With their status

#

And show a โš ๏ธ or Disputed if one of the payments are disputed

slender rover
#

I see, so the customer ID is your starting point then - I'm afraid that it's not possible to do this via the API in any other way than retrieving each Invoice individually

this is definitely something that has scope for improvement on our side

#

due to this exact limitation of expanding up to 4 levels max, it's not possible to get this when listing all invoices for a customer

cold trellis
#

this is definitely something that has scope for improvement on our side
Can I follow up this feature request somewhere or open a feature request? So that we know when we can implement it on our side.

night robinBOT
slender rover
#

we can definitely file feedback with our product team but it's something that we can provide a timeline for at the moment