I was working on a billing system for utility company and it was a nightmare but not for the reasons from the article. Dates are no problem, everything is billed at the end of month, quarter or year. Upgrades are downgrades are simplified, customer can legally change tariff only on predefined dates/events. Usage - yes, but exampled in the article do not even scratch the complexity of this Idempotency is not really ne…
Thanks janci for sharing your experience! Indeed, we only scratched the surface of the complexity of metered billing, we'll do a deep dive soon on this topic (it does deserve its own post). I think for the'nightmares' you mention: - some might be specific to utility (not applicable to an online business), such as '- meter readings are available on dates totally independent from billing cycle'. - Some topics might be…
Billing systems are a nightmare for engineers
231–240 of 372 posts
Re: Billing systems are a nightmare for engineers
#232Just wait until you meet billing's angry roommate: invoicing. In the US, an invoice is just a weird PDF that you might glance at before sending off to your accounts payable team. But in other countries, especially those that use VAT style taxing systems, an invoice can be a legal document that expresses costs and taxes in a legally prescribed way for accounting purposes. Many countries have prescriptive rules over ho…
And even worse - your biggest customers won't even smell your invoice unless you enter it line by line into some ancient SAP system developed 20 years ago, where everything cloud related is classified as telephony except storage space which must be classified as filing cabinets (movable) or your invoice will be (very slowly) rejected. And if it is rejected you have to enter it all again by hand; editing isn't a featu…
Re: Billing systems are a nightmare for engineers
#233Re: Billing systems are a nightmare for engineers
#234Re: Billing systems are a nightmare for engineers
#235Billing is a nightmare, and if I had one piece of advice for people building a pay-for-what-you-use system like most SaaS, it's this: DO NOT bill against your business logic entities. They change, and doing a COUNT at the end of the month won't catch all things which changed or which cost you money during the month. Instead, figure out what you bill for and and when you do that thing, record a row in a DB or into a s…
This way, if the price changes, the item description changes, the images on the item change, etc, you can still have a record of what was actually sold and how much to refund a return etc.
Re: Billing systems are a nightmare for engineers
#236"Lago is backed by Y Combinator"
"The Open Source Stripe Billing Alternative"
Why would YC invest in both Stripe and a competitor of Stripe?
Re: Billing systems are a nightmare for engineers
#237Re: Billing systems are a nightmare for engineers
#238Since founders are commenting here. getlago.com webpage is strange: "Lago is backed by Y Combinator" "The Open Source Stripe Billing Alternative" Why would YC invest in both Stripe and a competitor of Stripe?
Re: Billing systems are a nightmare for engineers
#239Absolutely agree with the poster. This is my life at the moment. Just to take money for a small piece of software I built. Multiple currencies, trial periods, when in the process do you ask for the creditcard, country specific taxes,... And the worst: invoices. While paddle.com takes care of many of those things - I was shocked after realizing how much work this is going to be. Please think carefully about those thin…
Re: Billing systems are a nightmare for engineers
#240One design decision that, for me, seems to simplify things is to consider the "business system" a type of state machine that records all business events and serves as a "source of truth". If the events are not recorded, they have not occurred from the business perspective. A ledger-type architecture can be useful. This means that business events or user operations generate state transitions, which eventually are impl…
For sure; I do think an event based solution working as a source of truth for the billing is the right solution. However it still creates engineering difficulties (making sure you don't ingest the event twice for instance). The ledger-type architecture can definitely work. When we built the system for a fintech, it was actually an event-based architecture connected to a ledger (taking the money out of a wallet). I th…
In the framework of state-transitions, actions such as "price this with that" are implicit in the state matrix, and shouldn't be called from APIs. Rather, API calls should be used to produce reports which are print-outs of the "current state". Webhooks in this framework are attempted state-transitions. User interactions generate events, and requests for reports (for example invoices), but as little as possible in the form "do this with that".
My opinion currently is that there is little value in sharing code (libraries/frameworks) for these sorts of solutions because the code is trivial, application/language/domain-dependent, and coupled to everything else in the system.
But design patterns, templates, and concise examples are hugely valuable because they help illustrate the complexity and solutions up front.