#simeng
1 messages · Page 1 of 1 (latest)
Hi there, how can I help?
Hey.
So I am trying to imelement a subscription based product billing model
And I would like to apply some coupon discount manually through API to each invoice
Instead of attact a discount directly to the whole subscription, is there a way I could manually apply that discount to a invoice in a specific billing cycle?
The flow would be like, I have a coupon predefined. e.g. 10% discount on productA. This coupon should be a forever valid coupon.
However, instead of directly apply this coupon to a Customer's subsciption, I would like to manually apply it to his invoice during each billing cycle, based on his product data performance.
got it, you can listen to invoice.created event, and apply the coupon discount through https://stripe.com/docs/api/invoices/update#update_invoice-discounts-coupon
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
There isn't any post discount api available right? Looks like the only way to create a disscount instance is through the subscription methods.
What do you mean by post discount?
https://stripe.com/docs/api/coupons/create#create_coupon this is the API to create a coupon
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
There's no POST API to create a discount object
Yes, so what I'm try to figure out is I can't directly apply a coupon to a invoice object right? A discount object must be created?
I need to insert the discount id to the invoice object?
or simply discounts.coupon will do ?
You can apply a coupon to a invoice, please refer to the link that I shared earlier https://stripe.com/docs/api/invoices/update#update_invoice-discounts-coupon
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.