#jacobjensen
1 messages ยท Page 1 of 1 (latest)
๐ happy to help
awesome - let me send you a screenshot of the issue
would you mind sharing the invoice ID? in_xxx
in_1NNDfQE5RkzLDNUxUhKPofH1
so the coupon is only applicable to 1 of the 2 products, but the discount is displayed on every line, which is quite confusing
taking a look
the reason why the discount is shown on each invoice item, is because you're creating the invoice items one by one and passing the discount to each invoice item creation API
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Yup, but is it possible to create the invoice in any other way via the API?
yes
you can pass in the discount to the invoice
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 i apply the discount to the invoice, then the discount is only applied once
instead of passing it to each invoiceitem
correct
yeah, but we want to the discount to be applied to every instance of the relevant product. so if we have 5 of the products, we would like for every one of those products to have the discount applied
it will
1 minute
in_1NNDxpE5RkzLDNUxs3yiycDq
if you look at this invoice, you can see that it only applies the discount once.
why aren't you using quantities though?
because we were experiencing the same problem. That despite the fact that a product was listed with 5 in quanitity, the discount was only applied once.
'
This is working as expected from what I can tell. You've applied a fixed amount (โฌ400) at the invoice level. Therefore we reduce the invoice total by 400, not each line item. Can you help me understand what outcome you're expecting?
I was hoping to apply on a product level. So for the specific product I would like for the discount to be applied to every instance. So the above invoice should have -800 as the discount
I can succeed in doing this by applying the discount to the invoice item level, but then it adds the discount line to the irrelevant items, which makes it confusing
That's not currently possible. You apply the coupon/discount at the payment level (i.e. the invoice)
alright - thank you
You could try add multiple coupons at the root Invoice level: https://stripe.com/docs/api/invoices/create#create_invoice-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.
Not sure if/how that'll work
i.e. 1x per line item
I tried this, and it worked with regards to amount. But the problem is that it adds a discount line to every item on the invocie. So it just ends up looking very confusing, though the final amount is correct
Why not utilise quantities? That will concolidate the lines
well then the problem is that the discount is only applied once. But if the quantity is 7 for example, we would like the discount to be applied once for every instance of the product
so in this case, it should be 7*400 in terms of discount, and not just 7000
*700
Then you just add the coupon 7x times: https://stripe.com/docs/api/invoiceitems/create#create_invoiceitem-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.
How can I add the coupon multiple times via the api?
discounts accepts an array of objects, see above. As I said, I think this should work
Unfortunately, the same coupon cannot be applied multiple times