đŠ The 14 pains of building your own billing system
Billing and revenue systems are a necessity if you ever plan to monetize your business.
If youâve spent any time with them, you know that billing systems are complicated, and no one wants to think about them. When they work, itâs great and everyone is happy.
Iâve seen them likened to an octopus, and I fully agree. They touch finance, product, experience, customer support, customers, legal, compliance, sales, and sometimes more.
Billing is hard, intertwined, and complicated.
Because itâs so inter-connected, it can go belly-up rather quickly if something breaks. And stuff does break. Frequently. (If you have a team thatâs maintaining this system and itâs not you, ask them!).
Also, if your system isnât breaking just yet. Give it some time.
Look, I know you are busy running the business and you already have lots on your plate. You just want to collect some money and move on to more pressing features that actually matter to customers.
But remember:
đ if you canât collect revenue legally and correctly, itâll become your headache and youâll have more on your plate than you could possibly ever chew đ
The three patterns
This is not unique to billing systems. It is very common to see one of three patterns:
- Home-grown
- Full 3rd party system
- or a hybrid of a home-grown and 3rd party system
These all have their own benefits and drawbacks, naturally.
Build your own / Home-grown | Hybrid | 3rd party |
---|---|---|
An entirely home-grown solution. The control is hard to beat. Full control, fully customizable, and you arenât paying anyone from the outside for fees. Many think (and this happens to many companies) that building and maintaining your own billing system is the best option for your business. | A mix of home-grown solutions and 3rd parties. For example, your billing engine is internal, payments are handled by a PSP, and tax compliance by a tax SaaS. Here, you can control the business logic (e.g., when do you update quantities), but the logic is handled by the 3rd parties. | A turnkey solution that handles everything for you. All the business logic, payment processing, invoicing, tax compliance, usage, metering â all done by one full-service solution. This is convenient for companies, but you lose a lot of control and may have to shell out a lot of money to get to this place |
Itâs very natural, when you just start your company (or youâre taking your first steps with a new product) to build everything by yourself.
You have engineers. You want to keep it very simple.
Or so you think.
Why not? Because youâre often still thinking like an engineer.
Youâre thinking of billing as an engineering issue. Youâll say to yourself âwhy canât we just dump a file of what we need to bill on S3, and have a CRON job pick it up and collect payment?â.
But youâre wrong. Itâs a very big and difficult problem, you just arenât seeing it yet.
Here is my very high-level description of the things a typical billing team needs to worry about (YMMV):
A typical billing or monetization team has so many responsibilities that itâs hard to grasp even for seasoned professionals.
Everyone knows you donât do your own security (or date handling). You also shouldnât do your own billing from scratch.
My 14 pains of billing and monetization
Allow me to list some of the problems Iâve had with home-grown billing systems, from least complex to most complex (partial list!):
-
Idempotency. All requests to do billing, collecting payments need to be unique and idempotent. This will become apparent when you hit API limits and need to retry, or need to spin up more instances of your billing system. Then, you risk double-charging. Luckily crediting/refunding is not a big problem, but this is a problem nonetheless when you scale your infrastructure.
-
Date handling. When do you bill? Every 30 days (calendar), or every month (anniversary)? What about leap days, time-zones, etc?
-
Proration and âleftoversâ. Do you prorate on upgrade or only downgrade? Refund? Credits? Ignore it? Block it from happening (donât allow upgrades/downgrades)?
-
Usage metering. There are dozens of way to decide how to calculate usage, and they can be changed frequently or by customer type
-
Invoice formatting. Sounds easy if youâre operating in one country. But when you expand you suddenly realise you have to collect not just sales tax, but also sometimes VAT and sometimes GST and sometimes additional levies (country-dependant) and you now need individual templates for each market.
-
Complex customer hierarchy. Customers (especially in B2B) could have subsidiaries and partners that they want to manage their billing relationships. How do you roll-up usage up to the paying entity?
This is often something that you donât think about at first, but changes when you grow and expand.- Making that even more complex: They could be in different locations, and taxed differently based on their location or where the services are delivered. Then, you are legally required to split the bills/invoices.
These rules can also change every few months
- Making that even more complex: They could be in different locations, and taxed differently based on their location or where the services are delivered. Then, you are legally required to split the bills/invoices.
-
Payment collection and churn prevention. When do you give up retrying? How do you handle chargebacks (terminate the account, suspend, refund)?
-
Pausing/resuming. What level of access do you let customers have when they pause their subscription?
-
Crediting / refunding. If you always refund the entire amount it may not be hard, but what about partial mistakes? Would you maybe want to give a âstore creditâ instead of a refund? Should that credit ever expire?
-
Tax handling. You may think different items having different tax rates is complex enough, but these also change frequently if youâre on the global level.
-
Custom deals. If youâre PLG-only this isnât an issue but if you sign contracts, you will very quickly end up with edge cases and special deals that canât be easily configured with the assumptions you made.
-
Human error. Customers are often comprised of humans who have made mistakes, and corrections need to be made. Businesses too are comprised of humans, who can misconfigure their customers and then need to make corrections. Crediting and reissuing invoices is a very time-consuming task.
- This is also true when customerâs legal details change (address, VAT ID, etc.)
-
Selective pricing changes. Pricing changes often donât affect all customers. When only new customers are affected, you must keep distinct versions of your pricing points to ensure customersâ agreements are kept.
-
Revenue recognition and accrued revenue. I canât even begin to explain this â but hereâs a 64 page PDF specification of revenue recognition rules according to IFRS-15. If you understand this â youâre special and please e-mail me, I want to know why. Bonus points if you also did a custom ERP integration đ„Č.
Why are these hard?
Some things change very regularly, more than youâd expect. Some things you only have to do once and never touch again.
Idempotency is a great example of an engineering issue that, once solved, rarely has to be touched.
However, tax rules change regularly across the world. The more countries youâre in, the more tax laws you have to keep track of.
Customer problems around mistakes is a relatively constant issue, but it increases in size as you grow, requiring more customer support and more manual corrections.
Let me try and put it in a table. Itâs entirely subjective, but it should help explain the relationship between how frequently things change (== break), and how impacted they are by scale.
Changes frequently / Impacted by scale | đ€ Somewhat impacted by your scale | đ Highly impacted by your scale |
đȘš Doesnât change | * Idempotency * Dates * Pause and resume rules | * Crediting / refunding * Human errors |
đŠ„ Changes sometimes | * Proration rules * Customer hierarchies | * Usage calculations * Payment collection * Pricing changes |
đ Changes frequently | * Custom deals * Revenue Recognition rules | * Tax handling * Invoice formatting |
My subjective assessment of why some topics are more difficult than others
tl;dr: Billing is initially an engineering problem rooted in a very very complex problem space which is really hard to understand even for industry veterans.
What should you do about it?
Offload as many problems as you can to someone else. Buy something off-the-shelf. Buy as much as you can.
I canât stress this enough.
Let Chargebee, Solvimon, Stripe, Recurly, Orb, Metronome, Lago, Togai or anyone else manage your billing when you start. 90% of the âSubscription and billingâ section in the diagram above can be handled by any of these.
Let Stigg handle your pricing pages, experiments, and entitlements.
Let your ERP handle your RevRec/Accounting (or use whatâs built in with something else).
You should only focus on updating the usage / basic customer lifecycle events, the things that are unique to your product.