Billing Engine for Laravel
A gateway-agnostic billing engine for Laravel: catalog, subscriptions, real-time usage metering with hard limits, a double-entry ledger, wallets and credits, invoicing and pricing. The framework peer to laravel-id.
Billing Engine for Laravel is a gateway-agnostic library of billing primitives you compose into a billing product: catalog, subscriptions, real-time usage metering with hard limits, a double-entry ledger, wallets and credits, invoicing and pricing. It is the framework peer to Identity for Laravel: UI-free and domain-free, with every capability behind a contract you bind, mock or replace. This is the package, not the product. The self-hostable app built on it is Cbox Billing.
Billing Primitives
Real-Time Metering
Reserve then commit usage with hard limits that block in sub-milliseconds. Lease-backed local enforcement refills from an allowance source, so there is no cross-node overspend and no shared Redis required.
Metering Truth
An immutable, append-only usage event log. Invoices are recomputed from it with the pinned price, never read from a disposable counter.
Double-Entry Ledger
Money lives in a double-entry ledger where balances derive from immutable postings, so the books always balance and nothing is edited in place.
Catalog & Subscriptions
Products, plans and subscriptions modelled as first-class primitives, with quotes, invoicing, payments and refunds behind contracts.
Wallets & Credits
Prepaid balances and credits handled as ledger postings, so grants, top-ups and consumption are auditable like everything else.
Contracts-First
Every module sits behind a contract you bind, mock or replace, with dogfooded testing traits and fakes for metering and the allowance source.
Three separate concerns
Enforcement, metering truth and money are kept apart. An app-local counter answers may-this-proceed in sub-ms and is rebuildable from the log. The immutable usage log is the source of truth. Money is a double-entry ledger. The invoice is computed from the event log, never read from a counter.