Proration is one of the important requirements for Subscription Billing, especially for SaaS businesses. We decided to rehaul the existing proration design to address shortcomings and to make it more of a no-brainer. After leveraging the new Credit Notes design and adding a dose of intelligence, we are delighted to present to you with the new proration model. Before reading further, we strongly recommend you to go through the Credit Note changes as we would be referring to them in this post. Proration - The calculation Proration can be logically split into two parts. One part is the calculation of credits for items unsubscribed from, for the unused time period of the current billing term. The other part is the calculation of charges for the newly subscribed items for the remaining portion of the current billing period. The erstwhile design The credits created for the unused period were previously represented using a simple running total called Prorated Credits,attached at the subscription level. The credits were automatically used against the invoice created for the prorated charges. If credits remained, then they were automatically used against the future invoices for that subscription. The major drawback with this design was that there was no differentiation between paid and unpaid invoices, as credits were created even for unpaid invoices. Other disadvantages of the \u201crunning total\u201d based prorated credits are \tThey cannot be refunded as cash to the customer. \tThey cannot be removed once applied to the invoice. \tTax liability was not reduced w.r.t to the original invoice. \tThey are handled like Promotional Credits (Account Credits) and hence applied before tax. \tThey cannot be applied against one-time invoices. \tThey are attached to the subscription and not the customer level, and hence could not be used when a customer cancels the existing subscription and later subscribes again. \tThey were not in the form of documents and hence could not be sent to customers or used while filing tax filing returns. The New Proration Logic The new proration logic leverages the Credit Notes design. If the invoice for the current term has been paid, then the credits are created as Refundable Credits. This allows you to use Credit Notes to refund the remaining credits available or even dissociate it from the prorated invoice and refund it completely. More interesting is the way unpaid invoices are now handled - instead of \u00a0creating Refundable Credits, we first create Adjustment Credits and reduce the unpaid amount of the invoice using them. In case, after the Adjustment Credits have been applied the unpaid amount becomes zero, the invoice is marked as \u2018Paid\u2019. Tying up loose ends Sometimes the invoice might have been partially paid. If the credits calculated for proration is greater than the unpaid amount, then in addition to marking the invoice as \u2018Paid\u2019 using Adjustment Credits, we also create Refundable Credits for the remaining, paid portion of the invoice. This credit is automatically applied to the prorated invoice. Note, a billing term might involve multiple invoices if a customer has subscribed to new items during the term. And some of the invoices could have been paid, some unpaid, and some even partially paid. The new proration logic takes care of all these cases to ensure hassle-free billing. Elegant handling of quantity changes Another major change is the simplification of how proration works when quantity changes are made to recurring items (plans\/addons). Previously, when quantity was changed for an already subscribed item, we calculated credits for the entire old quantity for the unused period, and then prorated charges for the updated quantity (new + existing) for the remaining billing period. This was the behaviour irrespective of whether or not the quantity was increased. Now, in case there is only an increase in the quantity, only an invoice is created with the prorated charges for the additional items. And, in case of a decrease in the quantity, only credits are created. Additional Notes The existing, running total based Prorated Credits has been deprecated. It will still be applied automatically to new invoices until it is exhausted, or you could also reduce the value. But only reduction in the value will be supported.