Preparing your design workspace

Loading the problem and your latest saved attempt…

Prepaid Game-Card Payment Network

Design a prepaid-card ledger and payment network for roughly 125,000 entertainment machines with cash and credit-card reloads.

Problem statement

For this exercise, assume players use a reusable game card to pay for plays across roughly 125,000 entertainment machines. A card can be reloaded with cash at an authenticated operator terminal or with a credit card through an external processor.

Design the backend for reloads, play debits, balance reads, and transaction history. A balance may never become negative, a retried command may affect money only once, cash value may be issued only by an authorized terminal, and an uncertain credit-card charge must not create spendable value until it is resolved.

Machines may temporarily lose connectivity, but offline debits are not required and must fail closed. Physical-card manufacturing, loyalty rewards, cash-drawer accounting, and chargeback adjudication are out of scope.

What to build

  1. An authenticated operator terminal can request a cash or tokenized-credit reload and obtain a final, pending, declined, or uncertain outcome.
  2. An authenticated entertainment machine can debit a priced play atomically or receive insufficient-balance, duplicate, unavailable, or invalid-card outcomes.
  3. A player or support flow can read the authoritative balance and an ordered history of reload, debit, reversal, and adjustment entries.
  4. The system reconciles delayed processor results and repairs pending credit reloads without duplicating balance effects.

At scale

  • Plan for approximately 125,000 entertainment machines and 10 million active game cards.
  • Assume peaks of 5,000 play-debit attempts per second and 500 reload attempts per second, with traffic distributed across venues.
  • Target p95 online play authorization below 500 ms and p95 reload-service processing below 2 seconds excluding an external processor's completion time.
  • Retain immutable money-movement ledger entries and processor reconciliation evidence for at least two years; provider or venue connectivity incidents may last 15 minutes.