Midasbuy System — API documentation

Use this page to integrate your app or website with Midasbuy System. Send POST requests with JSON bodies as described below. You receive a client API key from the operator.

Every action below lists both request and example success response (HTTP 200). The HTTP responses section lists the same success shapes again next to all error codes, so integrators can copy one place.

API endpoint

This value is generated from the current site (protocol, host, and folder). After you upload to your server, open this page again — URLs will match your domain automatically. If your host uses a reverse proxy and links are wrong, set the environment variable PUBLIC_BASE_URL (e.g. https://example.com/myapp). Avoid exposing the client key in public front-end code when possible — prefer a backend that adds the header.

https://weecard.almirsystem.cloud/gateway.php

Authentication & headers

HeaderValue
Content-Type application/json
X-Api-Key required Client key issued to you (format like gw_...)

Method & path

Full URL example: https://weecard.almirsystem.cloud/gateway.php?action=getPlayer

JSON response format

On HTTP 200, the response body is JSON from the upstream service. The gateway does not rewrite it — you get the same structure the provider returns.

Success rule: treat the call as fully successful only when the HTTP status is 200 and the parsed JSON has success === true. Any other combination is not successful; show message and any relevant fields inside data.

Real values (timestamps, UC amounts, optional login fields, etc.) depend on the upstream. The examples below are illustrative so you can wire parsers and UI; run your own test calls for exact payloads.

Reconciliation & auditing

client_ref is required for reconciliation and auditing, especially for activate actions. Send a unique value from your system for every request (for example, your order ID, invoice ID, or UUID). The gateway stores it in the operations log even when the request is blocked, fails quota checks, fails upstream transport, or returns a business error.

The client_ref value is used by this gateway only; it is removed before forwarding the request to the upstream provider.

Actions

Primary endpoints: getPlayer, checkCode, activate. Optional: bulkActivate (short reference only).

getPlayer — player info

Request body (JSON):

{"client_ref": "YOUR_UNIQUE_ID", "player_id": 555555555}

Example success response (HTTP 200, illustrative):

{
  "success": true,
  "message": "Ok",
  "data": {
    "status": "success",
    "message": "Player found",
    "player_id": 555555555,
    "player_name": "PlayerName"
  }
}

checkCode — UC code status

Request body (JSON):

{"client_ref": "YOUR_UNIQUE_ID", "uc_code": "YOUR_CODE"}

Example success response (HTTP 200, illustrative):

{
  "success": true,
  "message": "Ok",
  "data": {
    "status": "activated",
    "uc_code": "YOUR_CODE",
    "amount": 60,
    "activated_at": 1631817600,
    "activated_to": 555555554
  }
}

activate — redeem code for a player

Request body (JSON):

{"client_ref": "YOUR_UNIQUE_ID", "player_id": 555555555, "uc_code": "YOUR_CODE"}

Example success response (HTTP 200, illustrative):

{
  "success": true,
  "message": "Ok",
  "data": {
    "status": "success",
    "message": "Code activated",
    "player_id": 555555555,
    "player_name": "PlayerName",
    "code_activated": "YOUR_CODE",
    "activated_at": 1763891643000,
    "activated_to": 555555554,
    "account_login": "login@example.com",
    "account_password": "…"
  }
}

account_login / account_password may be absent depending on provider and product.

bulkActivate — optional

Redeem up to 5 codes in one call; each code counts toward the client’s daily quota. Same JSON envelope as other actions; data.results is an array of per-code outcomes. Request example:

{"client_ref": "YOUR_UNIQUE_ID", "player_id": 555555555, "uc_codes": ["CODE1", "CODE2"]}

Full success sample omitted here; shape matches upstream bulk-activate docs when you need it.

HTTP responses

Same style as upstream OpenAPI: each row is Code, Description, and an example JSON body. When your call reaches the provider, status and body usually match their API. When the gateway stops the request (client key, quota, install), you get the gateway examples instead.

200 — Success

HTTP status is 200 and the body is JSON from the upstream (gateway forwards it unchanged). All three main actions share success, message, and data; only data changes.

?action=getPlayer — example value

Example value
{
  "success": true,
  "message": "Ok",
  "data": {
    "status": "success",
    "message": "Player found",
    "player_id": 555555555,
    "player_name": "PlayerName"
  }
}

?action=checkCode — example value

Example value
{
  "success": true,
  "message": "Ok",
  "data": {
    "status": "activated",
    "uc_code": "rX7rASS72a25qdVcg0",
    "amount": 60,
    "activated_at": 1631817600,
    "activated_to": 555555554
  }
}

?action=activate — example value

Example value
{
  "data": {
    "account_login": "login@gmail.com",
    "account_password": "password",
    "activated_at": 1763891643000,
    "activated_to": 555555554,
    "code_activated": "rX7rASS72a25qdVcg0",
    "message": "Code activated",
    "player_id": 555555555,
    "player_name": "PlayerName",
    "status": "success"
  },
  "message": "Ok",
  "success": true
}

The provider may still answer with HTTP 200 but "success": false when the request was understood but the business operation failed (e.g. unknown player, bad code). Treat that as a logical error in your UI:

Example value (HTTP 200, business failure — illustrative)
{
  "success": false,
  "message": "Player not found",
  "data": {
    "status": "error",
    "message": "Player not found",
    "player_id": 555555555
  }
}

Exact strings and data fields depend on the upstream; always branch on success and data.status after checking HTTP status.

400 — Bad request

Invalid body or unknown action. Upstream-style example:

Example value (upstream)
{
  "message": "Invalid request data",
  "success": false
}

Gateway may instead return, for example:

Example value (gateway)
{
  "success": false,
  "message": "Invalid action",
  "allowed": ["activate", "bulkActivate", "checkCode", "getPlayer"]
}
{
  "success": false,
  "message": "Invalid request body for this action"
}

401 — Unauthorized

Missing/invalid API key. Upstream-style example:

Example value (upstream)
{
  "message": "Api key required",
  "success": false
}

Gateway (client key) examples:

Example value (gateway)
{
  "success": false,
  "message": "X-Api-Key required (client key)"
}
{
  "success": false,
  "message": "Invalid API key"
}

403 — Forbidden

Client disabled on this gateway (not from upstream).

Example value (gateway)
{
  "success": false,
  "message": "Client disabled"
}

405 — Method not allowed

Only POST is accepted.

Example value (gateway)
{
  "success": false,
  "message": "Method not allowed"
}

429 — Too many requests

Daily quota for this client or global upstream cap.

Example value (gateway)
{
  "success": false,
  "message": "Daily operation limit reached for this client",
  "limit": 1000,
  "used": 1000,
  "day": "2026-05-12"
}
{
  "success": false,
  "message": "Global upstream daily quota reached",
  "limit": 50000,
  "used": 50000
}

500 — Server error

Upstream or gateway internal error.

Example value (upstream)
{
  "message": "Server error",
  "success": false
}
Example value (gateway)
{
  "success": false,
  "message": "Database error"
}
{
  "success": false,
  "message": "Missing master API key on server"
}

502 — Bad gateway

Could not complete the upstream HTTP call (network/timeout).

Example value (gateway)
{
  "success": false,
  "message": "Upstream request failed",
  "detail": "Connection timed out"
}

503 — Service unavailable

System not installed or not configured.

Example value (gateway)
{
  "success": false,
  "message": "Midasbuy System is not installed. Run install.php"
}

Always use res.status together with await res.json(): check HTTP code first, then success / message / data inside the body.

Troubleshooting: you only see errors

If you never get a success sample in real traffic, the response body usually tells you which layer failed:

Use gateway-test.html or proxy-test.html on the same host with a known-good client key and minimal body (e.g. getPlayer with a real player id) to separate “gateway blocked” from “upstream rejected”.

Example: JavaScript (fetch)

const url = "https://weecard.almirsystem.cloud/gateway.php?action=getPlayer";
const res = await fetch(url, {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "X-Api-Key": "YOUR_CLIENT_KEY"
  },
  body: JSON.stringify({ client_ref: "YOUR_UNIQUE_ID", player_id: 555555555 })
});
const data = await res.json();
// On HTTP 200: check data.success, then data.data (and data.data.status when present)

Example: cURL (Windows)

curl -X POST "https://weecard.almirsystem.cloud/gateway.php?action=getPlayer" ^
  -H "Content-Type: application/json" ^
  -H "X-Api-Key: YOUR_CLIENT_KEY" ^
  -d "{\"client_ref\":\"YOUR_UNIQUE_ID\",\"player_id\":555555555}"

On Linux/mac, use \ for line continuation instead of ^.