Skip to main content

The Object Hierarchy

Recurso uses a simple hierarchy of objects to manage billing. A plan (flat prices plus usage charges) and a customer meet in a subscription, which generates invoices each cycle — flat fees in advance, metered usage in arrears. Payments settle those invoices (draining any prepaid wallet first), and every financial movement lands in the ledger.

Architecture

Every request flows through the same layers, and every financial event is written to a proper set of books. Recurso keeps a double-entry ledger with PostgreSQL as the authoritative store; when a TigerBeetle backend is connected, each posting is also dual-written to it as an optional high-throughput mirror.
PostgreSQL is always authoritative. TigerBeetle is optional and reconciled against Postgres by transaction ID — see the Double-Entry Ledger guide.

Tenants

A Tenant represents your business or a customer’s business in multi-tenant setups.
Most single-product SaaS companies will have just one tenant.

Plans

A Plan defines what you’re selling and how much it costs.

Pricing Models

A plan combines flat prices (billed in advance) with optional usage charges (billed in arrears at period close). A plan holding both is hybrid — one invoice carries the flat fee and the metered lines.
Fixed price per billing period, per currency, in minor units.
Every metered unit at one rate — decimal strings support sub-paise pricing like ₹0.0035/call.
Graduated prices each band’s units at its own rate; volume prices the whole quantity at the tier it reaches.
Bundles that round up: ₹5.00 per 1,000 calls.
See the Usage-Based Billing guide for the full pipeline from event to invoice line.

Customers

A Customer is someone who pays you.

Subscriptions

A Subscription connects a customer to a plan.

Subscription States

Invoices

An Invoice is a record of what the customer owes.

Invoice States

Payments

A Payment records successful transactions.

Billable Metrics & Usage

A billable metric is a named meter over usage events — its code doubles as the event dimension it aggregates (count, sum, max, or unique property values). Events ingest one at a time or in batches of 500, with optional transaction_id idempotency so retries never double-count. At period close, each charge on the plan aggregates the elapsed period’s events and prices them onto the renewal invoice — exactly once, guarded by a rated-window claim.

Wallets, Commitments & Alerts

  • Wallets hold prepaid balance per customer and currency. Invoices drain the wallet before credit notes and the payment gateway; promotional credit can expire, and auto-recharge tops balances up from the saved payment method. (guide)
  • Commitments set a per-period revenue floor: shortfalls bill an automatic true-up line at period close. (guide)
  • Usage alerts watch a metric against a threshold — absolute or a percent of the entitlement limit — and fire once per billing period via webhook and email. (guide)

Webhooks

Webhooks notify your app about billing events.

Next Steps

Plans

Create and manage pricing plans

Subscriptions

Manage customer subscriptions