Note: You are viewing an old version of this page. View the current version.

Differences between version 4 and previous revision of Billing.

Other diffs: Previous Major Revision, Previous Author

Newer page: version 4 Last edited on Saturday, 23 July 2011 20:12:39 by CyberLeo Revert
Older page: version 3 Last edited on Saturday, 23 July 2011 19:47:57 by CyberLeo Revert
@@ -57,29 +57,75 @@
 !! Example flows 
 * 20-Dec: January period starts December 20th 
 * 29-Dec: New customer provisioned for $10.00 VHOST MED service 
 * 29-Dec: Bucket balances: C:0 S:0 B:0 I:0 
-* 01-Jan: Service tick: $10.00 VHOST MED - S->C - C:10 S:-10 B:0 I:0 
+* 01-Jan: Service tick: $10 VHOST MED - S->C - C:10 S:-10 B:0 I:0 
 * 20-Jan: February billing period starts 
 * 20-Jan: Refund tick (none necessary, since service was consumed) 
-* 20-Jan: Billing tick - B->S - C:10 S:10 B:-20 I:0  
-* 20-Jan: Invoice tick - I->B - C:10 S:10 B:0 I:-20 
+* 20-Jan: Billing tick: B->S - C:10 S:10 B:-20 I:0  
+* 20-Jan: Invoice tick: I->B - C:10 S:10 B:0 I:-20 
 Sample invoice: 
 <pre> 
  $10.00 - VHOST MED: example.com 2011-Jan 
  $10.00 - VHOST MED: example.com 2011-Feb 
 ---- 
  $20.00 - Amount due 
 </pre> 
  
-* 30-Jan: Payment tick: $20.00  
-* 01-Feb: Service tick: $10.00 VHOST MED - S->C - C:20 S:0 B:0 I:10  
+* 30-Jan: Payment tick: $20 - ?->I - C:20 S:0 B:0 I:0  
+* 01-Feb: Service tick: $10 VHOST MED - S->C - C:20 S:0 B:0 I:0  
 * 20-Feb: March billing period starts 
 * 20-Feb: Refund tick (none necessary) 
-* 20-Feb: Billing tick - B->S - C:20 S:10 B:-10 I:10  
-* 20-Feb: Invoice tick - I->B - C:20 S:10 B:0 I:0  
+* 20-Feb: Billing tick: B->S - C:20 S:10 B:-10 I:0  
+* 20-Feb: Invoice tick: I->B - C:20 S:10 B:0 I:-10  
 <pre> 
  $20.00CR - Payment received 2011-01-30, Thank you! 
  $10.00 - VHOST MED: example.com 2011-Mar 
 ---- 
  $10.00 - Amount due 
+</pre>  
+  
+* Customer goes delinquent!  
+* 01-Mar: Service tick: $10 VHOST MED - S->C - C:30 S:0 B:0 I:-10  
+* 20-Mar: April billing period starts  
+* 20-Mar: Refund tick (none necessary)  
+* 20-Mar: Billing tick: B->S - C:30 S:10 B:-10 I:-10  
+* 20-Mar: Invoice tick: I->B - C:30 S:10 B:0 I:-20  
+<pre>  
+ $10.00 - VHOST MED: example.com 2011-Mar  
+ $10.00 - VHOST MED: example.com 2011-Apr  
+----  
+ $20.00 - Amount due  
+</pre>  
+  
+* Customer requests prepay so they don't go delinquent again; next invoice should be $50  
+* 21-Mar: Payment tick: $20 - ?->I - C:30 S:10 B:0 I:0  
+* 21-Mar: Prepay tick: $40 - I->B - C:30 S:10 B:40 I:-40  
+* 01-Apr: Service tick: $10 VHOST MED - S->C - C:40 S:0 B:40 I:-40  
+* 20-Apr: May billing period starts  
+* 20-Apr: Refund tick (none necessary)  
+* 20-Apr: Billing tick: B->S - C:40 S:10 B:30 I:-40  
+* 20-Apr: Invoice tick: I->B - C:40 S:10 B:40 I:-50  
+<pre>  
+ $10.00 - VHOST MED: example.com 2011-Mar  
+ $10.00 - VHOST MED: example.com 2011-Apr  
+ $20.00CR - Payment received 2011-03-21, Thank you!  
+ $40.00 - Prepay request  
+ $10.00 - VHOST MED: example.com 2011-May  
+----  
+ $50.00 - Amount due  
+</pre>  
+  
+* 25-Apr: Payment tick: $50 - ?->I - C:40 S:10 B:40 I:0  
+* 01-May: Service tick: $10 VHOST MED - S->C - C:50 S:0 B:40 I:0  
+* 20-May: June billing period starts  
+* 20-May: Refund tick (none necessary)  
+* 20-May: Billing tick: B->S - C:50 S:10 B:30 I:0  
+* 20-May: Invoice tick (none necessary)  
+<pre>  
+ $40.00 - Prepay request  
+ $10.00 - VHOST MED: example.com 2011-May  
+ $50.00CR - Payment received 2011-04-25, Thank you!  
+ $10.00 - VHOST MED: example.com 2011-Jun  
+----  
+ $30.00CR - Current balance  
 </pre> 

version 4

Prototype

Buckets

Consume
Sink for consumed service; source for refunds
Service
Current allocation for service (can go negative if customer desires, or act as access cutoff)
Balance
Current customer balance not allocated for service (can go negative as consumed, or positive if prepaid)
Invoice
Amount owed on current invoice

Ticks

Automatic Ticks

  • Service tick

    • Service -> Consume

      • Consumes a bit of service

        • once a day for daily consumption (disk, etc)
        • once a month for granular service (hosting)
        • once a year for registration (domain)
  • Refund tick

    • Service -> Balance

      • Refund for unused service, in case of overprovisioning or unconfigured service
  • Billing tick

    • Balance -> Service

      • Replenishes Service with enough to cover the next billing period
  • Invoice tick

    • Invoice -> Balance

      • Bring Balance from negative to zero to account for currently owed outstanding
      • Bring Invoice from positive to zero to account for overpayment
  • Payment tick

    • Outside -> Invoice

      • Incoming payments are placed here until they're accounted for by an invoice run

Manual Ticks

  • Prepay tick

    • Invoice -> Balance

      • Preemptively move money to indicate a customer's desire to prepay by owing more on next invoice than is actually outstanding
  • Service Refund tick

    • Consume -> Service

      • Refund for consumed but unprovided service (outage, etc)

Invoice Generation

  1. Generate Refund tick to refund unused service
  2. Generate Billing tick to fund next billing period
  3. Generate Invoice tick to account for payments and refunds
  4. Compute invoice values and lines from all ticks between current and previous Invoice tick

Example flows

  • 20-Dec: January period starts December 20th
  • 29-Dec: New customer provisioned for $10.00 VHOST MED service
  • 29-Dec: Bucket balances: C:0 S:0 B:0 I:0
  • 01-Jan: Service tick: $10 VHOST MED - S->C - C:10 S:-10 B:0 I:0
  • 20-Jan: February billing period starts
  • 20-Jan: Refund tick (none necessary, since service was consumed)
  • 20-Jan: Billing tick: B->S - C:10 S:10 B:-20 I:0
  • 20-Jan: Invoice tick: I->B - C:10 S:10 B:0 I:-20

Sample invoice:

 $10.00   - VHOST MED: example.com 2011-Jan
 $10.00   - VHOST MED: example.com 2011-Feb
----
 $20.00   - Amount due
  • 30-Jan: Payment tick: $20 - ?->I - C:20 S:0 B:0 I:0
  • 01-Feb: Service tick: $10 VHOST MED - S->C - C:20 S:0 B:0 I:0
  • 20-Feb: March billing period starts
  • 20-Feb: Refund tick (none necessary)
  • 20-Feb: Billing tick: B->S - C:20 S:10 B:-10 I:0
  • 20-Feb: Invoice tick: I->B - C:20 S:10 B:0 I:-10
 $20.00CR - Payment received 2011-01-30, Thank you!
 $10.00   - VHOST MED: example.com 2011-Mar
----
 $10.00   - Amount due
  • Customer goes delinquent!
  • 01-Mar: Service tick: $10 VHOST MED - S->C - C:30 S:0 B:0 I:-10
  • 20-Mar: April billing period starts
  • 20-Mar: Refund tick (none necessary)
  • 20-Mar: Billing tick: B->S - C:30 S:10 B:-10 I:-10
  • 20-Mar: Invoice tick: I->B - C:30 S:10 B:0 I:-20
 $10.00   - VHOST MED: example.com 2011-Mar
 $10.00   - VHOST MED: example.com 2011-Apr
----
 $20.00   - Amount due
  • Customer requests prepay so they don't go delinquent again; next invoice should be $50
  • 21-Mar: Payment tick: $20 - ?->I - C:30 S:10 B:0 I:0
  • 21-Mar: Prepay tick: $40 - I->B - C:30 S:10 B:40 I:-40
  • 01-Apr: Service tick: $10 VHOST MED - S->C - C:40 S:0 B:40 I:-40
  • 20-Apr: May billing period starts
  • 20-Apr: Refund tick (none necessary)
  • 20-Apr: Billing tick: B->S - C:40 S:10 B:30 I:-40
  • 20-Apr: Invoice tick: I->B - C:40 S:10 B:40 I:-50
 $10.00   - VHOST MED: example.com 2011-Mar
 $10.00   - VHOST MED: example.com 2011-Apr
 $20.00CR - Payment received 2011-03-21, Thank you!
 $40.00   - Prepay request
 $10.00   - VHOST MED: example.com 2011-May
----
 $50.00   - Amount due
  • 25-Apr: Payment tick: $50 - ?->I - C:40 S:10 B:40 I:0
  • 01-May: Service tick: $10 VHOST MED - S->C - C:50 S:0 B:40 I:0
  • 20-May: June billing period starts
  • 20-May: Refund tick (none necessary)
  • 20-May: Billing tick: B->S - C:50 S:10 B:30 I:0
  • 20-May: Invoice tick (none necessary)
 $40.00   - Prepay request
 $10.00   - VHOST MED: example.com 2011-May
 $50.00CR - Payment received 2011-04-25, Thank you!
 $10.00   - VHOST MED: example.com 2011-Jun
----
 $30.00CR - Current balance