#veequeetch_api

1 messages ยท Page 1 of 1 (latest)

stoic yokeBOT
#

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

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

blazing crow
#

Um you are right! Checking..

unreal acorn
#

Just to clarify I am talking about the invoice line item object, not the invoice object (miswrote my initial message).

blazing crow
unreal acorn
#

How would one derived the equivalent value of amount_excluding_tax?

#

Pulling the definition of the attribute... "The integer amount in cents representing the amount for this line item, excluding all tax and discounts."

#

I don't think it would be amount given they both coexisted? The description for amount is pretty vague, which is why I am not so confident about it ("The amount, in cents.").

blazing crow
#

Yes so you would want to use the discount_amounts.amount subtract the taxes.amount to get the same value. Please test it in Sandbox and let us know if you see a discrepancy

unreal acorn
#

Sorry, I may not be following. Just to reiterate. You are saying sum up discount_amounts.amount and then subtract it with taxes.amount? If this is the case how does that work when there is no discount? The discount_amounts would be an empty collection.

blazing crow
#

Sorry, I meant use the amount, subtract the sum up of discount_amounts.amount then subtract with taxes.amount

unreal acorn
#

I see an immediate problem with that. From the sandbox I see that amount equates to the value of the Price before taxes and discount. So doing what you suggested would end up with a lesser value.

From what I understood the amount_excluding_tax is the value before taxes and discount. By subtracting amount with discount and taxes the value would be completely different.

#

Which leads back to the question, what was the difference between amount and amount_excluding_tax? They seems to be equivalent to me, but I am not 100% sure.

#

Here is what I am getting out of the sandbox. Line item is for a $9 subscription. This is before taxes and discounts are applied.

#
#<Stripe::InvoiceLineItem:0x15cd48 id=il_0RMgr9WciwNzvqwFPTmO2qpa> JSON: {
  "id": "il_0RMgr9WciwNzvqwFPTmO2qpa",
  "object": "line_item",
  "amount": 900,
  "currency": "usd",
  "description": "1 ร— Basic Access (at $9.00 / month)",
  "discount_amounts": [
    {"amount":180,"discount":"di_0RMgr9WciwNzvqwFm8KS7UvC"}
  ],
  "discountable": true,
  "discounts": [],
  "invoice": "in_0RMgr9WciwNzvqwFuYT4m0hM",
  "livemode": false,
  "metadata": {},
  "parent": {"invoice_item_details":null,"subscription_item_details":{"invoice_item":null,"proration":false,"proratio
#

And here is taxes for completeness

[#<Stripe::StripeObject:0x15e3e0> JSON: {
  "amount": 58,
  "tax_behavior": "exclusive",
  "tax_rate_details": {"tax_rate":"txr_0QUEVyWciwNzvqwFECcWgNkB"},
  "taxability_reason": "standard_rated",
  "taxable_amount": 720,
  "type": "tax_rate_details"
}]
blazing crow
#

I see. I may overlooked the meaning of amount_excluding_tax. Let me take a closer look on these Ids

unreal acorn
#

Thank you

#

To reiterate. I think amount and amount_excluding_tax were equivalent based on some spot testing I've done in sandbox. But I am not confident it is given they both existed, which makes me think there is some other consideration taken with amount. But if they are equivalent and just for some reason duplicate properties then I am just looking for confirmation on this. With amount_excluding_tax it was very clear what it is. Just looking at whats available in the line item object I can't see anything obvious that could be used to derive amount_excluding_tax other than perhaps it is equal to amount.

blazing crow
#

By definition, amount_excluding_tax is amount - (all inclusive tax)

#

So if you have inclusive tax of , let's say 20 cents, amount = 900 and amount_excluding_tax = 880

unreal acorn
#

I see. That makes sense.

We don't deal with tax inclusion (yet) so this never was highlighted. Thanks for the clarification.

So this opens up another question I have then. We have been using Credit Notes to refund line items. The Credit Note object takes in an amount which needs to exclude taxes (some magic happens in the Stripe background where it takes care of the discount and exclusive tax considerations). How would that work with tax inclusion? Would we just feed it with an amount inclusive of tax?

#

Sorry just trying to wrap my head around this. For the US cases purchases are tax exclusive, so for credit notes we can feed the invoice line item amount (or amount_excluding_tax) to the credit note amount directly.

But for an EU purchase which has tax inclusion, based on how I understood you, we would need to feed in what is equivalent to amount_excluding_tax?

So it seems like we would need to take amount and then subtract it with the sum of taxes where the behavior is inclusive to get the amount needed for the Credit Note.

#

I think I rubber ducked this ๐Ÿ˜…

blazing crow
#

You would want to replace the (amount_excluding_tax) with (amount - (looping through taxes and filter out all inclusive one, sum them all))

#

Yes. But please test it thoroughly in Sandbox

unreal acorn
#

Gotcha. Will do. Thank you for the help. I really appreciate it. I got what I needed to move on.

stoic yokeBOT