Product Documentation

# Billing for Discrete Products

Dec 22, 2015
Every usage consumed of discrete products is billed for the whole billing period even if it is used partially. This is a crucial difference between metered and discrete usage type. The mailbox is an example of a discrete product. One day usage for a mailbox will be charged for the whole month in which it was created.
Note: If the mailbox is destroyed, it will be charged only for the billing period in which it existed and will not be charged from the subsequent billing period.

## Usage pattern for discrete products

Example 1: Consider a three day billing period for the mailbox usage as an example. Assuming that the usage of maiboxes, m0, m1,.....,m7 are follows:
• Day 1: m0 is carried forward from the previous billing period; m1, m2, m3 created; m0 destroyed.

Day 1 is the start of a new billing cycle. Mailboxes m1, m2, and m3 are created in this billing period and hence will be charged for the entire billing period. Though the mailbox, m0, which was carried from the previous billing period is destroyed it will be charged because it was active at the begining of Day 1. The usage will be four because four mailboxes were active during the day.

• Day 2: m4 created; m1 destroyed.

The usage will be one because the new mailbox, m4 is created. The usage of the mailbox, m1 is already considered in Day1 and hence is not taken into account

• Day 3: m2, m3 destroyed.

The usage will be zero because no new mailbox is created. This is the last day of the current billing period.

• Day 4: m5, m6, m7 created; m5 destroyed.

Day 4 is the beginning of a new billing period. The mailbox, m4 is carried over to this current new billing period and is therefore charged in this billing period too. Mailboxes m1, m2, and m3, were created and destroyed in the last billing period and will not be charged in this billing period. Mailboxes m5, m6, and m7 are newly created in this billing period and hence will be charged for the entire billing period. The usage for Day 4 will be four because four mailboxes were active during the day.

Example 2: Consider a billing period of 30 days for mailbox usage. Assuming that the usage of mailboxes, a,b,c,.....,j are specified in the following table.
Note: The alphabets are active mailboxes during day (one in square brackets are the mailboxes that got destroyed during the day)
Day 27 Day 28 Day 29 Day 30 Day 1 Day 2
a a a a a a
b b [b] e e e
c c [c] f f f
d [d] d g g g
e h h h
f i i
g j j
h
• Case 1:Suppose usage marker(u) is set to end of day (EOD) of Day 27. And for some reason collection is not able to run from Day 28 to Day 1, then on Day 2 inventory will be called with start_marker as 'u' and billingPeriodStartDate as EOD of Day 1. Expected result in this case will be as follows:
• Day 1: +7 (2 new mailboxes got created and 5 existing )

Hence on Day 2, inventory will return 7 and the usages for 28, 29, and 30 will be ignored.

• Case 2: Suppose usage marker(u) is set to EOD of Day 27. And for some reason collection is not able to run from Day 28 to Day 30, then on Day 1 collect will be called with start_marker as 'u' and end_date as EOD of Day 30. Expected result in case will be as follows:
• Day 28: 0 (Nothing new got created)
• Day 29: +4 (4 new mailboxes got created)
• Day 30: 0 (Nothing new got created)

Hence on Day 1, collect will return 4.