#KRS
1 messages · Page 1 of 1 (latest)
Thanks.
How did you create the invoice and the line items?
line items are created by associating it with the customer and then invoice is created using stripe.Invoice.create(customer=customer, metadata=metadata, discounts=discounts)
There's no way to directly exclude an invoice item from a coupon. But there are a few workarounds:
- When you create the coupon, you can set specific product ID that it should apply to: https://stripe.com/docs/api/coupons/create#create_coupon-applies_to
- Or when you add the line items to the customer, for each line item you can set a coupon: https://stripe.com/docs/api/invoiceitems/create#create_invoiceitem-discounts
I dont think I can do the first approach, but 2nd approach is doable, i could try that. Thanks.
only catch is if it is percent coupon, then it needs to be applied to each line item, where as if this cash coupon, then it can be applied at the invoice level. I think it should work, will give a try.