Real-Time Usage Rating with Aviate — Any Event, Any Price, Any Business Model

by | Jun 3, 2026 | Billing Systems, Metering, Usage-based billing

The Problem We’re Solving

The world is full of businesses that need to charge for what customers actually use — minutes parked, gigabytes transferred, API calls made, kilowatt-hours consumed. Traditional subscription billing platforms handle recurring charges well, but they struggle when pricing depends on when something happened, who the customer is, and what exactly they did.
Aviate’s Rating Engine is a standalone, scriptable pricing layer that sits alongside Kill Bill. You describe your pricing rules in a Rating Catalog — a versioned, tenant-scoped definition that lives in Aviate — and then call a single API to get an instant price (or a committed invoice charge) for any event. No subscriptions required. No catalog XML. No redeployment.

How It Works – The Key Concepts

A Rating Catalog is built from three layers:

  • Policies — shared defaults: rounding rules, pricing variables (e.g. evDiscountPct = 0.10), time bands (named windows like DAY 08:00–20:00 and NIGHT 20:00–08:00), and lookup tables for tariff matrices.
  • Pricing Rules — each with:
    • A selector — a JavaScript boolean expression evaluated against the request context (e.g. vehicleType==’EV’ && service==’PARKING’). If it matches, the component fires.
    • A formula — a JavaScript numeric expression that computes the amount (e.g. duration_minutes() * rate). Built-in helpers like duration_minutes(), minutes_in_band(‘DAY’), and lookup(table, key) are available out of the box.
    • A kindBASE, SURCHARGE, or DISCOUNT, controlling how the amount is combined into the final total.
    • A priority, controlling evaluation order.
  • Lifecycle — moves through DRAFT → ACTIVE → RETIRED. An active Rating Catalog is resolved at rating time by ID.

When you call the /quote or /charge endpoint with a request — carrying the measure (type, unit, quantity), the period (start/end timestamps), an arbitrary context map (key-value pairs injected as JavaScript variables), and a currency — Aviate evaluates every component whose selector matches, sums the results, and returns an itemized response.

The /charge endpoint goes one step further: it creates a committed charge on an invoice attached to the Kill Bill account, wiring directly into Kill Bill’s invoicing, payment, and dunning flows — so the pricing engine and the billing platform stay in sync without any custom integration code.

A Real Example — EV Parking

Scenario: A smart parking operator charges differently for day vs. night sessions, with a discount for electric vehicles.

The Rating Catalog defines:

  • A DAY band (Monday–Sunday, 08:00–20:00, Europe/London)
  • A NIGHT band (Monday–Sunday, 20:00–08:00, Europe/London)
  •  DAY_RATE policy — fires always, formula: minutes_in_band(‘DAY’) * 0.12 — £0.12/min during the day
  • NIGHT_RATE policy — fires always, formula: minutes_in_band(‘NIGHT’) * 0.06 — £0.06/min at night
  • EV_DISCOUNT policy — selector: vehicleType==’EV’, kind: DISCOUNT, formula: -(list * 0.10) — 10% off for EVs

Let’s now assume an incoming request for a 90-minute session from 19:30–21:00 in an EV:

  • 30 minutes in DAY band → £3.60
  • 60 minutes in NIGHT band → £3.60
  • EV discount: −£0.72

The /quote endpoint returns the full breakdown with applied rule IDs for a total of £6.48. The /charge endpoint posts that directly to the customer’s Kill Bill account.

Why This Matters — What You Get

The Rating Engine is designed to stay out of your way. Because it is completely decoupled from Kill Bill subscriptions, you can rate any event for any account without touching entitlements, plan phases, or Kill Bill ‘s internal with its products, plans, … Before you commit a single charge to a customer, the /quote endpoint gives you a free dry-run: iterate on your Rating Catalog, adjust your formulas, verify the numbers, and only flip the state to ACTIVE when you are confident it is right.

Pricing changes over time, and the engine handles that cleanly. Every Rating Catalog is versioned per name and per tenant, so a new rate card takes effect exactly when you activate it without disturbing existing charges. The expression engine is where the real power lives: selectors and formulas are plain JavaScript, which means step-rate tariffs, lookup-table pricing, time-of-use rates, and multi-factor discounts are all within reach without writing or deploying any custom code.

Finally, none of this is a silo. Every charge created through the engine flows directly into Kill Bill invoices, triggering autopay, revenue recognition, and your existing AR and reporting workflows exactly as if the charge had come from a subscription. You get the flexibility of a custom rating engine with the operational reliability of Kill Bill underneath it.

Ready to start? Aviate is available at aviate.killbill.io. The rating engine is delivered as part of our Aviate plugin— no extra setup required once your plugin is running. Reach out for a demo or if you have any questions.

Related Articles