How to Integrate JILI Games via API in PHP (2026)

Updated October 2026 · 9 min read

JILI is one of the most requested slot studios in Asia — Fortune Gems, Super Ace, Golden Empire and the rest of the catalog are staples on operator sites from Bangladesh to the Philippines. Studios like JILI sell to licensed platforms and aggregators, not to small sites directly, so in practice the fastest way to run JILI games on your own website is through a game aggregator API: one REST endpoint set, one wallet contract, thousands of games — JILI included.

This tutorial shows the complete PHP flow against GamingAPI (casinoapi.shop): list the catalog, launch a JILI game for a real-money player, and handle the bet/win callbacks that keep your wallet in sync. Every snippet is production-shaped — signature checks, idempotency and delta-only balance updates included.

1. What you need first

  • An API token and secret from your provider's client panel.
  • A fixed play currency for your account (e.g. BDT, INR, USD).
  • Your server's public IP on the provider's whitelist.
  • An HTTPS callback URL your server will receive bet/win events on.

GamingAPI charges a $350 one-time setup fee plus 10% of positive GGR, with a free sandbox key — you can build and test the whole flow before your account goes live.

2. Find the JILI games

Pull the catalog and filter by brand. Every game row carries an external_uid, which is the game_uid you launch with:

<?php
$token = 'YOUR_TOKEN';
$games = [];
$offset = 0;
do {
  $url = "https://casinoapi.shop/api/public/v1/games?token=$token&limit=500&offset=$offset";
  $res = json_decode(file_get_contents($url), true);
  if (($res['code'] ?? 1) !== 0) break;
  $batch = $res['data']['games'] ?? [];
  foreach ($batch as $g) {
    if (stripos($g['provider'] ?? '', 'jili') !== false) {
      $games[$g['external_uid']] = $g; // game name, thumbnail, rtp...
    }
  }
  $offset += count($batch);
} while (count($batch) === 500);

// Store $games in your own table so your lobby can render JILI titles.

3. Launch a game from your server

The launch call happens server-side: authenticate your player, read the wallet balance from your database, then ask the API for a game URL. Never put your token in the browser.

<?php
// launch.php — called by your own frontend via AJAX/fetch
$in = json_decode(file_get_contents('php://input'), true);
$userId = $in['user_id'] ?? null;          // from YOUR auth session
$gameCode = $in['game_uid'] ?? null;       // external_uid from step 2
if (!$userId || !$gameCode) { http_response_code(400); exit; }

// Read the real balance from your own DB:
$stmt = $pdo->prepare('SELECT balance FROM wallets WHERE user_id = ?');
$stmt->execute([$userId]);
$balance = (float)($stmt->fetchColumn() ?: 0);

$payload = [
  'token'         => API_TOKEN,
  'user_id'       => (string)$userId,   // digits only, unique per player
  'balance'       => $balance,
  'game_uid'      => $gameCode,
  'currency_code' => 'BDT',             // must match your account currency
  'language'      => 'en',
  'return'        => 'https://your-casino.com/lobby',
];

$ch = curl_init('https://casinoapi.shop/api/public/v1/launch');
curl_setopt_array($ch, [
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_POST           => true,
  CURLOPT_HTTPHEADER     => ['Content-Type: application/json'],
  CURLOPT_POSTFIELDS     => json_encode($payload),
  CURLOPT_TIMEOUT        => 30,
]);
$r = json_decode(curl_exec($ch), true);
curl_close($ch);

echo json_encode(['url' => $r['data']['url'] ?? null, 'session_id' => $r['data']['session_id'] ?? null]);

Open the returned url in an iframe or redirect the player to it. Save the session_id — it identifies the session in support queries and exit sync.

4. Handle the bet/win callbacks

Before a launch the provider POSTs verify_player; after every bet and win it POSTs a round event to your callback URL. Each request is signed with X-Signature: HMAC-SHA256(raw_body, your_secret). Three rules keep the wallet correct:

  • Verify the signature — reject anything unsigned.
  • Idempotency — callback_id is stable across retries; the same event must never move money twice.
  • Delta only — apply wallet = wallet − bet_amount + win_amount; never SET the wallet from a payload field.
<?php
// callback.php
$raw  = file_get_contents('php://input');
$data = json_decode($raw, true);

$secret = API_SECRET; // from your client panel, next to the token
$expected = hash_hmac('sha256', $raw, $secret);
if (!hash_equals($expected, $_SERVER['HTTP_X_SIGNATURE'] ?? '')) {
  http_response_code(401); exit;
}

if (($data['event'] ?? '') === 'verify_player') {
  $stmt = $pdo->prepare('SELECT balance FROM wallets WHERE user_id = ?');
  $stmt->execute([$data['member_account']]);
  $b = (float)($stmt->fetchColumn() ?: 0);
  header('Content-Type: application/json');
  echo json_encode(['code' => 0, 'msg' => 'Success', 'balance' => $b]);
  exit;
}

$serial = $data['callback_id'] ?? null;
if (!$serial) { http_response_code(400); exit; }

// Idempotency: a retried event returns success without moving money.
$stmt = $pdo->prepare('SELECT 1 FROM api_rounds WHERE serial = ?');
$stmt->execute([$serial]);
if ($stmt->fetch()) {
  header('Content-Type: application/json');
  $stmt2 = $pdo->prepare('SELECT balance FROM wallets WHERE user_id = ?');
  $stmt2->execute([$data['member_account']]);
  echo json_encode(['code' => 0, 'balance' => (float)($stmt2->fetchColumn() ?: 0)]);
  exit;
}

$bet = (float)($data['bet_amount'] ?? 0);
$win = (float)($data['win_amount'] ?? 0);

$pdo->beginTransaction();
try {
  $pdo->prepare('INSERT INTO api_rounds (serial, player, bet, win, game_uid, created_at)
                 VALUES (?, ?, ?, ?, ?, NOW())')
      ->execute([$serial, $data['member_account'], $bet, $win, $data['game_uid'] ?? null]);
  $stmt = $pdo->prepare('UPDATE wallets SET balance = balance - ? + ? WHERE user_id = ?');
  $stmt->execute([$bet, $win, $data['member_account']]);
  $new = $pdo->prepare('SELECT balance FROM wallets WHERE user_id = ?');
  $new->execute([$data['member_account']]);
  $balance = (float)$new->fetchColumn();
  $pdo->commit();
} catch (Throwable $e) {
  $pdo->rollBack();
  http_response_code(500); exit;
}

header('Content-Type: application/json');
echo json_encode(['code' => 0, 'balance' => $balance]);

5. Go live

  • Test with the free sandbox key first — it returns the same callback payloads without touching money.
  • Confirm your callback URL answers HTTP 200 in under a second; slow endpoints get retried and rate-limited hosts start failing.
  • Use the /api/public/v1/session?token=...&user_id=... exit-sync endpoint to verify the balance on your return page — but never re-add money there; every bet/win was already applied.

The same pattern works for every other studio on the aggregator — Pragmatic Play, PG Soft, Fa Chai and more — because the launch and callback contract is identical across providers. That is the whole point of using a casino API instead of one studio's direct integration.

Want the copy-paste package? A complete PHP, Node.js and Python integration kit is available from GamingAPI — see the Casino API Documentation Guide or request the ready-made handler from your account manager.