Developer Documentation

ZankethStore
Reseller API

Deliver game top-ups instantly through our secure fulfilment platform. One POST request โ€” we handle queuing, balance checks, dispatch, and confirmation. Built for reseller integrations.

Base URLhttps://zankethstore.com/tg/api.php

๐Ÿ“กOverview

The ZankethStore Reseller API lets authorised developers trigger game top-ups via a single HTTP POST. You send the player ID and item code โ€” the API validates your key, checks balance, serialises through the queue, dispatches to the fulfilment system, waits for confirmation, deducts your balance, and returns structured JSON.

๐Ÿ’ก
Every response includes ok (boolean), status (machine-readable), message (human-readable), and data (payload). Always check ok first.

Request lifecycle

01POST
request
โ†’
02Auth &
balance
โ†’
03Queue
lock
โ†’
04Dispatch
command
โ†’
05Poll
reply
โ†’
06Deduct
balance
โ†’
07JSON
response
โš ๏ธ
Requests can take up to 90 seconds (queue wait + fulfilment). Always set your HTTP client timeout to at least 120 seconds.

๐Ÿ”‘Authentication

Include your API key on every request as a POST field or HTTP header.

MethodWhereExample
POST fieldRequest bodyapi_key=your-secret-key
HTTP HeaderRequest headersX-API-Key: your-secret-key
โ„น๏ธ
API keys are stored as SHA-256 hashes โ€” the raw key is never stored. If lost it cannot be recovered; request a new one from the admin.

Key properties

PropertyDescription
allowed_domainsComma-separated whitelist. Requests from unlisted origins โ†’ 403.
expires_atExpiry datetime. null = never expires.
rate_limitMax calls per 60-second window. 0 = unlimited.
balanceShell balance. Auto-deducted on each successful top-up.
is_activeAdmin can disable instantly. Disabled โ†’ 403.

โš™๏ธQueue System

Only one top-up dispatches at a time. This prevents fulfilment responses from being mixed up when multiple requests arrive simultaneously.

โ”€โ”€ No other requests running โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Row inserted โ†’ proceed immediately โ†’ dispatch โ†’ poll โ†’ done โ”€โ”€ Another request is already processing โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Row inserted โ†’ detects other row โ†’ wait (check every 2s) Other finishes at 30s โ†’ proceed immediately at 30s โ”€โ”€ Other request is stuck โ‰ฅ 60s (crash / timeout) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Stale row โ†’ mark as timeout โ†’ proceed immediately
โ„น๏ธ
Worst-case queue wait is 60 seconds (for a stale/crashed request). Normal wait = however long the active request takes โ€” often 5โ€“30 seconds. Set HTTP timeout to 120s minimum.

๐Ÿš€Top-Up Endpoint

POST/api.php

Validates balance, queues the request, dispatches to fulfilment, waits for confirmation, deducts balance, and returns the result.

Request parameters

ParameterTypeRequiredDescription
api_keystringREQUIREDReseller API key. Or use X-API-Key header.
player_idstringREQUIREDIn-game player ID to top up.
item_codestringREQUIREDItem to deliver (lowercase). See Item Codes.
quantityintegerOPTIONALUnits. Default: 1. Max: 99.

Success 200

json
{
  "ok": true, "status": "success",
  "message": "โœ… Top-up delivered successfully.",
  "data": {
    "queue_id": 1042, "product": "Weekly Pass",
    "shell_cost": 86, "balance_before": 5000, "balance_after": 4914,
    "shells_deducted": "86 SHELLS", "new_balance": "4914.00 SHELLS"
  }
}

Insufficient balance 402

json
{
  "ok": false, "status": "low_balance",
  "message": "Insufficient balance. Required: 86 SHELLS, Available: 40 SHELLS.",
  "data": { "queue_id": 1043, "required_shells": 86, "available_shells": 40 }
}

Failed / timeout 502

json
{
  "ok": false, "status": "failed",
  "message": "โš ๏ธ Top-up failed or timed out.",
  "data": { "queue_id": 1044, "debug_msgs": ["..."] }
}

๐Ÿ“ฆProducts Endpoint

GET/api.php?products

Returns the live product catalogue. No authentication required. Fetch this at startup to keep pricing in sync.

json
{
  "ok": true,
  "products": [
    { "item_code": "25",     "name": "25 Shells Pack",  "shell_cost": "13.00" },
    { "item_code": "weekly", "name": "Weekly Pass",     "shell_cost": "86.00" }
  ]
}

๐ŸฉบHealth Check

GET/api.php?test

Returns server health โ€” PHP version, DB connectivity, table existence, reseller count. No auth required. Use to diagnose integration issues before going live.

๐Ÿ”Player Verification

GET/api.php?verify&api_key=KEY&uid=UID&region=REGION

Looks up a player's username and profile before placing a top-up order. Requires a valid API key โ€” included free with all reseller accounts. The upstream verification service URL and credentials are never exposed.

Parameters

ParameterTypeRequiredDescription
api_keystringREQUIREDYour reseller API key.
uidstringREQUIREDIn-game player UID to look up.
regionstringOPTIONALServer region code (e.g. SG). Default: SG.

Success 200

json
{
  "ok": true,
  "status": "found",
  "data": {
    "username": "NLใ…คxPsสแด„สœแดโ˜‚",
    "uid":      "123456789",
    "region":   "SG"
  }
}
๐Ÿ’ก
Always verify the player UID before placing a top-up order. A wrong UID wastes shells with no recourse. Call this endpoint from your checkout page to confirm the player name before payment.

cURL example

bash
curl "https://zankethstore.com/tg/api.php?verify&api_key=your-key&uid=123456789®ion=SG"

PHP example

php
$res = json_decode(file_get_contents(
    'https://zankethstore.com/tg/api.php?verify'
    .'&api_key=your-key'
    .'&uid=' . urlencode($playerId)
    .'®ion=SG'
), true);

if ($res['ok']) {
    echo "Player: " . $res['data']['username'];
} else {
    echo "Not found: " . $res['message'];
}

๐ŸŽฎItem Codes

Pass item_code exactly as shown (lowercase). Total shell cost = shell_cost ร— quantity.

Shell packs

item_codeNameShell Cost / unit
2525 Shells Pack13 SHELLS
100100 Shells Pack50 SHELLS
310310 Shells Pack152 SHELLS
520520 Shells Pack254 SHELLS
10601,060 Shells Pack500 SHELLS
21802,180 Shells Pack1,010 SHELLS
56005,600 Shells Pack2,500 SHELLS
1150011,500 Shells Pack5,150 SHELLS

Passes & subscriptions

item_codeNameShell Cost / unit
liteLite Pass18 SHELLS
weeklyWeekly Pass86 SHELLS
monthlyMonthly Pass430 SHELLS

Evo passes

item_codeNameShell Cost / unit
evo3Evo 3-Day Pass30 SHELLS
evo7Evo 7-Day Pass45 SHELLS
evo30Evo 30-Day Pass135 SHELLS
๐Ÿ’ก
Always call GET /api.php?products at startup to get live pricing. Admin can update prices at any time.

โšกError Codes

All errors return JSON with "ok": false. Use the status field for programmatic handling.

HTTP
status
Cause & fix
400
missing_player
missing_item
Required POST field missing.
401
missing_key
invalid_key
Key absent or unknown. Visit ?checkkey=YOUR_KEY to diagnose.
403
disabled
key_expired
domain_blocked
Account disabled, key expired, or origin not whitelisted.
402
low_balance
Shell balance too low. Response includes required_shells and available_shells.
429
rate_limited
Too many requests in 60s. Slow down or ask admin to raise limit.
500
processing_error
db_error
Server error. Contact admin with your queue_id.
502
failed
Fulfilment failed or timed out. Check debug_msgs and retry.

๐Ÿ›ก๏ธSecurity

Key Hashing

Raw keys never stored. Only SHA-256 hashes in DB.

Domain Whitelist

Each key locked to approved domains. Unknown origins โ†’ 403.

Balance Guard

Shell balance checked before dispatch. Orders that would overdraft โ†’ 402.

Queue Lock

Only one fulfilment runs at a time. Prevents mixed responses.

Key Expiry

Every key has an expiry date. Expired โ†’ 403. Renew via admin panel.

Audit Log

Every call logged to api_call_log with IP, domain, status, timestamp.

๐Ÿšจ
Never expose your API key in client-side JavaScript or public repos. All calls must come from your server backend, not from browsers.

โฑRate Limits

Sliding 60-second window per API key. Exceeding the limit โ†’ 429.

PlanLimitUse case
Standard30 / minModerate traffic
High-volume60 / minBusy storefronts
Unlimited0 (none)Trusted internal systems
โš ๏ธ
Do not send concurrent requests from the same key. Each request waits in the queue โ€” concurrent calls all count against the rate limit while waiting.

๐Ÿ˜PHP

php
<?php
$ch = curl_init();
curl_setopt_array($ch, [
    CURLOPT_URL            => 'https://zankethstore.com/tg/api.php',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST           => true,
    CURLOPT_TIMEOUT        => 120,
    CURLOPT_POSTFIELDS     => http_build_query([
        'api_key'   => 'your-reseller-api-key',
        'player_id' => '123456789',
        'item_code' => 'weekly',
        'quantity'  => 1,
    ]),
]);
$res = json_decode(curl_exec($ch), true);
curl_close($ch);

if ($res['ok']) {
    echo "โœ… Cost: " . $res['data']['shell_cost'] . " | Balance: " . $res['data']['balance_after'];
} elseif ($res['status'] === 'low_balance') {
    echo "โŒ Need: ".$res['data']['required_shells']." | Have: ".$res['data']['available_shells'];
} else {
    echo "โŒ " . $res['message'];
}

๐ŸŸจJavaScript (Node.js)

javascript
const axios = require('axios');

async function topUp(playerId, itemCode, qty = 1) {
  const { data } = await axios.post(
    'https://zankethstore.com/tg/api.php',
    new URLSearchParams({ api_key: 'your-key', player_id: playerId, item_code: itemCode, quantity: qty }).toString(),
    { headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, timeout: 120000 }
  );
  if (data.ok) console.log(`โœ… Cost: ${data.data.shell_cost} | Balance: ${data.data.balance_after}`);
  else if (data.status === 'low_balance') console.error(`โŒ Need ${data.data.required_shells}, have ${data.data.available_shells}`);
  else console.error(`โŒ ${data.message}`);
  return data;
}

๐ŸPython

python
import requests

def top_up(player_id, item_code, quantity=1):
    data = requests.post(
        'https://zankethstore.com/tg/api.php',
        data={'api_key': 'your-key', 'player_id': player_id,
              'item_code': item_code, 'quantity': quantity},
        timeout=120
    ).json()
    if data['ok']:
        print(f"โœ… Cost: {data['data']['shell_cost']} | Balance: {data['data']['balance_after']}")
    elif data['status'] == 'low_balance':
        print(f"โŒ Need {data['data']['required_shells']}, have {data['data']['available_shells']}")
    else:
        print(f"โŒ {data['message']}")
    return data

๐Ÿ–ฅcURL

bash
# Top-up
curl -X POST https://zankethstore.com/tg/api.php \
  --max-time 120 \
  -d "api_key=your-key" \
  -d "player_id=123456789" \
  -d "item_code=weekly" \
  -d "quantity=1"

# Live product list
curl https://zankethstore.com/tg/api.php?products

# Health check
curl https://zankethstore.com/tg/api.php?test

# Diagnose key
curl https://zankethstore.com/tg/api.php?checkkey=your-raw-key

โš™๏ธKey Management

Create and manage keys from the Admin Panel at /admin.php or via the CLI script.

bash
# List resellers
php reseller_admin.php list

# Create (prints key ONCE โ€” save immediately)
php reseller_admin.php add "Shop Name" "shop.com" 365 60

# Disable / enable
php reseller_admin.php revoke 3
php reseller_admin.php enable 3

# History & stats
php reseller_admin.php history 3
php reseller_admin.php stats
โš ๏ธ
The raw API key is shown once only at creation. Only its SHA-256 hash is stored. Copy it immediately.

๐Ÿ—„๏ธDatabase

Run api_schema.sql once to create all tables. Safe to re-run.

resellers

ColumnTypeNotes
api_keyVARCHAR(64)SHA-256 hash of raw key
balanceDECIMAL(10,2)Auto-deducted on success. Top up via admin.
allowed_domainsTEXTComma-separated whitelist
rate_limitSMALLINTCalls/min. 0 = unlimited

products

ColumnTypeNotes
item_codeVARCHAR(60)Unique, lowercase. Matches API item_code
shell_costDECIMAL(10,2)Cost per unit checked against reseller balance
is_activeTINYINT(1)Inactive items โ†’ missing_item error

api_queue

ColumnNotes
idReturned as queue_id in all responses
reseller_idNULL for internal orders (manual/wallet/instant)
statuspending โ†’ processing โ†’ success | failed | timeout
origin_domainmanual / instant / wallet / reseller domain
Built by
Need a website
like this?

ZankethStore was built by IdeaFlow โ€” a Sri Lankan web development studio specialising in game top-up platforms, reseller portals, payment integrations, and custom business software.

Top-up Portals Reseller Systems Payment Integrations API Development Admin Dashboards Custom Web Apps
Visit ideaflow.lk