Complete integration guide with ready-to-use PHP functions and examples
Easy Steps
API Endpoints
Secure
Get started in 3 easy steps
Lightning fast 20-40ms response times ensuring smooth gameplay for your users.
Imagine you own a gaming website called PlayZone. A user named Jhon logs into your site and clicks on “Play Sweet Magic”. Now your website needs to open that game from another company — let’s say the game provider is JILI.
But the provider won’t just open the game directly. They need some important information first — who is playing, how much balance they have, and what game they want to play.
So, your website sends a secure request to the SoftAPI server using their Launch Game API.
Imagine you own a gaming website called PlayZone. A user named Jhon logs into your site and clicks on “Play Sweet Magic”. Now your website needs to open that game from another company — let’s say the game provider is JILI.
But the provider won’t just open the game directly. They need some important information first — who is playing, how much balance they have, and what game they want to play.
So, your website sends a secure request to the SoftAPI server using their Launch Game API.
| Parameter | Meaning | Example |
|---|---|---|
| user_id | The unique ID of the player | 101 |
| balance | The player's wallet balance | 500 |
| game_uid | A unique ID for this game session | 784512 |
| token | Your API token (provided by SoftAPI) | 3dfu98r2q3x |
| timestamp | Current time (in milliseconds) | 1696329392000 |
| return | URL where the user returns after playing | https://playzone.com/return |
| callback | URL where the game sends result | https://playzone.com/callback.php |
| currency_code | (Optional) Currency code for the game | BDT |
| language | (Optional) Language code for the game interface | bn |
Once your site collects these details, it encrypts them using a special PHP function called ENCRYPT_PAYLOAD_ECB(). This turns your readable information (like user ID and balance) into a secret code that only SoftAPI can read. You then send this encrypted data to the SoftAPI launch endpoint — https://igamingapis.live/api/v1 — along with your token. The API checks the data, decrypts it using your secret key, and then returns a game URL in the response.
<?php
// === Example: Launch Game via SoftAPI ===
// Step 1️⃣: Set your API credentials (from your SoftAPI account)
$TOKEN = “3dfu98r2q3x”; // Your unique API token
$SECRET = “12345678901234567890123456789012”; // 32-character secret key
// Step 2️⃣: Game details & player info
$SERVER_URL = “https://igamingapis.live/api/v1”; // API endpoint
$RETURN_URL = “https://playzone.com/return”; // After game ends
$CALLBACK_URL = “https://playzone.com/callback.php”; // Game result callback
$USER_ID = 101; // Player ID
$BALANCE = 500; // Player wallet balance
$GAME_UID = 784512; // Unique game session ID
// Step 3️⃣: Encrypt data using AES-256-ECB
function ENCRYPT_PAYLOAD_ECB(array $DATA, string $KEY): string {
if (strlen($KEY) !== 32) throw new Exception(“Key must be 32 bytes long”);
$JSON = json_encode($DATA, JSON_UNESCAPED_UNICODE);
$ENC = openssl_encrypt($JSON, “AES-256-ECB”, $KEY, OPENSSL_RAW_DATA);
return base64_encode($ENC);
}
// Step 4️⃣: Prepare the data payload
$PAYLOAD = [
“user_id” => $USER_ID,
“balance” => $BALANCE,
“game_uid” => $GAME_UID,
“token” => $TOKEN,
“timestamp” => round(microtime(true) * 1000), // current time in ms
“return” => $RETURN_URL,
“callback” => $CALLBACK_URL
// Optional parameters (can be omitted):
// “currency_code” => “BDT”, // Optional: Currency code
// “language” => “bn” // Optional: Language code
];
// Step 5️⃣: Encrypt it
$ENCRYPTED = ENCRYPT_PAYLOAD_ECB($PAYLOAD, $SECRET);
// Step 6️⃣: Send it to the SoftAPI server
$URL = $SERVER_URL . “?payload=” . urlencode($ENCRYPTED) . “&token=” . urlencode($TOKEN);
$CH = curl_init($URL);
curl_setopt($CH, CURLOPT_RETURNTRANSFER, true);
$RESPONSE = curl_exec($CH);
curl_close($CH);
// Step 7️⃣: Decode the response
$DATA = json_decode($RESPONSE, true);
// Step 8️⃣: Show the result
if ($DATA[“code”] == 0) {
echo “✅ Game launched successfully!<br>”;
echo “🎮 Game URL: ” . $DATA[“data”][“url”];
} else {
echo “❌ Error: ” . $DATA[“msg”];
}
?>
Process game results from our server
After a player finishes a game, the game provider (SoftAPI / JILI) automatically sends a callback to your server to report the results of the game session. For example, imagine a user named Jhon plays “Sweet Magic” on your website PlayZone. He bets ₹50 and wins ₹30. The game server sends a secure message to your callback.php script with details like the game session ID, round ID, player account, bet amount, win amount, and timestamp. Your server receives this data, calculates the net credit (bet minus win), updates the user’s wallet accordingly, and logs the result in the database. It then responds back to the game server with a JSON object containing the credit_amount and timestamp. This automatic callback process ensures that the player’s balance is always accurate, the game results are secure and tamper-proof, and no manual intervention is needed. Essentially, your site acts like a real-time referee: it receives the game outcome, verifies it, updates the player’s account, and confirms back to the provider — keeping the whole process smooth, secure, and reliable.
{
"game_uid": "3978",
"game_round": "12928475122950747877",
"member_account": "23213",
"bet_amount": 1,
"win_amount": 0,
"timestamp": "2025-10-14 16:41:45"
} Update user balance and save transaction
The game server sends a callback after each bet or win with details like user ID, bet amount, win amount, and game round. Your system receives this data, updates the player’s wallet (subtract bet, add win), and logs the bet in your database for history and tracking.
<?php
header(‘Content-Type: application/json; charset=utf-8’);
date_default_timezone_set(‘Asia/Kolkata’);
$data = json_decode(file_get_contents(‘php://input’), true);
if (!$data) {
exit(json_encode([
‘credit_amount’ => -1,
‘error’ => ‘Invalid JSON 无效JSON’
]));
}
$game_uid = $data[‘game_uid’] ?? ”;
$game_round = $data[‘game_round’] ?? ”;
$member_account = $data[‘member_account’] ?? ”;
$bet_amount = (float)($data[‘bet_amount’] ?? 0);
$win_amount = (float)($data[‘win_amount’] ?? 0);
$round_time = $data[‘timestamp’] ?? ”;
$credit = max(0, $bet_amount – $win_amount); // Credit 积分 = bet – win, 最少0
echo json_encode([
‘credit_amount’ => $credit,
‘timestamp’ => round(microtime(true) * 1000)
]);
?>
Start a game session for your users
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
| user_id | string | Yes | Unique user ID in your system | 23213 |
| balance | number | Yes | User's current balance | 40 |
| game_uid | string | Yes | Unique ID for this game session | 3978 |
| token | string | Yes | Your API token | tptogkzf1sbmrmolhdpebzxvkxfsbekq |
| timestamp | number | Yes | Current timestamp in milliseconds | 1696329392000 |
| return | string | Yes | Return URL after game closes | https://google.com/return |
| callback | string | Yes | Callback URL for game results | https://yourdomain.com/callback.php |
| currency_code | string | Optional | Currency code (e.g., BDT, USD, INR). Code will work without this parameter. | BDT |
| language | string | Optional | Language code (e.g., bn, en, hi). Code will work without this parameter. | bn |
Process game results and update balances
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
| game_uid | string | Yes | Unique game session ID | 8c62471fd4e28c084a61811a3958f7a1 |
| game_round | string | Yes | Unique round identifier | 1749249388580530850 |
| member_account | string | Yes | User account ID | 123235 |
| bet_amount | number | Yes | Amount the user bet | 3 |
| win_amount | number | Yes | Amount the user won | 0 |
| timestamp | string | Yes | Time of the round | 2025-10-01 17:15:47 |
The world’s most advanced iGaming API solution. Connect to 100+ providers and 15,000+ games with a single integration.