← Back to Articles
How the Rating Engine Works in BillingEngine
Published: 15. 3. 2026 Author: Michal Keller ratingpricingAPI

How the Rating Engine Works in BillingEngine

A detailed look at how BillingEngine receives raw usage data, finds the correct price list, and calculates the price in real time.


What is a rating engine?

The rating engine is the core of BillingEngine. It receives a data record (DR) — raw data about your service usage — and calculates the resulting price based on active rules and price list versions.

Record processing flow

Every submitted DR goes through these steps:

  1. Validation — checks format, required fields, and customer existence
  2. Price list selection — the engine iterates active pricing_rules and finds the first one matching the record’s attributes
  3. Price calculation — applies the rate from price_list_items to the volume or count
  4. Storage — the record is saved with the calculated price and a reference to the price list version used

Rules and conditions

Triggers (triggers) allow dynamic changes to engine behavior. You can define:

{
  "conditions": {
    "service_type": { "op": "eq", "value": "SMS" }
  },
  "aggregate_conditions": [
    { "func": "COUNT", "field": "id", "op": "gt", "value": 500 }
  ]
}

Price list versions

BillingEngine supports price list versioning. Each version has a validity period (valid_from, valid_to). The engine always selects the version valid at the time the record was received — so historical records remain consistent even after price changes.

Result

After processing a record, the POST /api/v1/dr/billing endpoint returns a price summary for the chosen period — the perfect basis for issuing an invoice.

← Back to Articles Back to Home