Hello David,
We have some queries to understand your use case better so that we can suggest you the best solution. We currently do not have option to create coupon on the fly using API. We have thought about some ideas to implement this feature.
- Does the discount change for every user on monthly basis?
- Does discount type (i.e. 10% or $3) fall in certain set of values or it changes on every renewal? Like, First month 10%, Second month 20%, then 25% and so on.
- Can you give an example of the criteria based on which discount changes over the month?
Sorry for my english.
The discounts changes over the month. Suposse a client that has a susbscription of 60€.
He "gains" in the aplication a discount of 10€ while another cliente gains a discount of 15 €.
The discount is calculated in the application by a complex algorithm.
When the month ends chargebee must charge 60-10=50 € to first client and 60-15=45€ to second client.
The easiest solution for me will be create a coupon of 10€ for first client and a 15€ coupon for second. But this is not possible.
How can i achieve this?
Hello David,
Right now, there is no way to achieve this through our API other than resorting to the coupons created in the admin console.
However we have in our priority to support for an API which will let you add a discount line item at the time of invoice creation.
The way it will work is:
You can read more about adding lines items in pending invoices at the link given below. This is more like adding charges for metered billing. In your use case, this will become adding discounts on each renewal.
http://www.chargebee.com/docs/metered_billing.html
Please let us know if this will work for you? What is the timeline you are looking to go live? It will help us to prioritize this.
This will work.
Now this method only works with charges, not discounts?
My app will be in live about 9 of August of this year.
Thanks.
Hello David,
Yes, this method only works with charges right now, not discounts.
On further thinking I feel 'credits' can be used to handle your requirement. The ability to add credits(to customer) is possible only via UI now. If this approach works out we will prioritize taking up the API support for this.
Once your invoice gets created ('pending' state), calculate the discount to be given and add that to customer (using the proposed API). Now, on closing the invoice the 'credit adjustment' line item will get added to that invoice.
There will be some limitations of using it :
Please let me know if this will work for you.
This solution of credits will work, but i need the API to make the credit on the fly via API using JAVA.
I will create a credit with the exact amount so that amount never be greater that invoice amount.
No problems with proration.
I think that coupons like discounts is more "beautiful", but what you prefer
Thanks.
@David, we will be releasing API support for creating credits for customers by the second week of August. We will send you the specifications of the proposed API by mid next week so that you can continue your development based on that.
Hope this time frame works for you.
HI.
Any news about that?
Thx
Hi David,
Sorry for this delay. We are in the final stages of testing. Expecting to release this by tomorrow. Will update you once that is done.
This API will not be open to all. We need to enable this for your site. Can you mail your ChargeBee site details to support[at]chargebee.com ?
Hello David,
We had released the support for 'Add Credit' API. This is not publicly available now. Kindly mail us your ChargeBee site details and we will enable it for you.
Let us know if you have any further questions.
Thanks.
David Rodríguez Romo
Can i create a coupon on the fly with the API?
My problem is i have several user subscriptions and they have discounts based on different criterias that changes over the month. So, when the system charges the users, every user have a different discount. How can i manage this ?
Thanks.