#santosh2585
1 messages · Page 1 of 1 (latest)
Is the discount applied on line items or invoice? Can you share an example invoice ID (in_xxx)?
The discount is applied on the products - coupans. I have created coupans and that coupans I am associating with the products while attaching products/line items to the invoice.
This is the invoice id (in_1NNDf0SF9C1b0htOGFmIzx99)
Hi, looking into this
Umm sorry the discount_amounts on Invoice line items only shows the calculated discounted amount https://stripe.com/docs/api/invoices/line_item#invoice_line_item_object-discount_amounts
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
If you looks at the Invoice Item inside the Invoice instead, and expand its discounts, what do you see?
https://stripe.com/docs/api/invoices/line_item#invoice_line_item_object-invoice_item then https://stripe.com/docs/api/invoiceitems/object#invoiceitem_object-discounts
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
The discount_amounts in the line item object I see two discount values as I have used two coupans but the thing is how to know which discount amount is for this line items ?
Here is the response I am getting from fetching invoice
Yes I know, but I mean inside Invoice Line Item there is also a field Invoice Item
invoice_item": "ii_1NNDfBSF9C1b0htOU1SF7cXK
Can you expand this?
How to expand; https://stripe.com/docs/api/expanding_objects
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Do I have to expand the associated invoice line items while fetching the invoice ?
Yes!
Is there a url to fetch invoice_item specifically where I can get the discount values of that item ?
When I fetch the invoice and got line item id, hence i fetched the invoice line item then also I am still not getting the discount value based on the line items?
Is it possible that a line item associated to invoice I can directly get the discount/coupan value ?
It could. Let's try to expand it first. Following the Doc above you can do something like expand: ['lines.data.invoice_item']
No by expanding the lines.data.invoice_item then also cannot get the discount value !!!
Here is the response I am getting by expanding
I can see only the discount_amounts value ???
Okie I see...
Sorry it looks like we don't have percentage information inside the Invoice
What I can think of is expanding the Discount object inside total_discount_amounts at https://stripe.com/docs/api/invoices/object#invoice_object-total_discount_amounts-discount
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Then expand the coupon inside it to find any percentage
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
When I expand the total_discount_amounts I can see the coupan ID, but the problem here is coupan is associated with the products and in invoice I am not getting the product id associated with the invoice rather then I am getting the invoice line item id, So how will I can know this coupan is associated with which line items ??