Convert Figma logo to code with AI

getlago logolago

Open Source Metering and Usage Based Billing API ⭐️ Consumption tracking, Subscription management, Pricing iterations, Payment orchestration & Revenue analytics

10,172
685
10,172
20

Top Related Projects

Ruby library for the Stripe API.

Open-Source Subscription Billing & Payments Platform

Quick Overview

Lago is an open-source metering and usage-based billing system. It allows businesses to implement complex pricing models and automate their billing processes. Lago is designed to be flexible, scalable, and easily integrable with existing systems.

Pros

  • Highly customizable pricing models and billing rules
  • Supports real-time usage tracking and aggregation
  • Offers a user-friendly interface for managing plans and customers
  • Provides robust API for integration with other systems

Cons

  • Requires technical expertise for setup and configuration
  • May have a steeper learning curve compared to some commercial solutions
  • Limited built-in integrations with third-party services
  • Documentation could be more comprehensive for advanced use cases

Code Examples

# Create a new customer
customer = Lago::Customer.create(
  external_id: 'cus_12345',
  name: 'John Doe',
  email: 'john@example.com'
)
# Create a subscription for a customer
subscription = Lago::Subscription.create(
  external_id: 'sub_67890',
  customer_id: customer.id,
  plan_id: 'plan_premium',
  started_at: Time.now
)
# Record usage for a billable metric
Lago::BillableMetric.create_event(
  customer_id: customer.id,
  code: 'api_calls',
  transaction_id: 'tx_123',
  properties: { quantity: 100 }
)

Getting Started

To get started with Lago, follow these steps:

  1. Clone the repository:

    git clone https://github.com/getlago/lago.git
    
  2. Install dependencies:

    cd lago
    bundle install
    
  3. Set up the database:

    rails db:create db:migrate
    
  4. Start the server:

    rails server
    
  5. Access the Lago dashboard at http://localhost:3000 and begin configuring your billing models and customers.

Competitor Comparisons

Ruby library for the Stripe API.

Pros of stripe-ruby

  • Extensive documentation and well-established API
  • Robust support for various payment methods and currencies
  • Large community and ecosystem of integrations

Cons of stripe-ruby

  • Limited to payment processing and related features
  • Potentially higher fees for certain transaction types
  • Less flexibility for custom pricing models

Code Comparison

stripe-ruby:

require 'stripe'
Stripe.api_key = 'sk_test_...'

charge = Stripe::Charge.create({
  amount: 2000,
  currency: 'usd',
  source: 'tok_visa',
  description: 'My First Test Charge (created for API docs)',
})

lago:

require 'lago-ruby-client'

client = Lago::Api::Client.new(
  api_key: 'lago_api_key_...'
)

invoice = client.invoices.create(
  external_customer_id: 'cus_12345',
  currency: 'USD',
  fees: [{ amount_cents: 2000, code: 'setup_fee' }]
)

Summary

stripe-ruby is a well-established payment processing library with extensive features and documentation. It excels in handling various payment methods and currencies but may have higher fees and less flexibility for custom pricing models.

lago, on the other hand, is an open-source billing API that offers more flexibility for complex pricing structures and usage-based billing. While it may have a smaller community, it provides a customizable solution for businesses with unique billing requirements.

The code comparison shows that both libraries offer straightforward methods for creating charges or invoices, with slight differences in syntax and functionality.

Open-Source Subscription Billing & Payments Platform

Pros of Kill Bill

  • More mature and feature-rich billing and payment platform
  • Extensive plugin ecosystem for integrations and customizations
  • Robust documentation and community support

Cons of Kill Bill

  • Steeper learning curve due to complexity
  • Requires more resources to set up and maintain
  • Java-based, which may not be preferred by all developers

Code Comparison

Kill Bill (Java):

public class InvoiceItem extends EntityBase {
    private UUID invoiceId;
    private UUID accountId;
    private UUID bundleId;
    private UUID subscriptionId;
    private String planName;
}

Lago (Ruby):

class BillableMetric < ApplicationRecord
  belongs_to :organization
  has_many :charges
  has_many :events
  validates :name, presence: true
end

Summary

Kill Bill is a more established and comprehensive billing solution, offering extensive features and integrations. However, it comes with increased complexity and resource requirements. Lago, being newer and Ruby-based, may be more approachable for some developers but lacks the maturity and extensive feature set of Kill Bill. The choice between the two depends on project requirements, team expertise, and desired level of customization.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Lago

Lago

The AI-native billing platform
Open-source metering, billing & revenue infrastructure for product-led companies.

Docs · Website · Slack · Issues · Roadmap

Github Stars Release License Slack YC


Trusted by

PayPal Mistral AI Groq Synthesia Laravel


What is Lago?

Lago is the open-source billing platform for usage-based, subscription-based, and hybrid pricing models. If you can track it, you can bill for it.

  • Open-source — self-host for full control over your data, or use Lago Cloud to get started faster. Either way, the code is transparent
  • Payment-agnostic — works with Stripe, Adyen, GoCardless, or any payment gateway
  • API-first — every feature available via REST API
  • SOC 2 Type II certified

Features

FeatureDescription
Usage MeteringReal-time event ingestion and aggregation for any pricing dimension
Billing & InvoicingAutomated invoice generation for subscriptions, usage, and hybrid plans
EntitlementsFeature access management tied directly to your billing plans
Cash CollectionPayment orchestration with dunning, retries, and multi-gateway support
Revenue AnalyticsCross-stream visibility into MRR, usage trends, and revenue drivers
Lago EmbeddedWhite-label billing for platforms and marketplaces
Lago AIAI-powered billing intelligence and MCP server for AI agents
IntegrationsNetSuite, Xero, Salesforce, HubSpot, Avalara, AWS/Azure/GCP Marketplace, and more

Get Started

Cloud (fastest)

Start billing in minutes — no infrastructure to manage.

Sign up for Lago Cloud or email hello@getlago.com

Self-hosted

Requirements

  • Docker & Docker Compose
  • Git

Quick start

# Clone the repo
git clone --depth 1 https://github.com/getlago/lago.git
cd lago

# Generate RSA key
echo "LAGO_RSA_PRIVATE_KEY=\"$(openssl genrsa 2048 | openssl base64 -A)\"" >> .env
source .env

# Start Lago
docker compose up

Open http://localhost for the UI. The API is at http://localhost:3000.

After an update

docker compose up

Configuration

If your server is not at localhost, set these in your .env:

LAGO_API_URL="http://your-server:3000"
LAGO_FRONT_URL="http://your-server"

For the full list of environment variables and advanced configuration (S3/GCS storage, SMTP, SSL, dedicated workers for high-volume), see the self-hosted docs.

Find your API key

  1. Open the Developer section in the sidebar
  2. Go to the API keys tab
  3. Click Copy

Documentation

SDKs & Client Libraries

LanguagePackage
Node.jslago-javascript-client
Pythonlago-python-client
Rubylago-ruby-client
Golago-go-client

Full OpenAPI spec: lago-openapi

Stay up to date

Contributing

We welcome contributions! See our contributing guide and the development environment setup.

Look for issues labeled beginner or help-wanted to get started.

License

Distributed under the AGPLv3 License. Why we chose AGPLv3.

Analytics & Tracking

Lago tracks basic actions on self-hosted instances by default. No customer PII or financial data is collected. Learn more or opt out.