Credentials (server-side only)
Store these in secure config — never expose them in the browser or public docs.
player_prefix: YOUR_PLAYER_PREFIX
agency_uid: YOUR_AGENCY_UID
aes_key: YOUR_AES_KEY
server_url: https://api.stargaming.network
callback_url: https://yoursite.com/callback.php
Important rules
- Use AES-256-ECB encryption and Base64 encoding for every encrypted
payload.
- Top-level request fields are
agency_uid, timestamp, and payload.
member_account must start with your assigned player_prefix.
- Use
game_uid from the Game List API when launching a game.
- For callbacks, always check
serial_number and never process the same transaction twice.
- Balance formula:
credit_amount = credit_amount - bet_amount + win_amount.
- If
win_amount or bet_amount is negative, treat it as a refund.
Workflow
Player
→ Your Website
→ Game Provider API (https://api.stargaming.network)
→ Game Launch URL
→ Player Plays Game
→ Provider Callback to Your callback_url
→ Your Website Updates Player Balance
Encryption helpers
PHP
function encryptPayload(array $data, string $aesKey): string
{
$json = json_encode($data, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
$encrypted = openssl_encrypt($json, 'AES-256-ECB', $aesKey, OPENSSL_RAW_DATA);
return base64_encode($encrypted);
}
function decryptPayload(string $payload, string $aesKey): array
{
$json = openssl_decrypt(base64_decode($payload), 'AES-256-ECB', $aesKey, OPENSSL_RAW_DATA);
$data = json_decode($json, true);
if (!is_array($data)) {
throw new RuntimeException('Invalid decrypted payload.');
}
return $data;
}
Node.js
const crypto = require('crypto');
function encryptPayload(data, aesKey) {
const json = JSON.stringify(data);
const key = Buffer.from(aesKey, 'utf8').subarray(0, 32);
const cipher = crypto.createCipheriv('aes-256-ecb', key, null);
cipher.setAutoPadding(true);
return cipher.update(json, 'utf8', 'base64') + cipher.final('base64');
}
function decryptPayload(payload, aesKey) {
const key = Buffer.from(aesKey, 'utf8').subarray(0, 32);
const decipher = crypto.createDecipheriv('aes-256-ecb', key, null);
decipher.setAutoPadding(true);
const decrypted = decipher.update(payload, 'base64', 'utf8') + decipher.final('utf8');
return JSON.parse(decrypted);
}
API 1 — Get Game Launch URL
POST https://api.stargaming.network/game/v1
Top-level request:
{
"agency_uid": "YOUR_AGENCY_UID",
"timestamp": "1710000000000",
"payload": "AES256EncryptionResult"
}
Payload before encryption:
{
"agency_uid": "YOUR_AGENCY_UID",
"member_account": "YOUR_PREFIX_demo001",
"game_uid": "GAME_UID_HERE",
"credit_amount": "1000.00",
"currency_code": "BDT",
"language": "en",
"timestamp": "1710000000000",
"home_url": "https://yoursite.com/lobby",
"platform": 1,
"callback_url": "https://yoursite.com/callback.php"
}
Decrypted success payload contains game_launch_url.
API 5 — Provider List
No encryption required. Pass agency_uid as a query parameter.
GET https://api.stargaming.network/game/providers?agency_uid=YOUR_AGENCY_UID
Response fields typically include code, name, currency, lang, and status.
API 6 — Game List
No encryption required. Returns entitled games for your agency.
GET https://api.stargaming.network/game/list?agency_uid=YOUR_AGENCY_UID
Use returned game_uid values in the launch API.
Provider-scoped list calls may also accept a provider code query.
Bet callback essentials
The provider POSTs an encrypted payload to your callback_url.
- Decrypt with your AES key.
- Fields include serial_number, currency_code, game_uid, member_account, win_amount, bet_amount, timestamp, game_round.
- Respond with code 0 and an encrypted payload containing the updated
credit_amount and timestamp.
Common response codes
| Code |
Meaning |
| 0 | Success |
| 10002 | Agency not exist |
| 10004 | Payload error |
| 10005 | System error |
| 10008 | Game does not exist, inactive, or under maintenance |
| 10014 | Player name incorrect |
| 10025 | Insufficient wallet balance |
| 10030 | Too many requests |
| 10033 | home_url cannot contain ? |
| 10034 | System Maintenance |