ASTRA<CODEX>

AI-driven software engineering studio

←All Case Studies
5.2
SaaS Platforms + ML

Subscription & usage billing

A billing core with metered usage, plan versioning and anomaly detection, replacing three tools that never agreed with each other.

MeteringPlan versioningProrationRegional taxAnomaly detection
1Context

Three systems, one invoice

Plans and trials lived in the product, overages in a spreadsheet, taxes in the accounting tool. Each pricing change required a release; finance reconciled invoices by hand every month.

2Challenge

Pricing couldn't move

  • Numbers differed between product, spreadsheet and accounting.
  • Proration and mid-cycle upgrades were calculated manually.
  • Regional tax rules were hard-coded.
  • Usage spikes and revenue leaks were noticed only after invoicing.
3What we build

A billing core with metered usage

  • Event-based metering with idempotent ingestion and replay.
  • Versioned plans: prices change without a release, existing customers keep their terms.
  • Proration, trials, overages and regional tax as configuration.
  • Connectors to payment providers and accounting; anomaly models flag unusual usage before the invoice goes out.
  1. # stack · models · guardrails
  2. metering: event-based usage over Kafka, idempotent ingestion, replayable
  3. ledger: double-entry, immutable postings, period close
  4. pricing: versioned plan catalog; proration and trials as rules, not code
  5. tax: region rules as configuration, validated against provider APIs
  6. anomalies: seasonal-hybrid ESD + isolation forest on usage series, pre-invoice gate
  7. connectors: Stripe / Adyen for collection, accounting export
4Outcome

Finance stopped reconciling by hand

One source of truth for revenue, pricing experiments in days instead of quarters, and leaks caught before they reach the customer.

0releases
per pricing change
1 per change → versioned config
3days
to launch a pricing experiment
quarters → proration & trials included
100%
of usage anomalies flagged before invoicing
was: found by the customer
1ledger
for revenue
3 tools → one source of truth
+4%
recovered revenue
overages & leaks billed, not missed
−12days
DSO
invoices out on time, no reconciliation lag