Intermediate · 30 min · 4 steps

A reward coin ledger that never goes below zero

Meera Nambiar, Financial Ledger Engineer at PerkPoint

Meera Nambiar is an engineer who builds money records at PerkPoint, an app that gives Indian credit card holders reward coins for paying their bills on time. It is 11:30 AM on a festive Monday. PerkPoint has just started its big 'Super-Spin Cashback' offer: users can swap reward coins for electronic gift cards.

The question

How do we build a coin ledger where records are never changed, so users cannot redeem twice and no balance goes below zero?

  • Double-entry bookkeeping
  • Immutable ledgers
  • Event sourcing
  • Concurrency invariants

The rest of this case study is locked

The data, every step with its code and result, and the final answer open with a pass. A few case studies stay free so you can see how they work.