WeDid: Invoice Pro-rata Calculation

Challenges

In a subscription business model, its important that the monthly invoice/bill amount is presented correctly to their customer and the following scenarios are the common challenges in managing the monthly bill amount:

A simple full month scenario is as explained here. However, there may be situation where the subscription starts in the middle of the month, for example:
The Subscription for Product A for the customer has the following details:
Subscription Start Date: 10th Mar 2013
Subscription period: 6 months
Subscription End Date; 10th Sep 2013
Total Subscription Price: $6,000
 
In this case, the following billing items will automatically be created:
Billing #1 = Period: 10th Mar – 31st Mar 2013; Bill Date: 1st Apr 2013; Amount: $709.68
Billing #2 = Period: 1st Apr – 30th Apr 2013; Bill Date: 1st May 2013; Amount: $1,000
Billing #3 = Period: 1st May – 31st May 2013; Bill Date: 1st Jun 2013; Amount: $1,000
Billing #4 = Period: 1st Jun – 30th Jun 2013; Bill Date: 1st Jul 2013; Amount: $1,000
Billing #5 = Period: 1st Jul – 31st Jul 2013; Bill Date: 1st Aug 2013; Amount: $1,000
Billing #6 = Period: 1st Aug – 31st Aug 2013; Bill Date: 1st Sep 2013; Amount: $1,000
Billing #7 = Period: 1st Sep – 10th Sep 2013; Bill Date: 1st Oct 2013; Amount: $290.32
The customer is looking for a solution which includes the handling of the full subscription as well as the pro-rata subscription scenario.

Solution:

  • Automatically calculate, for example the bill amount of a subscription (i.e. a subscription deal)
  • Ensure that the bill amount is reflected correctly in the subscription (i.e. including a non-full month subscription which requires pro-rata calculation)

Related Objects Standard/Custom object
Components Apex Class & Apex Trigger
Complexity Complex