Skip to main content

Welcome to Lago

Lago is an open-source software for metering and usage-based billing. It's the best alternative to Chargebee, Recurly or Stripe Billing for companies that need to handle complex billing logics.

This library will allow you to build an entire billing system from scratch. Lago is a real-time, event-based solution made for usage-based billing, subscription-based billing, and all the nuances of pricing in between.

You can use the self-hosted version to deploy Lago on your existing infrastructure or request access to Lago Cloud to start using our solution immediately.

Five-step billing workflow

1. Event ingestion

Events provide information about your customers' consumption, with the highest level of granularity. Any product feature for which you want to charge your customers should correspond to a specific event. An event can be triggered by an action or can be sent periodically. Lago is able to ingest events at scale while preventing duplicates.

2. Metrics aggregation

The aggregation process consists in converting events into billable metrics. There are 5 aggregation types:

COUNTCounts the number of times an incoming event occursMetered
SUMCalculates the sum of a predefined property for incoming eventsMetered
MAXReturns the maximum value of a predefined property for incoming eventsMetered
COUNT DISTINCTReturns the number of unique values of a predefined property for incoming eventsMetered
RECURRING COUNTAdd and remove billing units that are persisted period over periodPersisted
  • Metered: aggregated for a single billing period and resume to 0 at the end of the billing period.
  • Persisted: aggregated for a billing period and kept in-memory for following periods, unless you change the value.

3. Pricing

Creating plans allows you to define how much your customers should pay for using your product. You can then combine plans and billable metrics to implement any billing model (i.e. subscription-based, usage-based, or hybrid). Billable metrics may be priced differently depending on the associated plan.

4. Invoicing

Lago automatically generates invoices for each customer according to the plan model: the subscription fee can be billed at the beginning or at the end of the billing period while usage-based charges are always calculated at the end of the billing period. Invoices include fees, taxes and customer information.

5. Payments

When an invoice is emitted and finalized, it's ready for payment collection. Connect payment providers through native integrations or trigger payments on any PSPs using the invoice payload created by Lago.