Developer Documentation

BetterPlay
Games Integration

Everything you need to embed casino games into your platform — from server-to-server auth and wallets to mounting the game UI in a browser.

12 Games ES Module UI HMAC Wallet API JWT Launch Aggregator API
Operator Guide
Direct Whitelabel Integration

You own the player identity and wallet. BetterPlay hosts the game logic. Your backend mints launch tokens; your frontend mounts the game UI.

  • Server-side JWT launch & player auth
  • Wallet API — debit, credit, rollback
  • ES Module UI library — mountOperatorGame()
  • Theming, per-game props, preloading
Read Operator Guide
Aggregator Guide
Multi-Operator Distribution

You run a game aggregation platform. Provision operators under your account, mint launch tokens on their behalf, and embed games across your brand network.

  • Operator provisioning API
  • Aggregator-signed launch tokens
  • Per-operator wallet routing
  • Same UI library, aggregator auth flow
Read Aggregator Guide
Live Demo
Play the integration before you build it

The operator harness mounts any game right in your browser — offline in demo mode with mock responses, or against a real games-backend to walk the full JWT /launch flow end-to-end. The aggregator variant adds key verification, operator provisioning, and token minting.

Architecture

How Games Are Integrated

BetterPlay owns all game logic, round state, and RNG. You own the player and the money. Two layers connect them: a server-to-server wallet API and a browser UI library.

System Overview — Operator Integration
Operator BetterPlay Player
OPERATOR PLAYER Browser YOUR BACKEND Mints launch JWT Verifies HMAC YOUR WALLET Balances · debit credit · rollback BETTERPLAY Game logic · RNG Round state Session cookies Game UI bundle BETTERPLAY CDN betterplay bundle open game launch JWT 302 → game UI HMAC wallet calls /auth · /bet · /win loads ES bundle
Hosted We host the UI — your backend mints the JWT and redirects to /launch. Lowest effort.
Embedded You import the bundle and call mountOperatorGame() inside your own page. Maximum control.
1 Player opens game — your page calls your backend to mint a short-lived JWT.
2 Launch redirect — browser is redirected to BetterPlay with the signed JWT; we verify and set a session cookie.
3 Wallet calls — every bet and win triggers an HMAC-signed server-to-server call to your wallet service.
4 Game UI — served from BetterPlay (hosted launch) or imported as an ES module into your page (embedded).
Minimal Integration

Mount a Game in 10 Lines

The only mandatory pieces: a sized container, the bundle URL, and one mountOperatorGame() call. Use demoMode: true to run with no backend at all — swap it for a real sessionToken when you go live.

html — complete standalone page
<!-- 1. Sized container — game fills it; definite height is required -->
<div id="game" style="width:100%; height:720px;"></div>

<script type="module">
  // 2. Bundle must be served same-origin as the page (avoids CORS on dynamic import)
  const bundle   = `${location.origin}/betterplay/betterplay-games.es.js`;
  const manifest = `${location.origin}/betterplay/manifest.json`;

  // 3. Import the library and mount
  const { mountOperatorGame } = await import(/* @vite-ignore */ bundle);

  await mountOperatorGame(document.getElementById('game'), {
    game:       'dice',            // crash · dice · mines · limbo · wheel · plinko…
    demoMode:   true,              // ← no backend needed; remove for production
    backendUrl: 'https://api.betterplay.com/games/api',
    cdnUrl:     'https://cdn.wasabi.casino',
    session:    { player: 'demo-1', currency: 101, balance: 1000 },
    library:    { bundle, manifest },
  });
</script>
Going live? Remove demoMode and add a sessionToken field inside session — minted server-side from your backend's launch endpoint and never put in browser source code. See the full launch flow in the Operator Guide §2.
Aggregator path? The same UI call works — just swap in the aggregator-minted token and use the aggregator-variant helpers documented in the Aggregator Guide.