Skip to main content

F102 — Two-Balance Wallet System


Business Rule

Every registered player holds two separate balances: Flow:
  1. Player sits at a table → buy-in amount deducted from account, credited as seat chips
  2. Player tops up during a session → amount deducted from account, added to seat chips
  3. Player presses Back to Lobby → all remaining seat chips automatically credited back to account
  4. If player loses all chips mid-session → can top up from account without leaving the table
Welcome balance: New players receive a £1,000 welcome balance on first login (Google OAuth).

Technical Design

Database

API endpoints

Client integration (game-shell.html)

The compliance bar’s Lobby button is intercepted:
The tableId is extracted from the game iframe URL (?tableId=N). If the player is anonymous or no tableId is present, navigation proceeds immediately without calling leave.

localStorage session shape

balance is stored in pence (integer). £1,000 = 100000. Updated after leave and after fetchPlayerProfile().

Acceptance Criteria


Version Parity


  • POST /api/tables/{tableId}/sit — buy in to a table
  • POST /api/tables/{tableId}/leave — cash out chips back to wallet
  • POST /api/tables/{tableId}/topup — top up chips during a session
  • GET /api/players/{playerId} — read account balance
  • F016 — Credits wallet — in-game chip balance display
  • HEDGE-187 · HEDGE-190 (lobby / cashier page)