Building usage-based billing for banks

Building usage-based billing for banks

Every digital action in a bank can become a charge, but turning a stream of API events into the right fee, for the right customer, on the right invoice is hard: duplicates, missing data and changing tariffs quietly break the bill. Using Keops as an example, this talk shows an event-driven billing architecture built on Kafka that captures usage, resolves customer and contract, prices each event with versioned rules, and keeps every invoice line traceable and explainable.

Speaker: Hassane Moustapha, Architect and Coach IT

apidays Paris @ FOST Paris 2026
https://www.joinfost.io/events/paris

FOST, powered by apidays PRO

December 03, 2026

Annual Pro sale · Save $30

Have presentations of your own?

Share with private links, password protection, and more control over your work.

Transcript

18 slides
  1. apidays PARIS 2026 1–3 DECEMBER 2026 PARIS Hassane Moustapha X

    · @_hkairi Building usage-based billing for banks SPEAKER From API events to accurate bank invoices. Why billing gets complicated — and how Keops makes it manageable.
  2. Every digital action can become money. START WITH THE PROBLEM

    The challenge: turn a stream of small activities into the right charge, for the right customer, on the right invoice. Usage payments · APIs · messages ! Get it wrong Overcharge, undercharge, or charge twice. → Charge rules · context · timing ? Can't explain it A total without a clear reason is hard to trust. → Invoice accurate · explainable ↻ Rules keep changing Products, contracts and policies evolve.
  3. Six dimensions combine into every charge WHY BILLING IS HARD

    A single event can sit at the intersection of all of these choices. ◎ ↯ Activity transfer · call · message Customer account · product · branch ◷ Time event · day · period ◇ Contract version · currency · channel ≋ Price unit · tier · percentage ↻ Exceptions retry · correction · dispute + Customer Basic plan · branch A + Time March 2026 · period + Contract v3 · EUR · web + Price 1,5 % tiered → Charge 15,00 € Activity transfer · 1 000 € + Customer Premium · branch B + Time March 2026 · period + Contract v3 · EUR · web + Price 0,5 % tiered → Charge 5,00 € Activity transfer · 1 000 € × Many valid combinations → one charge that must be right The hard part isn't multiplying a rate by a count. It's making every dimension agree for every event.
  4. One transfer. Several decisions. A SIMPLE EXAMPLE Before a transfer

    becomes a fee, Keops needs to resolve its identity, context and applicable rule. ✓ New or duplicate? Transfer event amount · time · customer → ◇ Which contract? ≋ Which tariff? ⌖ Which customer? ◷ Which effective date? ◎ Allowance or cap? → One fee correct · traceable · explainable
  5. Small gaps become financial problems WHAT BREAKS WITHOUT A SYSTEM

    … ⧉ DUPLICATE DELIVERY MISSING INFORMATION A retry looks like a new event. An absent field quietly changes the result. One action, two charges A plausible, wrong total ≠ ◷ RULE CHANGES DIFFERENT RECORDS The current tariff is applied to yesterday's usage. Billing and reporting drift apart unnoticed. Past and present get mixed Two totals, no explanation Invisible errors → disputes, rework, lost trust
  6. Make rules explicit. Make results traceable. THE KEOPS ANSWER Keops

    gives each charge a clear journey from usage to explanation. Capture Consistent usage events → Resolve Customer · product · contract Keops turns variations into explicit business rules instead of one-off fixes. → Price Right rule · right time → Explain Invoice · audit trail
  7. One clear journey, with checks along the way HOW THE

    SOLUTION WORKS 01 · Usage What happened, when and for whom? 02 · Context Which customer, product and contract? Every event keeps its identity 03 · Pricing Which rule applies to this event? 04 · Invoice What belongs in this billing period? 05 · Assurance Can we verify and explain the result? → Every decision has a rule behind it → Every charge can be traced A high-level view of Keops: usage, pricing and invoicing stay connected without becoming one opaque calculation.
  8. A toolkit for real-world pricing FLEXIBLE PRICING Pricing building blocks

    can be combined to reflect products, contracts and policies. Per use Packages & tiers Percentages & limits Tariff matrices Allowances Policy rules Fixed fee per action or unit Different rates by product dimensions Included units, volume steps, thresholds Free usage before charges begin Value-based rates, minimums and caps Eligibility, daily limits, regulatory caps
  9. Four guardrails around every invoice TRUST AND ACCURACY No duplicate

    charge Retries keep the same identity. One billing period Time boundaries don't overlap. No made-up amount Invalid inputs surface as errors. ✓ Reliable outcome, even when something goes wrong Records reconcile Differences are detected and traced.
  10. Every invoice line should answer “why?” EXPLAINABILITY INVOICE LINE 1

    · Usage counted Events, customer, product and billing period. Product Usage Pricing rule Applied rate Total ✓ checked Digital transfers 125 actions Tiered tariff Contract version 3 12,50 € Illustrative example — the important part is the trace from usage, through the rule, to the final amount. 2 · Rule applied The contract version, allowance and price in force. 3 · Result verified The calculation details remain available to investigate or explain.
  11. Change the rule. Keep the history. DESIGNED FOR CHANGE Products

    and policies evolve. Keops makes a change a dated, explicit version — not a silent rewrite. TODAY CHANGE AGREED EFFECTIVE DATE ANY TIME LATER Existing usage follows the rule currently in force. Allowance, rate or eligibility is updated as a distinct version. New usage uses the new rule; previous activity keeps its original context. Follow the usage and decision that produced each invoice line. Current contract New tariff configured New rule begins Explain or audit History preserved across the change →
  12. One journey. Five cooperating layers. KEOPS ARCHITECTURE · PRODUCTION STACK

    Channels Bank applications Tenant & customer portals edge & APIs Rate & process → → Secure Caddy TLS · Nginx web → Event backbone → Event processor · Go front Apache Kafka Rating engine · Java / Kafka Ingestion Tenant Internal admin API clients Angular / TypeScript Usage Catalog Rated events Go services Billing scheduler & worker Go · invoices and billing cycles Docker Compose ↔ Angular / TypeScript Faktory Background job orchestration Go Java 21 Kafka 4.1 · 3 brokers Streams Validate Enrich Calculate ↔ PostgreSQL 16 Financial records PostgreSQL · source of truth Redis · cache ClickHouse · analytics Tenant jobs Go · imports, transitions, exports Redis 7 ClickHouse 24.3
  13. Patterns that protect the bill DESIGN PATTERNS IN KEOPS Each

    pattern addresses a practical risk in turning usage into money. ▦ ⇢ ≋ ↻ Modular service boundaries Event-driven architecture Pricing strategies Idempotent processing ⇢ ⇄ ⛨ Web–Queue–Worker Dead letters & replay Bounded resilience ◎ Separate responsibilities for APIs, processing, rating and billing. APIs enqueue work; Kafka carries events, Faktory schedules jobs, and workers process asynchronously. Kafka connects producers and processors without tight coupling. Failed events are retained for investigation and controlled recovery. Choose the appropriate formula for each configured charge model. Retries and circuit breakers limit cascading dependency failures. Stable event identity detects duplicates and applies the configured policy. Source of truth & reconciliation PostgreSQL owns financial truth; analytics is checked against it.
  14. Watch usage become revenue KEOPS LIVE · EVENT TO VALUE

    CBS APP Core banking accounts · contracts Mobile & web customer activity Payments & cards PAY transactions · status KEOPS / REVENUE ENGINE 01 METERING Validate usage and map it to a metric. TRACE · RATE · RECONCILE 02 03 04 RATING BILLING INSIGHTS Resolve the tariff and calculate the fee. Build invoice lines from rated usage. Branches & ATM ATMs services · channels API Partners & APIs REPLAY FLOW Metering · event validated and matched to its metric Reconcile results and surface anomalies. ✓ Explainable invoice amount · rule · calculation ↗ Revenue assurance ◎ Reliable records discrepancies surfaced traceable to usage digital consumption Event packets flow through the lifecycle; each stage highlights as Keops processes the event. METERS → VALUE → PROOF
  15. Volume, variety, and a single path through Keops EVENTS IN

    MOTION Different banking activities arrive as many kinds of events. Each one is validated, matched to its context, priced, and carried to the invoice through the same controlled path. KEOPS EVENT JOURNEY 1 · Capture Usage event quantity · API call · message Receive and identify the event. Money event amount · transfer · card → Balance snapshot account · balance · date Customer, product, contract, effective rule. 3 · Pricing Apply the configured pricing logic. Tariff event 4 · Invoice scheme · region · merchant Thousands of events 2 · Context Invoice line amount · rule · explanation → Reconciliation records checked and traced Outcome accurate, explainable charge Add the charge to the right period. Many event types One consistent path One traceable result The volume creates load; the variety creates complexity. Keops keeps both manageable by routing every event through the same explicit stages.
  16. Accurate invoices are earned — not generated. THE TAKEAWAY Start

    with a clear event contract. Make the combinations in pricing explicit. Protect every calculation with traceability and checks. Make change manageable without losing the history. Keops — from usage events to accurate, explainable bank invoices.
  17. Scan to share your feedback. YOUR FEEDBACK Rate this talk

    and share your thoughts on building usage-based billing for banks. Prefer to open it on your device? Open the feedback form. Follow me on X: @_hkairi

More Decks by FOST, powered by apidays

Other Decks in Technology