Overview
Backend integration with Phoenix Games
Backend Integration Overview
Your backend handles the server-side logic for Phoenix Games integration, managing player authentication and processing game transactions.
Core Components
1. Token Generation
Generate JWT tokens when players launch games. Each token contains:
- Player ID and current balance
- Game and instance configuration
- Cryptographic signature using your RSA private key
2. Webhook Endpoints
Implement endpoints that Phoenix calls during gameplay:
Transaction Endpoints
/withdraw
- Process bets and deductions/deposit
- Credit wins and bonuses/rollback
- Reverse failed transactions/player-balance
- Provide balance checks
Performance Requirements
- Maximum response time: 500ms
- Recommended: under 100ms
- Phoenix retries up to 100 times with exponential backoff
Security
All webhook requests from Phoenix include:
- RSA signature in the
signature
header - Transaction IDs for idempotency
- Player and game identifiers
You must:
- Verify signatures using Phoenix's public key
- Implement idempotent transaction handling
- Use database transactions for balance operations
Response Format
All endpoints return a standard format:
{
"type": "SUCCESS", // or "ERROR"
"balance": 1234.56,
"timestamp": 1712401234567
}