Skip to main content

If You Can Rate It,
We Can Bill It

Enterprise-grade REST APIs for billing complexity. From real-time usage metering to multi-entity invoicing, our APIs handle any billing scenario with ease.

SOC 2 Type II ISO 27001 PCI DSS 99.99% Uptime
// Create a subscription with usage-based billing const subscription = await earnbill.subscriptions.create({ customer_id: "cust_7yxz123", plan_id: "plan_premium", billing_cycle: "monthly", usage_based: true, pricing_model: { type: "tiered", tiers: [ { up_to: 1000, unit_price: 0.10 }, { up_to: 5000, unit_price: 0.08 }, { up_to: null, unit_price: 0.05 } ] } }); // Record usage in real-time await earnbill.usage.record({ subscription_id: subscription.id, metric: "api_calls", quantity: 1250, timestamp: new Date() });
500+
Enterprise Clients
10M+
API Calls Daily
99.99%
Uptime SLA
<50ms
Avg Response Time
Real-Time Metering

Track Every Transaction,
Bill Every Second

Capture usage events in real-time with sub-second latency. Our metering API handles millions of events per day, aggregates them instantly, and applies your custom rating logic.

  • Ingest millions of usage events per second
  • Custom aggregation rules and rating engines
  • Automatic deduplication and error handling
// Record usage with idempotency await earnbill.usage.record({ idempotency_key: "evt_abc123", customer_id: "cust_7yxz123", metric: "compute_hours", quantity: 42.5, metadata: { instance_type: "gpu_v100", region: "us-east-1", project_id: "proj_ml_training" }, timestamp: "2024-12-29T10:30:00Z" }); // Query usage in real-time const usage = await earnbill.usage.query({ customer_id: "cust_7yxz123", metric: "compute_hours", start_date: "2024-12-01", end_date: "2024-12-31" });
// Create invoice for parent entity const invoice = await earnbill.invoices.create({ entity_id: "ent_parent_corp", billing_type: "consolidated", line_items: [ { description: "Subsidiary A - Usage", quantity: 5000, unit_price: 0.08, entity_id: "ent_subsidiary_a" }, { description: "Subsidiary B - Usage", quantity: 3200, unit_price: 0.08, entity_id: "ent_subsidiary_b" } ], currency: "USD", tax_calculation: "automatic" });
Multi-Entity Architecture

Complex Hierarchies,
Simple API

Manage parent-child relationships, wholesaler-reseller networks, and independent business entities through a single unified API. Consolidate or separate billing with ease.

  • Unlimited hierarchy depth and complexity
  • Flexible cost allocation and chargebacks
  • Multi-currency, multi-lingual invoicing
Any Pricing Model

From Flat Rate to
Quantum Computing

Support any pricing model: flat, tiered, volume, package, graduated, per-unit, hybrid, or custom. Mix and match models within a single plan.

  • Pre-built pricing models for any industry
  • Custom rating engines with business logic
  • Dynamic pricing based on real-time conditions
// Create complex hybrid pricing const plan = await earnbill.plans.create({ name: "Enterprise AI Platform", components: [ { name: "Base Platform Fee", pricing_model: "flat", amount: 999 }, { name: "API Calls", pricing_model: "graduated", tiers: [ { up_to: 10000, price: 0 }, { up_to: 100000, price: 0.01 }, { up_to: null, price: 0.005 } ] }, { name: "GPU Compute", pricing_model: "per_unit", unit_price: 2.50, unit: "hour" } ] });
// Webhooks for real-time events const handleWebhook = async (req, res) => { const event = earnbill.webhooks.verify( req.body, req.headers['earnbill-signature'] ); switch (event.type) { case 'invoice.payment_succeeded': await fulfillOrder(event.data); break; case 'subscription.updated': await updateAccess(event.data); break; case 'usage.threshold_exceeded': await notifyCustomer(event.data); break; } res.json({ received: true }); };
Developer-First

Built for Developers,
Loved by Enterprises

RESTful APIs, comprehensive SDKs, webhook events, sandbox environments, and detailed documentation. Everything you need to integrate in hours, not weeks.

  • SDKs for Node.js, Python, Ruby, PHP, .NET, Go
  • Full sandbox environment for testing
  • Webhook events for all billing actions

Enterprise-Grade Security

Bank-level security with comprehensive compliance certifications

SOC 2 Type II

Audited security controls

ISO 27001

Information security certified

PCI DSS

Payment card compliant

GDPR Ready

Privacy by design

Data Encryption

AES-256 encryption at rest, TLS 1.3 in transit. All API keys encrypted with hardware security modules.

Access Control

Role-based access control, SSO integration, API key scoping, and comprehensive audit logs.

Infrastructure

Multi-region deployment, automatic failover, daily backups, and 99.99% uptime SLA.

Get Started in Minutes

Follow these steps to integrate EarnBill into your application

1

Sign Up & Get API Keys

Create your account and generate API keys from the dashboard. Use test mode for development.

# Install the SDK npm install @earnbill/node-sdk
2

Initialize the Client

Configure the SDK with your API key and environment.

const EarnBill = require('@earnbill/node-sdk'); const earnbill = new EarnBill({ apiKey: process.env.EARNBILL_API_KEY, environment: 'test' // or 'production' });
3

Create a Customer

Set up your first customer account.

const customer = await earnbill.customers.create({ email: '[email protected]', name: 'Sample Company', metadata: { internal_id: 'acme_123' } });
4

Define a Pricing Plan

Create a pricing plan with your billing model.

const plan = await earnbill.plans.create({ name: 'Professional Plan', billing_cycle: 'monthly', base_price: 99.00, currency: 'USD' });
5

Create a Subscription

Subscribe the customer to the plan.

const subscription = await earnbill.subscriptions.create({ customer_id: customer.id, plan_id: plan.id, start_date: new Date() });
6

Record Usage

Track customer usage in real-time.

await earnbill.usage.record({ subscription_id: subscription.id, metric: 'api_calls', quantity: 100, timestamp: new Date() });
7

Handle Webhooks

Listen for billing events in your application.

app.post('/webhooks/earnbill', async (req, res) => { const event = earnbill.webhooks.verify( req.body, req.headers['earnbill-signature'] ); // Handle the event console.log('Received event:', event.type); res.sendStatus(200); });
Get Your API Keys

Comprehensive API Reference

Complete documentation for all endpoints, with examples in multiple languages

Core Resources

POST /v1/customers
POST /v1/subscriptions
POST /v1/invoices
POST /v1/usage/record
GET /v1/usage/query
PUT /v1/subscriptions/:id

Advanced Features

POST /v1/entities
POST /v1/plans
POST /v1/credits
GET /v1/reports/revenue
POST /v1/webhooks
DELETE /v1/subscriptions/:id
View Full Documentation

Ready to Build with EarnBill?

Start integrating in minutes with our comprehensive APIs and developer tools