<units>
<unit name="pageviews"/>
</units>
<plan name="bronze-monthly">
<product>Bronze</product>
<finalPhase type="EVERGREEN">
<duration>
<unit>UNLIMITED</unit>
</duration>
<recurring>
<billingPeriod>MONTHLY</billingPeriod>
<recurringPrice>
<price>
<currency>USD</currency>
<value>100</value>
</price>
</recurringPrice>
</recurring>
<usages>
<usage name="bronze-monthly-pageviews" billingMode="IN_ADVANCE" usageType="CONSUMABLE">
<billingPeriod>NO_BILLING_PERIOD</billingPeriod>
<blocks>
<block>
<unit>pageviews</unit>
<size>1000</size>
<prices>
<price>
<currency>USD</currency>
<value>5</value>
</price>
</prices>
</block>
</blocks>
</usage>
</usages>
</finalPhase>
</plan>
<plan name="golden-monthly">
<product>Gloden</product>
<finalPhase type="EVERGREEN">
<duration>
<unit>UNLIMITED</unit>
</duration>
<recurring>
<billingPeriod>MONTHLY</billingPeriod>
<recurringPrice>
<price>
<currency>USD</currency>
<value>200</value>
</price>
</recurringPrice>
</recurring>
<usages>
<usage name="golden-monthly-pageviews" billingMode="IN_ADVANCE" usageType="CONSUMABLE">
<billingPeriod>NO_BILLING_PERIOD</billingPeriod>
<blocks>
<block>
<unit>pageviews</unit>
<size>1000</size>
<prices>
<price>
<currency>USD</currency>
<value>7</value>
</price>
</prices>
</block>
</blocks>
</usage>
</usages>
</finalPhase>
</plan>
--
You received this message because you are subscribed to the Google Groups "Kill Bill users mailing-list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to killbilling-us...@googlegroups.com.
To post to this group, send email to killbill...@googlegroups.com.
Visit this group at http://groups.google.com/group/killbilling-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/killbilling-users/CAME56TYUTU5P3D0z%3D0np8r%3DWc8C8-ERuWBSCn6hmEp_9D4HbMw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
I am not seeing any limits defined in your catalog, so i am not sure how that would work. Have you looked at one of our usage catalog example? Some other good resources are the usage tutorial and the usage integration tests which demo the api your are asking about.
--
You received this message because you are subscribed to the Google Groups "Kill Bill users mailing-list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to killbilling-us...@googlegroups.com.
To post to this group, send email to killbill...@googlegroups.com.
Visit this group at http://groups.google.com/group/killbilling-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/killbilling-users/909b4cbd-af5f-4b55-b16c-379e07784bbc%40googlegroups.com.
<plans>
<plan name="bronze-monthly">
<product>Bronze</product>
<finalPhase type="EVERGREEN">
<duration>
<unit>UNLIMITED</unit>
</duration>
<recurring>
<billingPeriod>MONTHLY</billingPeriod>
<recurringPrice>
<price>
<currency>USD</currency>
<value>100</value>
</price>
</recurringPrice>
</recurring>
<usages>
<usage name="bronze-monthly-pageviews" billingMode="IN_ARREAR" usageType="CONSUMABLE">
<billingPeriod>MONTHLY</billingPeriod>
<tiers>
<tier>
<blocks>
<tieredBlock>
<unit>pageviews</unit>
<size>10000</size> <------ pageviews that included in plan
<prices>
<price>
<currency>USD</currency>
<value>0</value> <------- 0 because the plan already included 10000 pageviews
</price>
</prices>
<max>10000</max> <--- if user exceeds this limit, he has to charge for 5$ (as shown in next tier)
</tieredBlock>
</blocks>
</tier>
<tier>
<blocks>
<tieredBlock>
<unit>pageviews</unit>
<size>1000</size> <------ number of pageviews that taken once charged for 5$
<prices>
<price>
<currency>USD</currency>
<value>5</value> <------ the cost for 1000 pageviews
</price>
</prices>
<max>11000</max> <--- new pageviews limit upon user charged for 5$
</tieredBlock>
</blocks>
</tier>
</tiers>
</usage>
</usages>
</finalPhase>
</plan>
<plan name="golden-monthly">
<product>Gloden</product>
<finalPhase type="EVERGREEN">
<duration>
<unit>UNLIMITED</unit>
</duration>
<recurring>
<billingPeriod>MONTHLY</billingPeriod>
<recurringPrice>
<price>
<currency>USD</currency>
<value>200</value>
</price>
</recurringPrice>
</recurring>
<usages>
<usage name="golden-monthly-pageviews" billingMode="IN_ARREAR" usageType="CONSUMABLE">
<billingPeriod>NO_BILLING_PERIOD</billingPeriod>
<tiers>
<tier>
<blocks>
<tieredBlock>
<unit>pageviews</unit>
<size>10000</size>
<prices>
<price>
<currency>USD</currency>
<value>0</value>
</price>
</prices>
<max>10000</max>
</tieredBlock>
</blocks>
</tier>
<tier>
<blocks>
<tieredBlock>
<unit>pageviews</unit>
<size>1000</size>
<prices>
<price>
<currency>USD</currency>
<value>7</value>
</price>
</prices>
<max>11000</max>
</tieredBlock>
</blocks>
</tier>
</tiers>
</usage>
</usages>
</finalPhase>
</plan>
</plans>
2- If the user exceeds the plan limit, what's the endpoint that i have to call it to charge cost for 1K pageviews?
2- If the user exceeds the plan limit, what's the endpoint that i have to call it to charge cost for 1K pageviews?That is not how it works. Again i spent a great deal of time writing a tutorial which explains all that (including the endpoint you are asking about), so let me repeat what it says:"Kill Bill’s usage module provides an API that can be used to record the per customer’s usage. For instance, in order to record 1 unit of chocolate-videos, one would use the API POST /1.0/kb/usages with the following json body:---{"subscriptionId":"365987b2-5443-47e4-a467-c8962fc6995c","unitUsageRecords":[{"unitType": "chocolate-videos","usageRecords": [{"recordDate": "2014-03-14T04:32:25+00:00","amount": 1}]}]}---=> This is the API you are looking for...The calls to record usage are made per subscription, but they can include multiple unitTypes (if the catalog had defined them), and for each unit they can specify as many records as desired; the records themselves specify a date of when those units were consumed.In our example, the online store could directly make the call to Kill Bill using that API to record each video as they are consumed.Note that in scenarios where the consumption is much higher (for e.g in the case of a telecom company offering cell-phone minutes), one would need to use a metering system that would first aggregate the units on a daily granularity before making the call to Kill Bill. You can check the initial implementation of our metering module that provides that aggregation functionality."So to put it differently, you will have to call that api to record the usage, and when it is time to generate an invoice, the system will compute the usage items based on usage that was recorded and your usage definition (tiers).Is that clearer?
So to put it differently, you will have to call that api to record the usage, and when it is time to generate an invoice, the system will compute the usage items based on usage that was recorded and your usage definition (tiers).Is that clearer?Yeah, its clear, thanks for this explanation;So the record has been saved in db "rolled_up_usage" when i used this endpoint POST /1.0/kb/usages -with correct payload- BUT the system didn't create any new invoice when the pageviews exceeds the limit!! - i am using KB version: 0.13.5 - and i share my catalog please find the attachment - so am i doing a mistake? what do you think?
Yea; it makes sense; and its working now; great thanks!
But i just wondered; when IN_ADVANCE billing mode will be implemented
The metering module seems to no longer be on maven. Is there anywhere else I can just grab a jar?
--
You received this message because you are subscribed to the Google Groups "Kill Bill users mailing-list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to killbilling-us...@googlegroups.com.
To post to this group, send email to killbill...@googlegroups.com.
Visit this group at http://groups.google.com/group/killbilling-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/killbilling-users/10aed94a-3fc2-4c2d-97f9-0c5b9b36b44f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.