As some of you know, I have now been working for the past few years along with Stéphane Brossier on Kill Bill, an Open-Source billing platform.
At first, one can wonder how complicated a recurring billing system can be? After all, all it needs is to maintain a list of subscriptions, generate an invoice every month, and trigger a payment? The picture actually becomes complicated quite quickly. The system also needs to know how to compute pro-rations for upgrades and downgrades, manage add-ons (if the user upgrades to a higher tier plan, maybe the add-on is already included and the customer shouldn’t be charged for it), support invoice adjustments and chargebacks, integrate with one or more payment gateways, produce accurate Analytics and financial dashboards, etc. But even if you manage to build it (which is non trivial to get it right and bugs will cost you money), it needs to be flexible enough to meet future requirements (what if the marketing team wants to distribute coupons all of a sudden, how will this logic fit into the rest?).
After having gone through that cycle a couple of times, we decided to build an Open-Source platform to solve the problem. We learned a lot along the way, not only about financial and accounting concepts, such as generating revenue recognition reports, but also about building and maintaining large software projects with a lot of business logic. Being back-end engineers, we both had extensive experience building distributed and scalable systems and spent our fair share of time in Jetty’s source code, or reading about the latest serialization formats. Kill Bill has been challenging in the sense that, for a billing system, these questions matter less (e.g. you are unlikely to have to manage a throughput of thousands of upgrades per second) compared to writing maintainable and testable code, with a lot of customizable business logic.
We decided to share our experience and have started a series of articles on the architecture of the system and why it is designed that way, called The Kill Bill story. If you are curious, go check it out!