Phoenix Games

Overview

Backend integration with Phoenix Games

Backend Integration

Your backend does two things:

  1. Receives webhook calls from Phoenix during gameplay (withdraw, deposit, rollback, balance check)
  2. Calls the Operator API to create game sessions, look up bets, and grant free bets

What You Implement

Four webhook endpoints at your api_url:

EndpointWhen it's calledWhat you do
POST /withdrawPlayer places a betDeduct the wager from their balance
POST /depositBet settles (win or loss)Credit the winnings (0 for a loss)
POST /rollbackBet cancelled before it startsReverse the withdraw
POST /player-balanceBalance checkReturn current balance

Plus JWT token generation for starting game sessions.

What You Call

Three endpoints on Phoenix's Operator API (operators.phoenixbet.io):

EndpointPurpose
GET /api/v0.2/fetch-gamesList your configured games and instances
GET /api/v0.2/fetch-bet/{bet_id}Look up a specific bet's status
POST /api/v0.2/free-bet/grantGrant free bets to players

Response Format

All webhook endpoints return the same JSON structure:

{"type": "SUCCESS", "balance": 1234.56, "timestamp": 1712401234567}
FieldTypeDescription
typestring"SUCCESS" or "ERROR"
balancefloatPlayer's current balance (required for SUCCESS, optional for ERROR)
timestampintegerUnix milliseconds (required for SUCCESS)
codestringError code (required for ERROR)

Always return HTTP 200 - both for success and error. The outcome is in the type field.