Merchant API

Integrate GameHub into your player-facing site.

Base URL

https://your-domain.com/api/public/v1

Authentication

Every request is a JSON POST with these top-level fields:

Method strings: launchgame, gamelist, playerbalance, wagerlist.

Node sample

import { createHash } from "crypto";

const OP = "YOUR_OP_CODE";
const SECRET = "YOUR_SECRET_KEY";
const t = Math.floor(Date.now()/1000).toString();

function sign(method) {
  return createHash("md5").update(OP + t + method + SECRET).digest("hex");
}

const res = await fetch("https://your-domain.com/api/public/v1/game/launch", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    operator_code: OP,
    request_time: t,
    sign: sign("launchgame"),
    member_account: "player123",
    product_code: "PR-SLOT",
    game_code: "moreturkeyv10000",
    language: "en",
  }),
});
console.log(await res.json());

PHP sample

$op = "YOUR_OP_CODE";
$secret = "YOUR_SECRET_KEY";
$t = (string) time();
$sign = md5($op . $t . "launchgame" . $secret);
$body = json_encode(compact("op","t","sign") + [
  "operator_code" => $op, "request_time" => $t, "sign" => $sign,
  "member_account" => "player123", "product_code" => "PR-SLOT",
]);
$ch = curl_init("https://your-domain.com/api/public/v1/game/launch");
curl_setopt_array($ch, [CURLOPT_POST=>1, CURLOPT_POSTFIELDS=>$body,
  CURLOPT_HTTPHEADER=>["Content-Type: application/json"], CURLOPT_RETURNTRANSFER=>1]);
echo curl_exec($ch);

Endpoints

POST/game/launchmethod = launchgame
Request body
{ "member_account": "player123", "product_code": "PR-SLOT", "game_code": "moreturkeyv10000", "language": "en" }
Response
{ "code": 0, "data": { "url": "https://..." } }
POST/game/listmethod = gamelist
Request body
{ }
Response
{ "code": 0, "data": [{ "product_code": "PR-SLOT", "game_code": "...", "game_name": "..." }] }
POST/player/balancemethod = playerbalance
Request body
{ "member_account": "player123" }
Response
{ "code": 0, "member_account": "player123", "balance": 1250.0000, "currency": "USD" }
POST/wager/listmethod = wagerlist
Request body
{ "start_time": 1730000000, "end_time": 1730100000, "page": 1, "size": 100 }
Response
{ "code": 0, "total": 42, "page": 1, "size": 100, "data": [ ... ] }

Response codes

CodeMeaning
0OK
1Internal error
2Member not found
3Insufficient balance
4Duplicate transaction
5Invalid signature
6Invalid operator

Wallet flow

When a player launches a game, GameHub relays wallet operations to your player's balance automatically. You do not implement any callback — bets and wins settle in real time inside GameHub against your merchant credit.