Game Integration API
Base URL: {API_BASE_URL}/v1/games
Authentication
Most endpoints require JWT via the Authorization header. Player game operations (info, start, play, end) identify sessions using merchantCode + playerId instead of JWT.
- Authorization header:
Bearer {JWT_TOKEN} - For player game endpoints, include
merchantCodeandplayerIdin the request body. - Content-Type:
application/json
Game Types
| Game Type | Value | Description |
|---|---|---|
| High-Low | high-low | Card comparison game where players guess if the next card will be higher, lower, or same |
| Coin Flip | coin-flip | Classic coin flip game where players choose heads or tails |
Endpoints: Games
Common Response Structures
{
"success": true,
"status": "SUCCESS",
"message": "Human-readable message",
"data": {},
"timestamp": "2025-01-23T10:00:00.000Z"
}Error Handling
Always check the success field in responses. Handle specific messages for better UX:
if (!response.success) {
// Show error message to user
showError(response.message);
// Handle specific errors
if (response.message.includes('Insufficient balance')) {
// Redirect to deposit page
}
if (response.message.includes('session not found')) {
// Restart game
}
}