Skip to main content

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.

Environments
EnvironmentBase URL
Devhttps://api-xmdt.dev.alogame.vn
Prodhttps://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.

CallWhenWhy
POST /xmdt/sessionWhenever your client needs to open the XMDT screen, and again at any point you need to trust whether a player has verifiedMints 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.

Sign the raw body, never a re-serialized object

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).

Node.js
const crypto = require("crypto");

function signXmdtBody(rawBody, secret) {
return crypto.createHmac("sha256", secret).update(rawBody).digest("hex");
}
Python
import hmac, hashlib

def sign_xmdt_body(raw_body: bytes, secret: str) -> str:
return hmac.new(secret.encode(), raw_body, hashlib.sha256).hexdigest()
PHP
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​

Request body
{
"gameId": "your_game_id",
"username": "player_account_name",
"serverId": "server_01",
"roleId": "character_123",
"accountCreatedAt": "2026-03-01T08:00:00+07:00"
}
FieldTypeRequiredNotes
gameIdstringYesYour registered game code
usernamestringYesYour 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
serverIdstringNoOmit if your game has no server selection at this point
roleIdstringNoOmit if the player hasn't picked a character yet
accountCreatedAtstringNoWhen 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.
Every field is a JSON string

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.

curl
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​

200 OK
{
"sessionToken": "opaque-token-hand-this-to-your-client",
"expiresAt": "2026-08-07T12:15:00Z",
"xmdtRequired": true,
"xmdtRequiredFrom": null,
"xmdtCompleted": false
}
FieldMeaning
sessionTokenPass this straight to your client — it's what AlogameKycSdk.setGameRole() needs. Valid for 15 minutes.
xmdtRequiredWhether 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.
xmdtRequiredFromWhen 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.
xmdtCompletedThis 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 from accountCreatedAt if 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 xmdtCompleted is false, 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: true on 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​

HTTPcodeMeaning
400invalid_requestMalformed JSON, a field of the wrong type (message names it, e.g. username must be a string, got number), or gameId/username missing
401missing_headersNo X-Signature header sent
401invalid_signatureSignature doesn't match — check you signed the exact raw body
403unknown_servicegameId is not registered or is inactive
409xmdt_disabledXMDT is not (yet) enabled for your gameId — contact Operations
409email_required_unsupportedYour game has an email-verification requirement configured that this SDK flow doesn't support — contact Operations
429rate_limitedToo many mint requests for this player/IP in a short window — back off and retry, no detail on which limit was hit
500internal_errorRetry with backoff

All error responses share the shape {"code": "...", "message": "..."}.

Next steps​