Reseller API
Sell AnaJak Store game top-ups from your own website, app or Telegram bot. Orders are paid from your balance at reseller prices and delivered automatically.
https://api.anajak-store.com/v1
Getting started
- 1Get a reseller account. Ask us to make your account a reseller account. Resellers see reseller prices on the whole site and in the API.
- 2Create an API key in My account › Reseller API, and add your server's IP to the whitelist.
- 3Add balance with a deposit. Every API order is paid from your balance.
- 4Call the API: list products with
/service, order with/order, follow it with/statusor a webhook.
Authentication
Send your API key with every request. The X-API-Key header is recommended. Authorization: Bearer <key> and an api_key field in the body also work.
Request bodies can be JSON (Content-Type: application/json) or form fields. All endpoints accept POST; /service, /status and /balance also accept GET with query parameters.
curl -X POST https://api.anajak-store.com/v1/balance \
-H "X-API-Key: YOUR_API_KEY"
Responses & errors
Every response is JSON with the same shape. Check status first.
// success (HTTP 200)
{
"status": true,
"msg": "Success",
"data": { ... }
}
// error (HTTP 4xx / 5xx)
{
"status": false,
"code": "insufficient_balance",
"msg": "Insufficient balance. Required: $1.50, available: $0.20",
"data": []
}
| HTTP | code | Meaning |
|---|---|---|
| 401 | missing_api_key | No key sent. |
| 401 | invalid_api_key | Wrong, regenerated or revoked key. |
| 403 | not_reseller | The account is not a reseller account. |
| 403 | ip_not_allowed | Your server's IP is not in the key's whitelist. The message shows the IP we saw. |
| 422 | missing_field, invalid_idtrx, invalid_target, invalid_callback, ambiguous_product | A parameter is missing or wrong. Read msg. |
| 422 | service_unavailable | This product can't be delivered right now. Try later or another product. |
| 402 | insufficient_balance | Not enough balance. Nothing was charged. |
| 404 | service_not_found, order_not_found | Unknown or inactive product, or an order that isn't yours. |
| 409 | duplicate_idtrx | This idtrx was already used. Nothing was charged. |
| 429 | rate_limited | Too many requests. See rate limits. |
| 502 | dispatch_failed | The supplier refused the order. Your balance was refunded. |
/serviceList games, products and Premium Accounts
Everything you can sell: all games with their products, and all Premium Accounts with their plans. Each game, product and plan comes with our image (full https URLs you can show in your shop) and your price (reseller_price, USD). Cache it for a few minutes instead of calling it before every order.
| Parameter | Type | Description | |
|---|---|---|---|
type | string | optional | all (default), game or premium. |
gamecode | string | optional | Only one game, e.g. mobilelegend (the game's code, or the slug from its page URL such as mlbb-kh). premium = only Premium Accounts. |
curl -X POST https://api.anajak-store.com/v1/service \
-H "X-API-Key: YOUR_API_KEY" \
-d "gamecode=mlbb-kh"
Response
{
"status": true,
"msg": "Successfully retrieved service data",
"data": {
"games": [
{
"gamecode": "mobilelegend",
"slug": "mlbb-kh",
"name": "MLBB KH",
"image": "https://anajak-store.com/uploads/games/custom-mlbb-kh.webp",
"url": "https://anajak-store.com/game/mlbb-kh",
"requires_zone": true,
"products": [
{
"productscode": "2794",
"service_name": "86 Diamonds",
"image": "https://anajak-store.com/uploads/pkg-icons/6179f4419b383dc563d9.png",
"price": 1.45,
"reseller_price": 1.38,
"needs_target": true,
"status": "active"
}
]
}
],
"premium": [
{
"gamecode": "premium",
"slug": "canva-pro",
"name": "Canva Pro",
"category": "Design",
"image": "https://anajak-store.com/uploads/premium/products/d8mlprmhw2v6vexuei0upn11hilk1zn1fvqfhrht.webp",
"url": "https://anajak-store.com/premium/canva-pro",
"description": "Canva Pro",
"products": [
{
"productscode": "premium-1",
"service_name": "Canva Pro - 1Years",
"duration": null,
"image": "https://anajak-store.com/uploads/premium/products/d8mlprmhw2v6vexuei0upn11hilk1zn1fvqfhrht.webp",
"price": 3.85,
"reseller_price": 3.85,
"needs_target": false,
"requires_email": true,
"stock": "In stock",
"status": "active"
}
]
}
],
"counts": { "games": 1, "game_products": 1, "premium": 1, "premium_products": 1 }
}
}
image- Our picture for the game, product or plan. Always a full https URL (or
null). price- Normal shop price.
reseller_price- What an order costs you.
requires_zone- The game needs a zone/server: send
targetasID|Zone. needs_targetfalsefor products that need no player ID (ROS invite passes, which return alicense_code, and all Premium Accounts).requires_email- Premium plan that is activated on the customer's email: send
emailwith the order.
/orderPlace an order
Charges reseller_price to your balance and sends the top-up to the player, or buys the Premium Account plan. If the supplier refuses the order straight away, the money goes back to your balance at once.
| Parameter | Type | Description | |
|---|---|---|---|
productscode | string | required | From /service, e.g. 2794, or premium-1 for a Premium Account plan. |
gamecode | string | required | From /service (premium for Premium Accounts). Product codes are only unique inside a game. |
target | string | required* | Player ID. For games with requires_zone use ID|Zone, e.g. 12345678|2001. *Not needed when needs_target is false. |
email | string | premium* | The customer's email. *Required for Premium plans with requires_email. |
idtrx | string | optional | Your own unique order ID (letters, digits, . _ -, max 64). Strongly recommended: if your request times out, retry with the same idtrx and you will get duplicate_idtrx instead of a second charge. Generated for you when left out. |
callback | URL | optional | Public http(s) URL that receives a webhook when the order finishes. |
contact | string | optional | Your customer's phone or note, for your own records (max 100). |
curl -X POST https://api.anajak-store.com/v1/order \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"productscode": "2794",
"gamecode": "mobilelegend",
"target": "12345678|2001",
"idtrx": "SHOP-10001",
"callback": "https://your-site.com/anajak/callback"
}'
$ch = curl_init('https://api.anajak-store.com/v1/order');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 60,
CURLOPT_HTTPHEADER => [
'X-API-Key: ' . getenv('ANAJAK_API_KEY'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'productscode' => '2794',
'gamecode' => 'mobilelegend',
'target' => '12345678|2001',
'idtrx' => 'SHOP-10001',
]),
]);
$res = json_decode(curl_exec($ch), true);
if ($res['status'] ?? false) {
echo "Order {$res['data']['id']} is {$res['data']['status']}";
} else {
echo "Error {$res['code']}: {$res['msg']}";
}
const res = await fetch('https://api.anajak-store.com/v1/order', {
method: 'POST',
headers: {
'X-API-Key': process.env.ANAJAK_API_KEY,
'Content-Type': 'application/json',
},
body: JSON.stringify({
productscode: '2794',
gamecode: 'mobilelegend',
target: '12345678|2001',
idtrx: 'SHOP-10001',
}),
});
const json = await res.json();
if (json.status) console.log(`Order ${json.data.id} is ${json.data.status}`);
else console.error(`Error ${json.code}: ${json.msg}`);
import os, requests
r = requests.post(
"https://api.anajak-store.com/v1/order",
headers={"X-API-Key": os.environ["ANAJAK_API_KEY"]},
json={
"productscode": "2794",
"gamecode": "mobilelegend",
"target": "12345678|2001",
"idtrx": "SHOP-10001",
},
timeout=60,
)
res = r.json()
if res["status"]:
print("Order", res["data"]["id"], "is", res["data"]["status"])
else:
print("Error", res["code"], res["msg"])
Response
{
"status": true,
"msg": "Order placed successfully. It is being processed.",
"data": {
"id": "SHOP-10001",
"type": "game",
"service_name": "86 Diamonds",
"productscode": "2794",
"gamecode": "mobilelegend",
"target": "12345678|2001",
"contact": "",
"status": "processing",
"price": 1.38,
"balance": 48.62
}
}
Premium Account plan
Premium plans are usually delivered within the request: the response already has "status": "success" and the account details in delivery. If it says processing, check /status later.
curl -X POST https://api.anajak-store.com/v1/order \
-H "X-API-Key: YOUR_API_KEY" \
-d "gamecode=premium" \
-d "productscode=premium-1" \
-d "[email protected]" \
-d "idtrx=SHOP-10002"
{
"status": true,
"msg": "Order delivered.",
"data": {
"id": "SHOP-10002",
"type": "premium",
"service_name": "Canva Pro Canva Pro - 1Years",
"status": "success",
"price": 3.85,
"balance": 44.77,
"delivery": {
"items": [
{ "label": "Email", "value": "[email protected]" },
{ "label": "Password", "value": "••••••••" }
],
"note": "How to log in…"
}
}
}
/statusOrder status
Current status of one of your orders. Polling every 10–30 seconds is fine; a webhook is better.
| Parameter | Type | Description | |
|---|---|---|---|
order_id | string | required | The id from /order (your idtrx). |
curl -X POST https://api.anajak-store.com/v1/status \
-H "X-API-Key: YOUR_API_KEY" \
-d "order_id=SHOP-10001"
{
"status": true,
"msg": "Status retrieved successfully",
"data": {
"id": "SHOP-10001",
"type": "game",
"status": "success",
"note": "Delivered",
"service_name": "86 Diamonds",
"target": "12345678|2001",
"price": 1.38,
"license_code": null,
"created_at": "2026-11-21T10:15:02+07:00"
}
}
license_code is filled in for products that deliver a code instead of topping up a player (for example ROS invite passes), once the order is success. For Premium Accounts ("type": "premium") the account details are in delivery (same format as in /order) once the order is success.
/balanceBalance
curl -X POST https://api.anajak-store.com/v1/balance \
-H "X-API-Key: YOUR_API_KEY"
{
"status": true,
"msg": "Success",
"data": { "balance": 48.48, "currency": "USD" }
}
Order statuses
| status | Meaning | Final? |
|---|---|---|
| pending | Accepted, not sent to the supplier yet. | No |
| processing | Sent to the supplier, waiting for delivery. | No |
| success | Delivered to the player (or license_code ready). | Yes |
| failed | Could not be delivered. If you were charged, the amount goes back to your balance and the status becomes refund. | Yes |
| refund | Not delivered; the price is back in your balance. | Yes |
Webhooks
If you sent a callback URL with the order, we POST JSON to it once the order reaches a final state: success, or failed (also sent for refunded orders). Answer with any HTTP 2xx.
POST https://your-site.com/anajak/callback
Content-Type: application/json
X-Signature: 3f1c…e9
{
"id": "SHOP-10001",
"trx_id": "SHOP-10001",
"note": "Delivered",
"status": "success",
"license_code": null,
"callback_url": "https://your-site.com/anajak/callback"
}
X-Signature = sha256(raw_body + api_key), as a lowercase hex string. Compute it over the raw request body exactly as received, and reject the request if it doesn't match. If you regenerate your key, webhooks for older orders are signed with the new key.$body = file_get_contents('php://input');
$expected = hash('sha256', $body . getenv('ANAJAK_API_KEY'));
if (!hash_equals($expected, $_SERVER['HTTP_X_SIGNATURE'] ?? '')) {
http_response_code(401);
exit;
}
$event = json_decode($body, true);
// mark order $event['id'] as $event['status']
http_response_code(200);
import crypto from 'node:crypto';
import express from 'express';
const app = express();
app.post('/anajak/callback', express.raw({ type: '*/*' }), (req, res) => {
const expected = crypto.createHash('sha256')
.update(Buffer.concat([req.body, Buffer.from(process.env.ANAJAK_API_KEY)]))
.digest('hex');
const got = req.get('X-Signature') || '';
if (got.length !== expected.length ||
!crypto.timingSafeEqual(Buffer.from(got), Buffer.from(expected))) {
return res.sendStatus(401);
}
const event = JSON.parse(req.body);
// mark order event.id as event.status
res.sendStatus(200);
});
import hashlib, hmac, os
from flask import Flask, request, abort
app = Flask(__name__)
@app.post("/anajak/callback")
def anajak_callback():
body = request.get_data()
expected = hashlib.sha256(body + os.environ["ANAJAK_API_KEY"].encode()).hexdigest()
if not hmac.compare_digest(expected, request.headers.get("X-Signature", "")):
abort(401)
event = request.get_json()
# mark order event["id"] as event["status"]
return "", 200
Rate limits
- 120 requests per minute per API key, and 240 per IP address.
- Over the limit you get HTTP
429withrate_limited. Wait and retry; theRetry-Afterheader says how many seconds. - Cache
/servicefor a few minutes, and prefer webhooks to frequent/statuspolling.
Older integrations that use https://anajak-store.com/api/v1 keep working, but please switch to https://api.anajak-store.com/v1.
