GPDS Partner API
Sell GPDS Game Shop top-ups, vouchers and digital codes from your own platform. Orders are paid from your prepaid GPDS wallet and fulfilled automatically; you get the result by callback or by polling.
Getting Started #
The Partner API is for approved resellers and platforms. Every request is made server-to-server with your secret partner key. Never call it from a browser or a mobile app.
- Get onboarded. GPDS creates your reseller account, gives you a partner key, and registers your HTTPS callback URL and callback secret.
- Fund your wallet. Orders are paid from your prepaid GPDS balance. Check it with Wallet Balance.
- Load the catalogue. List Products, then their Denominations (the purchasable items and your price).
- Place orders. POST an order with your own unique
partner_ref. Your wallet is charged and fulfillment starts immediately. - Get the result. Receive a signed callback when the order succeeds or fails, or poll Check Order.
Authentication #
Send your partner key in the Authorization header on every request. The raw key is the original format and keeps working.
Authorization: YOUR_PARTNER_KEY
Accept: application/json
Content-Type: application/json
Next release Authorization: Bearer YOUR_PARTNER_KEY is also accepted.
| Situation | HTTP | Message |
|---|---|---|
| No header | 400 | Missing token! |
| Unknown or revoked key | 400 | Invalid credentials! |
| Account suspended Next release | 403 | Your account has been banned |
Your partner key can spend your wallet. Keep it in a server-side secret store, never in client code, logs, tickets or chat. If it leaks, ask GPDS to rotate it immediately; the old key stops working at once.
Responses & Envelope #
Successful calls return HTTP 200 with the data in payload:
{
"method": "GET",
"code": 200,
"message": "data successfully retrieved",
"payload": { }
}
Business errors (bad key, not enough balance, inactive item…) return HTTP 400 (or 403) with a readable message and no payload. Input validation errors return HTTP 422:
{
"success": false,
"message": "Validation failed",
"errors": {
"qty": ["The qty field must be at least 1."]
}
}
Always branch on the HTTP status. Treat anything other than 200 as "not done", and read message / errors for the reason.
Rate Limits #
| Scope | Limit |
|---|---|
POST /partner/order | 15 requests per minute per partner |
| All API calls | 180 requests per minute |
Over the limit you get HTTP 429. Back off and retry later; repeat an order with the same partner_ref so it can never be charged twice. Cache the catalogue instead of loading it before every order.
Products #
Lists active products (games and services). Each product has denominations you can buy.
Query parameters
| Name | Type | Description |
|---|---|---|
category optional | string | Only products in this category name. |
exclude_category optional | string | Comma-separated category names to leave out. |
name optional | string | Name contains this text. |
limit optional | integer | Maximum number of products. |
curl -s "https://admin.gpdsgameshop.com/api/partner/product?name=Mobile%20Legends" \
-H "Authorization: $GPDS_PARTNER_KEY" \
-H "Accept: application/json"
{
"method": "GET",
"code": 200,
"message": "data successfully retrieved",
"payload": [
{
"id": 12,
"name": "Mobile Legends",
"slug": "mobile-legends",
"category": "Mobile Games",
"company": "Moonton",
"input_format": [ "...fields to collect, see Place Order..." ],
"description": "...",
"how_to_order": "...",
"status": "active",
"check_uid": "active",
"picture": "https://...",
"cover": "https://...",
"provider_country": "ph"
}
]
}
Use id to load denominations. Additional fields may appear; ignore fields you don't use.
Product Denominations #
Lists the purchasable items of one product at your reseller price, with stock and the account fields the order needs.
curl -s "https://admin.gpdsgameshop.com/api/partner/product-item/12" \
-H "Authorization: $GPDS_PARTNER_KEY" \
-H "Accept: application/json"
{
"method": "GET",
"code": 200,
"message": "data successfully retrieved",
"payload": {
"0": {
"code": 845,
"name": "86 Diamonds",
"stock": "∞",
"price": "93.50",
"category": "Diamonds",
"picture": "https://...",
"input_format": [ "..." ]
}
}
}
| Field | Description |
|---|---|
code | The item id. Send it as item_code when ordering. |
price | Your unit price in the shop base currency, as a formatted string (e.g. "1,250.00"). Strip thousands separators before parsing. |
stock | Remaining stock, or "∞" for unlimited. Items with zero stock are not listed. |
input_format | The customer-account fields this product needs (e.g. user id, zone id). |
payload may be a JSON list or an object keyed by position. Iterate its values (e.g. Object.values(payload)) rather than relying on array indexes.
Wallet Balance #
Returns your current prepaid balance converted to the requested currency at the current GPDS exchange rate.
| Name | Type | Description |
|---|---|---|
currency_code required | string | Three uppercase letters, e.g. PHP, USD. |
curl -s "https://admin.gpdsgameshop.com/api/partner/balance?currency_code=PHP" \
-H "Authorization: $GPDS_PARTNER_KEY" \
-H "Accept: application/json"
{
"method": "GET",
"code": 200,
"message": "data successfully retrieved",
"payload": 15230.5
}
The balance can only be changed by GPDS (top-ups) and by your orders. There is no API to add funds.
Place Order #
Creates an order, charges your wallet and starts fulfillment. Payment is always your GPDS wallet. The price is always taken from GPDS, never from the request.
Body (JSON)
| Field | Type | Description |
|---|---|---|
partner_ref required | string | Your unique reference (invoice or transaction id). A repeat with the same value never creates a second order — see Idempotency. |
item_code required | string / integer | The denomination code. |
cust_account required | object | The player account fields from input_format, e.g. {"user_id":"123456","zone_id":"7890"}. Up to 10 fields, 255 characters each. |
qty required | integer | Quantity, at least 1. |
cust_phone_number optional | string | Customer phone, when the product needs it. |
Try it — request builder
Fill in the fields to generate a request you can run from your own server. Nothing is sent from this page and no key is stored.
Response
{
"method": "POST",
"code": 200,
"message": "data successfully retrieved",
"payload": {
"id": 99102,
"code": "GPDS251128A1B2C",
"created_at": "28 Nov 2026 14:05:11",
"item": { "id": 845, "name": "Mobile Legends - 86 Diamonds" },
"cust_account": { "user_id": "123456", "zone_id": "7890" },
"status": "on-process",
"qty": 1,
"price": 93.5,
"discount_price": 0,
"admin_fee": 0,
"total_price": 93.5,
"payment_code": null,
"expired_at": "2026-11-28 15:05:11",
"note": null
}
}
Store the GPDS code with your partner_ref. The order is usually still on-process when the call returns; the final result arrives by callback.
Idempotency & retries
If you send a partner_ref you have already used, no new order is created and nothing is charged. You get HTTP 422 with the existing GPDS order code:
{
"success": false,
"message": "Validation failed",
"errors": {
"status": [false],
"message": ["transaction.trx_exist"],
"exist_code": ["GPDS251128A1B2C"]
}
}
On a timeout or network error, retry with the same partner_ref. If you get exist_code, the first attempt went through — look it up with Check Order. Never generate a new partner_ref for a retry.
Common order errors
| HTTP | Message | What to do |
|---|---|---|
| 400 | Your balance is not enough | Top up your GPDS wallet. Nothing was charged. |
| 400 | Invalid product item, item not active | Reload denominations; the item was disabled. |
| 400 | Product stock was empty | Item is out of stock. |
| 422 | errors.cust_account | Missing or invalid player account fields, or the player id was not found. |
| 429 | — | Rate limit; retry later with the same partner_ref. |
Check Order #
Returns one of your orders by its GPDS code. You can only read your own orders.
curl -s "https://admin.gpdsgameshop.com/api/partner/order/GPDS251128A1B2C" \
-H "Authorization: $GPDS_PARTNER_KEY" \
-H "Accept: application/json"
The response has the same fields as Place Order. An unknown code — or another partner's — returns HTTP 400. Poll no more than once every 30 seconds per order; prefer callbacks.
Partner Statistics #
Your sales summary: balance, this month vs last month, today, all time, orders by status, the last 7 days and recent orders.
| Name | Type | Description |
|---|---|---|
month optional | integer 1–12 | Defaults to the current month. |
year optional | integer | Defaults to the current year. |
{
"code": 200,
"payload": {
"balance": 15230.5,
"month": 11,
"year": 2026,
"this_month": { "orders": 412, "turnover": 38410.0, "gross_profit": 2210.4, "gateway_fees": 0, "vat_on_fees": 0, "net_profit": 2210.4 },
"last_month": { "orders": 389, "turnover": 35120.0, "net_profit": 1980.1 },
"all_time": { "orders": 5120, "turnover": 480200.0, "gross_profit": 27100.2, "net_profit": 27100.2 },
"today": { "orders": 14, "turnover": 1290.0, "gross_profit": 71.3, "gateway_fees": 0, "vat_on_fees": 0, "net_profit": 71.3 },
"changes": { "orders": 5.9, "turnover": 9.4, "profit": 11.6 },
"orders_by_status": { "total": 412, "success": 405, "failed": 4, "expired": 0, "pending": 3 },
"weekly": [ { "day": "Fri", "date": "Nov 27", "turnover": 1510.0, "profit": 80.2, "orders": 17 } ],
"recent_orders": [ { "code": "GPDS251128A1B2C", "status": "success", "turnover": 93.5, "profit": 4.1, "product": "Mobile Legends", "created_at": "Nov 28, 2026 14:05" } ]
}
}
Order Statuses #
| Status | Final? | Meaning |
|---|---|---|
on-process | No | Paid from your wallet; fulfillment running. |
delay | No | The supplier is slow or returned an error. GPDS staff complete it or refund it. Your wallet stays charged until then. |
success | Yes | Delivered. sn in the callback may hold a serial or voucher code. |
failed | Yes | Not delivered. The order amount is returned to your wallet (automatically for most products, otherwise by GPDS staff). |
refunded | Yes | Refunded to your wallet by GPDS. |
Callbacks are sent for success and failed. For anything else, poll Check Order.
Order Status Callback #
When one of your orders becomes success or failed, GPDS sends a POST to your registered callback URL.
POST https://your-domain.example/gpds/callback
Content-Type: application/json
Authorization: Bearer YOUR_CALLBACK_SECRET
X-GPDS-Event-Id: 5b1f0d2e-8a3c-4c43-9f43-2a9c8b0f6c11
X-GPDS-Timestamp: 1795867511
X-GPDS-Signature: sha256=2f1c…e9a0
{
"name": "Your Shop Name",
"code": "GPDS251128A1B2C",
"partner_ref_id": "INV-10001",
"status": "success",
"cust_account": "{\"user_id\":\"123456\",\"zone_id\":\"7890\"}",
"item": "Mobile Legends - 86 Diamonds",
"description": null,
"sn": "SN-0099-ABC",
"price": 93.5
}
| Field | Description |
|---|---|
code | GPDS order code. |
partner_ref_id | Your partner_ref. |
status | success or failed. |
sn | Serial / voucher / provider reference, when available. |
cust_account | The account fields, as a JSON string. |
price | Unit price charged. |
Your endpoint must
- Use HTTPS.
- Answer
2xxwithin 10 seconds. Do heavy work after responding. - Be idempotent: the same event can arrive more than once. De-duplicate on
X-GPDS-Event-Id, or onpartner_ref_id+status. - Verify the sender (below) before trusting the body. If unsure, confirm with Check Order.
Verifying Signatures Next release #
Every callback carries X-GPDS-Timestamp and X-GPDS-Signature. The signature is an HMAC-SHA256 of "{timestamp}.{raw request body}", keyed with your callback secret, hex-encoded and prefixed with sha256=.
- Read the raw body bytes before any JSON parsing.
- Reject the request if the timestamp is more than 5 minutes from your clock (stops replays).
- Compute the HMAC and compare it to the header with a constant-time comparison.
- Reject event ids you have already processed.
<?php
// Laravel-free, plain PHP 8
$secret = getenv('GPDS_CALLBACK_SECRET');
$raw = file_get_contents('php://input');
$timestamp = $_SERVER['HTTP_X_GPDS_TIMESTAMP'] ?? '';
$signature = $_SERVER['HTTP_X_GPDS_SIGNATURE'] ?? '';
$fresh = ctype_digit($timestamp) && abs(time() - (int) $timestamp) <= 300;
$expected = 'sha256=' . hash_hmac('sha256', $timestamp . '.' . $raw, $secret);
if (!$fresh || !hash_equals($expected, $signature)) {
http_response_code(401);
exit;
}
$event = json_decode($raw, true, 512, JSON_THROW_ON_ERROR);
// TODO: skip if $_SERVER['HTTP_X_GPDS_EVENT_ID'] was already processed
// TODO: update your order where partner_ref = $event['partner_ref_id']
http_response_code(200);
echo 'ok';
// Express — keep the raw body for verification
const express = require('express');
const crypto = require('node:crypto');
const app = express();
const SECRET = process.env.GPDS_CALLBACK_SECRET;
app.post('/gpds/callback', express.raw({ type: 'application/json' }), (req, res) => {
const ts = req.get('X-GPDS-Timestamp') || '';
const sig = req.get('X-GPDS-Signature') || '';
const fresh = /^\d+$/.test(ts) && Math.abs(Date.now() / 1000 - Number(ts)) <= 300;
const expected = 'sha256=' + crypto
.createHmac('sha256', SECRET)
.update(ts + '.' + req.body.toString('utf8'))
.digest('hex');
const ok = fresh
&& sig.length === expected.length
&& crypto.timingSafeEqual(Buffer.from(sig), Buffer.from(expected));
if (!ok) return res.sendStatus(401);
const event = JSON.parse(req.body.toString('utf8'));
// TODO: de-duplicate on req.get('X-GPDS-Event-Id'), then update your order
res.send('ok');
});
app.listen(3000);
import { createHmac, timingSafeEqual } from 'node:crypto';
export interface GpdsCallback {
name: string;
code: string;
partner_ref_id: string;
status: 'success' | 'failed';
cust_account: string;
item: string;
description: string | null;
sn: string | null;
price: number;
}
/** Returns the parsed event, or null if the request is not from GPDS. */
export function verifyGpdsCallback(
rawBody: string,
headers: Record<string, string | undefined>,
secret: string,
toleranceSeconds = 300,
): GpdsCallback | null {
const ts = headers['x-gpds-timestamp'] ?? '';
const sig = headers['x-gpds-signature'] ?? '';
if (!/^\d+$/.test(ts) || Math.abs(Date.now() / 1000 - Number(ts)) > toleranceSeconds) return null;
const expected = 'sha256=' + createHmac('sha256', secret).update(`${ts}.${rawBody}`).digest('hex');
const a = Buffer.from(sig);
const b = Buffer.from(expected);
if (a.length !== b.length || !timingSafeEqual(a, b)) return null;
return JSON.parse(rawBody) as GpdsCallback;
}
Until the signature headers are live, verify the Authorization: Bearer callback secret with a constant-time comparison, and confirm the status with Check Order before releasing goods. Both checks keep working after the release.
Error Codes #
| HTTP | Meaning | Retry? |
|---|---|---|
| 200 | Success — read payload. | — |
| 400 | Business rule or authentication error. See message. | Only after fixing the cause. |
| 403 | Account suspended. | No — contact GPDS. |
| 404 | Wrong path. | No. |
| 422 | Validation failed, or duplicate partner_ref (errors.exist_code). | Fix the input. For duplicates, look up the existing order. |
| 429 | Rate limit. | Yes, after a pause, same partner_ref. |
| 500 / 502 / 503 | Temporary GPDS problem. | Yes, with backoff, same partner_ref. Check the order before retrying. |
Sandbox Testing #
Real orders on the live API charge your wallet and deliver real products. To build and test your integration:
- Ask GPDS for staging access: a staging API root, a test partner key and a test wallet. Staging orders never buy real products.
- Use a separate callback URL for staging, and keep staging and live keys apart.
- On live, start with a single low-value order and confirm the callback, the wallet debit and your records before going to volume.
- The request builder on this page only generates code. It never sends requests and never asks for your key.
Integration Examples #
Minimal clients with timeouts, safe retries and secrets read from the environment.
<?php
final class GpdsPartnerClient
{
private const BASE = 'https://admin.gpdsgameshop.com/api/partner';
public function __construct(private string $key) {}
public static function fromEnv(): self
{
return new self((string) getenv('GPDS_PARTNER_KEY'));
}
public function balance(string $currency = 'PHP'): float
{
return (float) $this->call('GET', '/balance?currency_code=' . urlencode($currency));
}
public function items(int $productId): array
{
return array_values((array) $this->call('GET', '/product-item/' . $productId));
}
/** Safe to retry with the same $partnerRef: never creates a second order. */
public function order(string $partnerRef, int $itemCode, array $account, int $qty = 1): array
{
return (array) $this->call('POST', '/order', [
'partner_ref' => $partnerRef,
'item_code' => $itemCode,
'cust_account' => $account,
'qty' => $qty,
]);
}
public function find(string $code): array
{
return (array) $this->call('GET', '/order/' . rawurlencode($code));
}
private function call(string $method, string $path, ?array $body = null): mixed
{
$ch = curl_init(self::BASE . $path);
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => $method,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CONNECTTIMEOUT => 5,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTPHEADER => [
'Authorization: ' . $this->key,
'Accept: application/json',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => $body === null ? null : json_encode($body, JSON_THROW_ON_ERROR),
]);
$raw = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
$error = curl_error($ch);
curl_close($ch);
if ($raw === false) {
throw new RuntimeException('GPDS network error: ' . $error); // retry with the same partner_ref
}
$json = json_decode($raw, true) ?? [];
if ($status !== 200) {
throw new RuntimeException('GPDS ' . $status . ': ' . ($json['message'] ?? 'error'), $status);
}
return $json['payload'] ?? null;
}
}
// $gpds = GpdsPartnerClient::fromEnv();
// $order = $gpds->order('INV-10001', 845, ['user_id' => '123456', 'zone_id' => '7890']);
// Node.js 18+ (built-in fetch)
const BASE = 'https://admin.gpdsgameshop.com/api/partner';
const KEY = process.env.GPDS_PARTNER_KEY;
async function call(method, path, body) {
const res = await fetch(BASE + path, {
method,
headers: {
Authorization: KEY,
Accept: 'application/json',
'Content-Type': 'application/json',
},
body: body ? JSON.stringify(body) : undefined,
signal: AbortSignal.timeout(30_000),
});
const json = await res.json().catch(() => ({}));
if (res.status !== 200) {
const err = new Error(`GPDS ${res.status}: ${json.message ?? 'error'}`);
err.status = res.status;
err.details = json.errors;
throw err;
}
return json.payload;
}
async function placeOrder(partnerRef, itemCode, account, qty = 1) {
for (let attempt = 1; ; attempt++) {
try {
return await call('POST', '/order', { partner_ref: partnerRef, item_code: itemCode, cust_account: account, qty });
} catch (err) {
const existing = err.details?.exist_code?.[0];
if (existing) return call('GET', `/order/${encodeURIComponent(existing)}`); // first attempt went through
const retryable = !err.status || err.status === 429 || err.status >= 500;
if (!retryable || attempt === 3) throw err;
await new Promise((r) => setTimeout(r, attempt * 2000));
}
}
}
module.exports = { call, placeOrder };
// TypeScript (Node 18+)
type Envelope<T> = { code: number; message: string; payload: T };
export interface GpdsOrder {
id: number;
code: string;
status: 'on-process' | 'delay' | 'success' | 'failed' | 'refunded';
item: { id: number; name: string };
qty: number;
price: number;
total_price: number;
created_at: string;
}
export interface GpdsItem {
code: number;
name: string;
stock: number | string;
price: string;
category: string | null;
}
export class GpdsError extends Error {
constructor(public status: number, message: string, public details?: Record<string, unknown[]>) {
super(message);
}
}
export class GpdsPartnerClient {
constructor(
private readonly key: string = process.env.GPDS_PARTNER_KEY ?? '',
private readonly base = 'https://admin.gpdsgameshop.com/api/partner',
) {}
balance(currency = 'PHP') {
return this.call<number>('GET', `/balance?currency_code=${encodeURIComponent(currency)}`);
}
async items(productId: number): Promise<GpdsItem[]> {
return Object.values(await this.call<Record<string, GpdsItem>>('GET', `/product-item/${productId}`));
}
/** Idempotent on partnerRef. */
order(partnerRef: string, itemCode: number, account: Record<string, string>, qty = 1) {
return this.call<GpdsOrder>('POST', '/order', { partner_ref: partnerRef, item_code: itemCode, cust_account: account, qty });
}
find(code: string) {
return this.call<GpdsOrder>('GET', `/order/${encodeURIComponent(code)}`);
}
private async call<T>(method: 'GET' | 'POST', path: string, body?: unknown): Promise<T> {
const res = await fetch(this.base + path, {
method,
headers: { Authorization: this.key, Accept: 'application/json', 'Content-Type': 'application/json' },
body: body === undefined ? undefined : JSON.stringify(body),
signal: AbortSignal.timeout(30_000),
});
const json = (await res.json().catch(() => ({}))) as Partial<Envelope<T>> & { errors?: Record<string, unknown[]> };
if (res.status !== 200) throw new GpdsError(res.status, json.message ?? `HTTP ${res.status}`, json.errors);
return json.payload as T;
}
}
Security Guidelines #
- Server-side only. Call the API from your backend. Never put the partner key in a website, app, or public repository.
- Store secrets properly. Keep the partner key and callback secret in environment variables or a secret manager; redact the
Authorizationheader in logs. - Rotate on suspicion. If a key may have leaked, ask GPDS to rotate it. The old key stops working immediately.
- Unique
partner_refper sale and the same value on every retry — this is what protects you from double charges. - Verify every callback (signature or secret, plus timestamp) and treat it as a hint you can confirm with Check Order.
- Validate player input on your side before ordering, and keep
cust_accountto the fields ininput_format. - Watch your wallet. Alert yourself on unusual spend and keep only the balance you need.
- HTTPS everywhere. Your callback URL must be HTTPS. GPDS only serves the API over HTTPS.
- Report issues privately to GPDS support. Do not test against the live API with real wallets beyond normal orders.
Changelog #
Next release — security update Rolling out
- Callbacks are signed:
X-GPDS-Event-Id,X-GPDS-Timestamp,X-GPDS-Signature. Payload andAuthorization: Bearerheader unchanged. - Callbacks have a 10-second timeout and are retried once.
- Duplicate
partner_refprotection is per partner and safe under concurrent requests. - Wallet is charged before fulfillment starts; a supplier error leaves the order in
delay(never lost). - Suspended accounts receive HTTP 403.
Authorization: Bearer <key>accepted alongside the raw key.- New partner keys and callback secrets are at least 32 characters; new callback URLs must be HTTPS.
2026-11 — Documentation portal
- New developer documentation with request builder, PHP / Node.js / TypeScript examples and signature verification guide.