Live data from Hacker News

Billing systems are a nightmare for engineers

getlago.com

41–50 of 372 posts

Re: Billing systems are a nightmare for engineers

#42

I've worked at two companies in their payment systems. This post does a good job of mentioning many of the billing system challenges. I think it understates how difficult and important idempotency is to maintain at scale with multiple teams though. Additionally, it didn't mention financial regulation changes. India had changes sometime in the last few years which required whole new systems built that were specific to…

> Additionally, it didn't mention financial regulation changes. India had changes sometime in the last few years which required whole new systems built that were specific to India customers. One example of complexity is this: does the system apply to customers who are in India or does it apply to businesses who are in India (the owners might not be)? IIRC, I've read this is one of the reasons that systems like SAP ar…

Hey @tablespoon, I'm one of the cofounders of Lago here.

Products like SAP do seem complex because of (i) the complexity of the billing problem and all the edge cases, (ii) they were not built with an API-first or engineer-first mindset

We're only at the beginning of the journey, but that's one of the reasons why we thought of open-sourcing our billing API, so that the work could be forked and tweaked to address edge cases if needed (no need to wait for SAP to update the product: and they will never prioritize small edge cases). Also, it seemed to be no middle ground between 'Stripe Billing' (it's great for B2C Subscriptions) and billing systems that could address the millions of nuances of pricing between 'subscription' and 'usage-based' (most companies are a mix of both).

Re: Billing systems are a nightmare for engineers

#43

Random idea: Don't build a billing system. Or at least not a precise one. Have a price list as normal, but just guestimate the user's bills based on any easily accessible information. Eg. For a hosting company I might just count how many VM's they have active when the billing script runs . If the user isn't happy with the total, give them a button to correct the total and pay that. Spot check what the user's pay, and…

This sounds like trouble at several levels.

Someone's going to reverse engineer your heuristic and min-max it. At that point, you'll need to defend your heuristic against edge cases. And then you may as well just make it official.

Also, B2B customers are allergic to "pay what you feel"-type schemes.

Re: Billing systems are a nightmare for engineers

#44
I work on a team collecting fees at a financial company. It is tedious and boring. There is a lot of complexity. I've often asked the business if they had ever thought about a different fee model that would be less complex. They just want to stick the legacy business model into the new tech...

Re: Billing systems are a nightmare for engineers

#45
post #30

Just 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…

Just one of many reasons its easier to do business in the US

Hey cm2012, I'm one of the cofounders of Lago (my business partner wrote this post). Actually even if you're incorporated in the US, if you serve a client in EU for instance, the VAT rules of EU apply to how you're supposed to invoice your customer, beyond a certain transaction limit. So... unless you're based in the US, and only serving US-based users, it gets complex very fast!

Re: Billing systems are a nightmare for engineers

#46
post #30

Just 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…

Just one of many reasons its easier to do business in the US

Protecting consumers is always bad for business

Re: Billing systems are a nightmare for engineers

#47
post #27

Earlier quoted context omitted.

Have you looked at existing solutions? Why did not they fit?

Not the OP, but anybody who has built a deep integration with any billing provider (inclusive of Stripe) knows there are some bodies buried, although you typically don't discover them until you're late in the game. 90% of your use cases are covered, and with excellent UX and docs to boot. But that sweet 10%! --- For a concrete example, Stripe has a very nice "subscription" abstraction that makes it easier to operate…

> There's another, similar, story around creating draft invoices to give people quotes before checking out. The dashboard API has a function to modify the line items of a draft invoice, but it's not a public-facing API and there's no short-term intention to make it public-facing, so one has to build an ugly workaround.

There is a similar "not a public-facing API" limitation with configuring multiple invoice email addresses for Stripe customers (works in the dashboard, but blocked in the public API, where you can only set a single email per customer).

I'm actually quite surprised Stripe does this, since their initial reason for being was developer-friendly payments. But oh well, maybe I should take a look at an alternative (like Lago) sometime.

Re: Billing systems are a nightmare for engineers

#48

Just 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…

Yeah - and simply creating an invoice is creating taxable income in EU - if customer drags their feet you still owe VAT to the taxman.

If you want to change invoice you have to make a special "correction invoice" because changing "real invoice" is a criminal offense - fun things :)

Re: Billing systems are a nightmare for engineers

#49
One 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 implemented as database transactions. The event log can be stored and inspected.

The end user terms are encoded in the state-transitions. Contract obligations are encoded in the state of the database.

As for calendar issues - operations need to be performed over "real calendars". It might be practical to "materialize" the business calendar into discrete units for this purpose.

Re: Billing systems are a nightmare for engineers

#50
post #15

Just 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…

I said, over and over again, that moving away from goats and salt as currency was a mistake, but nobody listened to me.
Post reply on HN