#amy-n_api

1 messages ¡ Page 1 of 1 (latest)

frosty magnetBOT
#

👋 Welcome to your new thread!

⏱️ We automatically close idle threads, which makes them read-only. Make sure you stick around to chat in realtime!

🔗 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/1212500111729365033

📝 Have more to share? You can add more detail below, including code, screenshots, videos, etc.

⏲️ 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. Thank you for your patience!

digital streamBOT
rough grotto
#

Hello

cosmic flax
#

I don't think that resource would show me the exact amount of balance applied to one specific invoice?

rough grotto
#

Ah I misunderstood the ask.

cosmic flax
#

In the past, I've relied on amount_remaining to show the amount of applied balance, but in this case, it's $0.

rough grotto
#

I believe you would have to calculate that yourself from the line_items if you want the specifics from an Invoice as we don't have a property that represents that.

#

Let me double check

rough grotto
#

Okay so really you should be able to get that applied balance based on the starting_balance (https://docs.stripe.com/api/invoices/object#invoice_object-starting_balance) - ending_balance (https://docs.stripe.com/api/invoices/object#invoice_object-ending_balance) for that Invoice. However.... in this specific case it is $0 which appears to be a bug to me. It should have been -$0.47 since there was a debit applied since the amount was too small to actually be charged and then it was applied to the next Invoice.

#

We are going to file a bug report about this.

cosmic flax
#

thanks, I would appreciate that

#

would it be possible for you to also point out that the invoice line item's ID in the lines property starts with sub_ instead of li_ like other invoice line items? I noticed it earlier but didn't think it was relevant

#

I think there's a lot of inconsistency in this specific invoice JSON

#

(the credit notes have an invoice_line_item property that shows the real line item ID, I think)

rough grotto
#

Hmm it should start with si_xxx for the Subscription Item, which is expected.

#

Is that what you are referencing?

cosmic flax
#
  "lines": {
    "data": [
      {
        "amount": 49900,
        "amount_excluding_tax": 49900,
        "currency": "usd",
        "description": null,
        "discount_amounts": [],
        "discountable": true,
        "discounts": [],
        "id": "sub_1NeMOnIZ1PF9tmyNfswiANl2",
        "invoice": "in_1O0ThCIZ1PF9tmyNknwqhQmF",
#

here's a portion of the JSON

#

I'm referring to the second line from the bottom

rough grotto
#

Oh, yeah that is related to what I'm saying above -- that is a Subscription Line Item that is carried down to the Invoice. That is why you see the Subscription ID. It sounds like you are more interested in the Invoice Item data for each of these line items though, regardless of which type of line item? In which case you can just expand lines.data.invoice_item to see that. But yeah, that part is expected in terms of seeing the Subscription ID.