XMDT Server Integration
Your server makes exactly one call. It never carries or receives a player's name, date of birth, phone number, or OTP code.
| Environment | Base URL |
|---|---|
| Dev | https://api-xmdt.dev.alogame.vn |
| Prod | https://api-xmdt.alogame.vn |
Both are live. A secret_key is per-environment — one minted for dev does not work against prod and vice versa. See Getting a secret below.
| Call | When | Why |
|---|---|---|
POST /xmdt/session | Whenever your client needs to open the XMDT screen, and again at any point you need to trust whether a player has verified | Mints a short-lived token for the SDK — your HMAC secret never reaches a device. Its response also carries xmdtCompleted, read straight from Alogame, never relayed through the player's device — that's your authoritative answer. |
Getting a secret
Contact your Alogame Operations contact to enable XMDT for your gameId. You'll be given a secret_key once, at the moment it's generated — it cannot be retrieved again, so store it immediately in your own secrets management, not in a config file that ends up in version control.
Dev and prod are enabled separately, each with its own secret_key — ask for both explicitly if you need to test against dev before switching a live build to prod.
Signing requests
This call uses the following signature scheme, and it's simpler than Alogame's payment contracts: no timestamp, no replay window, no field sorting.
X-Signature: HMAC-SHA256(secret_key, raw_request_body), lowercase hex
The signed message is the raw JSON body bytes exactly as sent — not a re-serialized or sorted version of it.
If your framework parses the JSON and you sign the re-serialized form, key order, spacing, and number formatting can all differ from what you actually send, and the signature will not match. Capture the raw body before your JSON parser consumes it (see the payment API authentication guide for language-specific examples of doing this correctly — same principle applies here even though the signing formula itself is different).
const crypto = require("crypto");
function signXmdtBody(rawBody, secret) {
return crypto.createHmac("sha256", secret).update(rawBody).digest("hex");
}
import hmac, hashlib
def sign_xmdt_body(raw_body: bytes, secret: str) -> str:
return hmac.new(secret.encode(), raw_body, hashlib.sha256).hexdigest()
function signXmdtBody(string $rawBody, string $secret): string {
return hash_hmac('sha256', $rawBody, $secret);
}
Send it as the X-Signature header, Content-Type: application/json, on the call below. There is no separate service-id header to set — gameId in the request body is what's verified against.
POST /xmdt/session — mint a session token
Call this whenever your client is about to open the XMDT screen (AlogameKycSdk.show()).
Request
{
"gameId": "your_game_id",
"username": "player_account_name",
"serverId": "server_01",
"roleId": "character_123",
"accountCreatedAt": "2026-03-01T08:00:00+07:00"
}
| Field | Type | Required | Notes |
|---|---|---|---|
gameId | string | Yes | Your registered game code |
username | string | Yes | Your own stable per-player identifier — this, not a device ID, is what ties a player to their XMDT record. Use your account ID, the same value your Web Payment check_uid returns as accountId, so top-ups can be matched to this record |
serverId | string | No | Omit if your game has no server selection at this point |
roleId | string | No | Omit if the player hasn't picked a character yet |
accountCreatedAt | string | No | When this player's account was created in your game, RFC 3339 with an offset, for example "2026-03-01T08:00:00+07:00" or "2026-03-01T01:00:00Z". Lets the trial period count from registration. Omit it if you don't have it. |
Send ids as strings even when they are numbers in your database: "username": "10000005", not "username": 10000005. A number is rejected with 400 invalid_request and the message username must be a string, got number. Sign the body exactly as you send it: quoting the value changes the signature.
BODY='{"gameId":"your_game_id","username":"player_account_name"}'
SIG=$(printf '%s' "$BODY" | openssl dgst -sha256 -hmac "$SECRET" | sed 's/^.* //')
curl -X POST https://api-xmdt.dev.alogame.vn/xmdt/session \
-H "Content-Type: application/json" \
-H "X-Signature: $SIG" \
-d "$BODY"
Response
{
"sessionToken": "opaque-token-hand-this-to-your-client",
"expiresAt": "2026-08-07T12:15:00Z",
"xmdtRequired": true,
"xmdtRequiredFrom": null,
"xmdtCompleted": false
}
| Field | Meaning |
|---|---|
sessionToken | Pass this straight to your client — it's what AlogameKycSdk.setGameRole() needs. Valid for 15 minutes. |
xmdtRequired | Whether XMDT is mandatory for this player, right now. Alogame Operations sets it per game, and may give new players a trial period (below). false means the player can close the form and keep playing. You don't configure this per call. |
xmdtRequiredFrom | When this player's trial period ends: midnight Vietnam time, for example "2026-12-16T00:00:00+07:00". null when your game has no trial period. Still set after the date has passed. A new field: treat it as null if it is missing. |
xmdtCompleted | This player already has a complete XMDT record — your client can skip calling show() entirely if you want to avoid a no-op screen open. |
The token is single-use for the collect step and expires in 15 minutes — mint a fresh one for each show() call rather than caching and reusing one across sessions.
Using this as the authoritative check
Do not gate anything on the SDK's onResult callback alone — that comes from the player's device, and a modified client can report success without ever verifying anything. At the point you actually need to trust the answer (letting a player into a match, for example), call this same endpoint again and read xmdtCompleted off the response. There's no separate status route: the field is authoritative because it comes straight from Alogame over the same signed, server-to-server call — never relayed through the player's device.
Let the player in when either is true, and block otherwise:
allow = xmdtCompleted || !xmdtRequired
Do not block on xmdtCompleted == false alone. A player in a trial period has xmdtCompleted: false and xmdtRequired: false, and must be let in.
Cache a true xmdtCompleted on your side rather than minting again on every login — a completed record doesn't become incomplete again, and minting is rate-limited per player (see Errors below). Never cache xmdtRequired: false: it turns true when the trial period ends.
Trial period
Alogame Operations can give new players of your game a trial period of up to 7 days. During it, the player can close the XMDT form and keep playing. From the first day after it, XMDT is mandatory: the form shows Thoát game instead.
- The days are counted per account (
gameId+username), in Vietnam calendar days, from the first time Alogame sees that player, or fromaccountCreatedAtif you send an earlier one. Logging out, a new device or a reinstall does not restart them. - Open the form at every game entry while
xmdtCompletedisfalse, trial period or not. Do not remember "this player skipped" on your side. - A player who closes the form ends the flow with
Cancelled. Let them in. - Your code does not change when Operations turns the trial period on, off, or shortens it, as long as you gate with the rule above. Operations' change applies to all players at once.
Counting from account creation
Without accountCreatedAt, an account created long before your game started calling XMDT still gets a full trial period, counted from its first XMDT call. Send accountCreatedAt on every mint to count from the day the account was really created instead.
- It can only shorten a trial period, never extend it. Alogame keeps the earlier of your date and the first time it saw the player. A date in the future counts as now.
- Accounts older than the trial period must verify at once. With a 6-day trial, an account created 30 days ago gets
xmdtRequired: trueon its first call. There is no grace period for existing players when Operations enables XMDT for your game. Agree on this with Operations before you start sending the field. - A bad value never blocks a player. If Alogame cannot use the value (no offset such as
"2026-03-01 08:00:00", a number, or a date before 2000), it ignores it and answers as if you had not sent it. Check that your format is right before going live: the response will not tell you. - Send it from your server, inside the signed body, like every other field. Never take it from the game client.
Errors
| HTTP | code | Meaning |
|---|---|---|
| 400 | invalid_request | Malformed JSON, a field of the wrong type (message names it, e.g. username must be a string, got number), or gameId/username missing |
| 401 | missing_headers | No X-Signature header sent |
| 401 | invalid_signature | Signature doesn't match — check you signed the exact raw body |
| 403 | unknown_service | gameId is not registered or is inactive |
| 409 | xmdt_disabled | XMDT is not (yet) enabled for your gameId — contact Operations |
| 409 | email_required_unsupported | Your game has an email-verification requirement configured that this SDK flow doesn't support — contact Operations |
| 429 | rate_limited | Too many mint requests for this player/IP in a short window — back off and retry, no detail on which limit was hit |
| 500 | internal_error | Retry with backoff |
All error responses share the shape {"code": "...", "message": "..."}.