Usage Based Billing Queries

219 views
Skip to first unread message

Shishira Shetty

unread,
Oct 20, 2023, 3:52:51 AM10/20/23
to Kill Bill users mailing-list
Hi Team,
I have gone through the documentation for Killbill and have a couple of queries on how to implement some of the usecases which we have:
1. IN_ADVANCE billing with usage based model: We have a use case where we would like to bill customer in advance and charge later based on their usage. I had read in the documentation that IN_ADVANCE is not supported with usage. Please suggest on whether this can be implemented? Also, if this is not supported, will it be ideal to use CREDIT as an in advance payment by customer? Will there be any challenges?
2. Catalog Plugin for custom Catalog Implementation: On reading the documentation, I understood that only the catalog xml can be dynamically fed to killbill system using Catalog Plugin and we cannot implement a custom logic on the pricing calculation. Is my understanding right? We have requirement as mentioned in Point 3. Would like to understand if this can be achieved using catalog plugin by having custom logic for calculation?
3. CAPACITY based pricing with per unit calculation: We have a requirement where we would like to charge based on number of machines used per month. And pricing would be per machine basis.
For ex:
If customer utilized 10 machines in the month, we would like to charge 10*50(per unit). I chose this as CAPACITY based as we would be posting usages on a daily basis.
So if 5 machines were created and used on 1st, I will post usage of 5 on 1st and if additional 5 machines were created on 2nd, the total machines now is 10. I will post usage of 10 on 2nd and since there are no machines created further, I would be posting a usage of 10 everday. At the end of the month, with CAPACITY based billing, the number of machines used by customer would 10 as we take MAX of usage in CAPACITY based billing. But we would like to charge 10*50/per unit at the end of the month. This I was not able to configure. Could you please suggest if this can be done?

Request your inputs on the above 3 queries. Thank you :)

karan bansal

unread,
Oct 20, 2023, 2:30:50 PM10/20/23
to Kill Bill users mailing-list
Hi Shishira,

IN_ADVANCE billing with usage based model
You can go the credit route, it will not create any problem. Any time the invoice is generated, the system will first use the available credits as adjustment. 

Catalog Plugin for custom Catalog Implementation
The catalog plugin basically allows to interact with your catalog service existing outside of Kill Bill. In case you are looking to achieve something like a price override, then you can look into achieving this though an entitlement plugin: https://docs.killbill.io/latest/entitlement_plugin

CAPACITY based pricing with per unit calculation
You can actually look into achieving this by setting the machine usage as Consumable, this will allow you to define the unit price as well. Example catalog : https://github.com/killbill/killbill-docs/blob/5d5d7a2219752da8a0d9456cc5a975161388088c/catalogs/consumable-billing-all-tiers.xml

Regards
Karan

Shishira Shetty

unread,
Oct 23, 2023, 12:09:45 AM10/23/23
to Kill Bill users mailing-list
Hi Karan,

Thank you for your quick response. I will go through the links shared.

Thank & Regards,
Shishira

Shishira Shetty

unread,
Oct 23, 2023, 8:54:57 AM10/23/23
to Kill Bill users mailing-list
hi Karan,

Do we have option to specify credit expiry? I tried specifying endDate in the payload for /credits API but it seems to ignore the same.

karan bansal

unread,
Oct 23, 2023, 2:15:23 PM10/23/23
to Kill Bill users mailing-list
Hi Shishira,

You are right, it seems that the end date is not taken into account. Are you looking to give credit for a particular time period? 

I would also like to add something about your question about advance billing for Usage based system.  Starting with 0.24 release, Kill Bill now supports adding quantity at the time of creating the subscription. So lets assume that you are expecting a usage of minimum 500 units on monthly basis, then you can include that much in your subscription for in_advance recurring billing and any usage above that can be billed in_arrear. 

No change is required for this in your catalog. Instead you can pass the quantity while creating the subscription. Here is an example, I have a defined a plan in my catalog where each unit costs USD 100 and I am expecting 5 units to be consumed. So while creating the subscription, I have passed quantity 5 and the resulting invoice ( all subsequent ones ) is USD 500.

Regards
Karan

karan bansal

unread,
Oct 24, 2023, 12:55:14 PM10/24/23
to Kill Bill users mailing-list
Hi Shishira,

I checked further within the team and they confirmed that it is not possible to expire the credit OR provide it only for a specified period.

Regards
Karan

Shishira Shetty

unread,
Oct 25, 2023, 12:52:06 AM10/25/23
to Kill Bill users mailing-list
Hi Karan,

Thanks a lot for your clarification on Credit and IN ADVANCE billing. I will check if we can utilize this new feature of defining minimum usage as IN ADVANCE.

Shishira Shetty

unread,
Oct 25, 2023, 1:02:20 AM10/25/23
to Kill Bill users mailing-list
hi Karan,

I have one more query with the entitlement plugin which you had suggested. With entitlement plugin, I guess we can override only the properties which are present in the usage (like unit, price, etc) but we cant change the calculation logic. Is my understanding correct?

karan bansal

unread,
Oct 26, 2023, 11:42:33 AM10/26/23
to Kill Bill users mailing-list
Hi Shishira,

Could you please provide more details about what calculation logic are you referring to? In the meantime, here is a demo plugin https://github.com/killbill/killbill-coupon-plugin-demo/tree/master that has some basic functionality about price override. 

Regards
Karan 

Message has been deleted

Shishira Shetty

unread,
Oct 27, 2023, 2:28:08 AM10/27/23
to Kill Bill users mailing-list
hi Karan,

Thank you for response. 

I have gone through the sample entitlement plugin. In the sample plugin, I could see that the fields like "price, unit etc" can be overridden. I would like to change logic in the pricing calculation like for instances:
1. I would like to enable per unit usage-based calculation for CAPACITY based pricing. As I had mentioned for number of machines example where I would be posting usage on a daily basis, but MAX of usage has to be taken like done in CAPACITY usage type, but calculation should be per unit of the usage (this is not achievable with CONSUMABLE, as with CONSUMABLE we always do SUM on the statistics received. I would need a MAX). 
2. As a second scenario, I would like to implement a custom IN_ADVANCE usage-based calculation. Can we in some way code a plugin to implement such scenarios where I would like to override the invoice calculation logic altogether?

I have another query regarding DISCOUNT pricing. I was also going through DISCOUNT catalog example and I could see that a fixed amount can be specified as a discount. But can we somehow configure percentage based discount? 

Thank you :)

karan bansal

unread,
Oct 27, 2023, 2:05:53 PM10/27/23
to Kill Bill users mailing-list
Hi Shishira,

You can look into using the Invoice plugin https://docs.killbill.io/latest/invoice_plugin which intercepts the new invoice generation. You can possibly add your calculation logic/discount logic. This demo plugin shows some examples. 

Regards
Karan

Shishira Shetty

unread,
Oct 29, 2023, 8:11:40 AM10/29/23
to Kill Bill users mailing-list
hi Karan,

Thank you. I will go through the documentation and the example.

Reply all
Reply to author
Forward
0 new messages