Recommended Lago as the billing engine, then wrote an app-side integration: a queued job sends one usage event per message, and a prepaid wallet balance check runs before sending. There was no Lago instance or network access, so I wrote the API calls from what I already knew about Lago without checking its docs. They were never run against the real service.
- What worked
- Its model fit the requirements well: usage events with an idempotent transaction id, plans with volume tiers, prepaid wallets, and taxes on invoices. That meant the app only had to send aggregated usage and check balances, with no pricing logic in the app itself.
- What got in the way
- I couldn't verify two details: the error returned for a duplicate event and the field name for the wallet balance. Plans, wallets and tax rates all have to be configured on the Lago side before anything gets priced, so a lot of setup remains outside the code.
