#kennyjack_api
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/1422878578189664266
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
sorry, there are some mistake in my question
For upcoming invoice API, is discount code allow to applied on all items WITHOUT define in each item?
hi! yes, there's a top-level discounts field for the invoice overall, and then there are also lower-level fields to control this on a per-line item level
https://docs.stripe.com/api/invoices/object#invoice_object-discounts
https://docs.stripe.com/api/invoices/object#invoice_object-lines-data-discounts
your request passed the item-level discounts field
https://docs.stripe.com/api/invoices/create_preview#create_create_preview-subscription_details-items-discounts
you should modify your request to use the invoice-level field instead
https://docs.stripe.com/api/invoices/create_preview#create_create_preview-discounts
does my request req_NYqaGGXwwqulpx the discount field is in invoice level?
yes, that request used the top-level discounts field
Thanks for comfirming. Please hold on awhile because I've question on the response return. I will attach the response here too ๐
sounds good! yes, thanks in advance for sharing the response
Thanks for waiting. Here the response
FYI, I have product price $1800 which is tax-inclusive. Then i applied the discount 50%. The tax rate is 9%
My question why the lines.data.0.amount_excluding_tax = 172569 & the lines.data.0.tax_amounts = 7431 and the taxable amount already factor in the discount.
My expected value of lines.data.0.amount_excluding_tax = 165138
Also FYI, this upcoming invoice response is without discount applied
the lines.data.0.amount_excluding_tax = 165138 & the lines.data.0.tax_amounts = 14862
the tax behavior (inclusive/exclusive) of the tax rate is relevant here:
When tax rates are inclusive, Stripe Tax applies discounts to the original amount first. Then, we recalculate taxes based on the remaining amount. This reduction has the side effect of reducing the tax amount due.
https://docs.stripe.com/billing/taxes/tax-rates#inclusive-tax-discount-example
the tax rate used here is inclusive (txr_1S7WA3ArTeYcLw6yE0LNtQ7G)
I see, i didn't noticed that. Thanks for the info
That greatly help and clear my doubt
no problem of course, happy to help!
๐ taking over for my colleague. Let me know if there's any follow-up Qs I can answer!
Hi, I have follow up question
sure...
Based on this thread where the upcoming invoice applied a 50% discount.
And I know that the lines.data.0.amount_excluding_tax amount was get is based on lines.data.0.amount - lines.data.0.tax_amounts. Because it subtract the lines.data.0.tax_amounts which already included the discount.
Therefore amount_excluding_tax has factor in the discount from the tax
Is that possible that the amount_excluding_tax always show the amount as tax-exclusive without factor in the discount?
Let me rephrase and slowly go through
Can you check this thread where I retrieve upcoming invoice without any discount
the lines.data.0.amount_excluding_tax = 165138
So on this thread after appliying discount on the upcoming invoice, is there a way for me to retrieve the amount excluding tax and tax amount with factor in discount?
Where i able to get 165138 (amount excluding tax) & 14862 tax amount (Without the discount factor in)
Hi there. I'll take a look
Thanks
To clarify: on an invoice with a discount, you want to be able to retrieve the non-discounted amount?
So the amount_excluding_tax in this case is the original amount for the line item, minus the tax after discounts. That's just how line items work here.
If you need the amount excluding tax, that doesn't take the actual tax amount to be paid into account, you would have to calculate this yourself.
I would also note that the GET /v1/invoices/upcoming endpoint was deprecated earlier this year, and we would recommend using the POST /v1/invoices/create_preview endpoint (API docs) which may have some additional fields
Let me spend some times to try it out
Can i know when will this endpoint be removing?
I would also note that the GET /v1/invoices/upcoming endpoint was deprecated earlier this year,
There are currently no plans to remove it, but it won't be available when using newer Stripe API versions
I see thanks. I will take not on this
When you mention have to calculate myself, is that possible to based on the stripe response return to calculate?
If yes can let me know how?
Taking a step back, can you share what you're looking to do with that amount_excluding_tax value?