wallet API / Wallet
Credit a game result, free-round win or jackpot prize
/winCredit amount (may be zero). A game payout closes the round. Always accept, even if the player's session ended or the account is blocked. Re-sent with the same transaction_id until you acknowledge; credit once.
SPILVON Jackpot: kind: "jackpot" is a separate credit with reference_transaction_id: null and round_closed: true. Do not require a bet or an open round. Even if multiple prizes name the same round, book each by its own transaction_id. A jackpot is never cancelled or rolled back, only retried; an identical repeat may also return DUPLICATE_TRANSACTION.
Authentication
X-Spilvon-Operator + X-Spilvon-Timestamp + X-Spilvon-Signature
or X-Spilvon-Operator + X-Spilvon-Timestamp + X-Spilvon-Key-Id + X-Spilvon-Signature-Ed25519 + X-Spilvon-Signature-Ed25519-V2
Request body
Schema (resolved)
{
"oneOf": [
{
"allOf": [
{
"type": "object",
"required": [
"player_id",
"currency",
"token",
"session_id",
"game_code",
"operator_id"
],
"properties": {
"operator_id": {
"type": "string",
"pattern": "^op_[0-9a-f]{32}$",
"description": "The operator the call was signed for: your operator id. Inside the signed bytes (the\n`X-Spilvon-Operator` header is not). **Refuse the call (`401` `INVALID_SIGNATURE`, no money\nmoved) unless it equals your operator id**, in HMAC and Ed25519 mode alike: one SPILVON\nEd25519 key signs every operator's calls, so this is what stops a call captured by another\ncasino from being replayed at your wallet. Sent on every call since 2026-12 (AUD2-01).\n"
},
"player_id": {
"type": "string",
"maxLength": 64,
"pattern": "^[A-Za-z0-9_.@:-]+$",
"description": "Your player id, as given at session creation."
},
"currency": {
"type": "string",
"description": "Session currency, fixed for the session."
},
"token": {
"type": [
"string",
"null"
],
"maxLength": 512,
"description": "Your own session token from session creation, unchanged; null if you did not send one."
},
"session_id": {
"type": "string",
"pattern": "^ses_[0-9a-f]{32}$"
},
"game_code": {
"type": "string",
"pattern": "^[a-z0-9-]{1,32}$"
},
"sandbox": {
"type": "boolean",
"const": true,
"description": "Present (true) on every call for a sandbox account, absent otherwise. Play money; a production wallet should refuse such calls."
}
}
},
{
"type": "object",
"required": [
"transaction_id",
"round_id",
"amount",
"reference_transaction_id",
"round_closed"
],
"properties": {
"transaction_id": {
"type": "string",
"pattern": "^tx_[0-9a-f]{32}$",
"description": "Idempotency key of this credit."
},
"round_id": {
"type": "string",
"pattern": "^rnd_[0-9a-f]{32}$"
},
"amount": {
"type": "string",
"description": "Decimal string, at most the currency's decimals (2 fiat, 6 USDT/USDC/TRX, 8 BTC/ETH/LTC/SOL/DOGE). SPILVON always sends exactly the currency's decimals.",
"pattern": "^(0|[1-9]\\d{0,17})(\\.\\d{1,8})?$",
"examples": [
"10.00",
"0.00010000"
]
},
"reference_transaction_id": {
"type": [
"string",
"null"
],
"pattern": "^tx_[0-9a-f]{32}$",
"description": "The bet of this round for a game payout; null for free-round and jackpot credits."
},
"round_closed": {
"type": "boolean",
"const": true
},
"kind": {
"type": "string",
"description": "Omitted on game and free-round wins. `jackpot` marks a separate progressive prize.",
"examples": [
"jackpot"
]
},
"jackpot_win_id": {
"type": "string",
"pattern": "^jpw_[0-9a-f]{32}$",
"description": "Prize id for reconciliation; not the wallet idempotency key."
},
"jackpot_pool_id": {
"type": "string",
"pattern": "^jp_[0-9a-f]{32}$",
"description": "Pool that awarded the prize."
},
"jackpot_pool_type": {
"type": "string",
"enum": [
"network",
"local"
]
},
"jackpot_tier": {
"type": "string",
"description": "Tier name.",
"examples": [
"grand"
]
},
"free_round": {
"type": "boolean",
"const": true,
"description": "Present only on the win of a free-round award."
},
"award_id": {
"type": "string",
"pattern": "^fra_[0-9a-f]{32}$",
"description": "Free rounds only."
},
"award_reference": {
"type": "string",
"description": "Free rounds only. Your `reference` from issuing the award."
},
"free_round_number": {
"type": "integer",
"minimum": 1,
"description": "Free rounds only. 1-based number of this round within the award."
},
"free_rounds_total": {
"type": "integer",
"minimum": 1,
"description": "Free rounds only. Size of the award."
}
}
},
{
"if": {
"required": [
"kind"
],
"properties": {
"kind": {
"const": "jackpot"
}
}
},
"then": {
"required": [
"jackpot_win_id",
"jackpot_pool_id",
"jackpot_pool_type",
"jackpot_tier"
],
"properties": {
"reference_transaction_id": {
"type": "null"
}
},
"not": {
"required": [
"free_round"
]
}
}
}
]
},
{
"type": "object",
"required": [
"player_id",
"game_code",
"token",
"session_id",
"round_id",
"transaction_id",
"reference_transaction_id",
"round_closed",
"currency",
"amount",
"kind",
"jackpot_pool_id",
"jackpot_pool_type",
"jackpot_win_id",
"jackpot_tier",
"network_bet_id"
],
"properties": {
"player_id": {
"type": "string",
"pattern": "^[A-Za-z0-9_.:-]{1,96}$"
},
"game_code": {
"type": "string",
"pattern": "^[A-Za-z0-9_.:-]{1,96}$"
},
"token": {
"type": "null"
},
"session_id": {
"type": "string",
"pattern": "^jn_[a-f0-9]{64}$"
},
"round_id": {
"type": "string",
"pattern": "^jn_[a-f0-9]{64}$"
},
"transaction_id": {
"type": "string",
"pattern": "^tx_[a-f0-9]{32}$"
},
"reference_transaction_id": {
"type": "null"
},
"round_closed": {
"const": true
},
"currency": {
"type": "string"
},
"amount": {
"type": "string"
},
"kind": {
"const": "jackpot"
},
"jackpot_pool_id": {
"type": "string"
},
"jackpot_pool_type": {
"const": "network"
},
"jackpot_win_id": {
"type": "string",
"pattern": "^jpw_[a-f0-9]{32}$"
},
"jackpot_tier": {
"type": "string"
},
"network_bet_id": {
"type": "string",
"pattern": "^[A-Za-z0-9_.:-]{1,96}$"
}
}
}
]
}Example · Ordinary win
{
"player_id": "u-48213",
"currency": "USD",
"token": "casino-session-7f3a9c",
"session_id": "ses_0193c4d2a1b07e4f9a3c5d6e7f801234",
"game_code": "dice",
"operator_id": "op_0193c4d2a1b07e4f9a3c5d6e7f801234",
"transaction_id": "tx_0193c4d2a1b07e4f9a3c5d6e7f80bbbb",
"round_id": "rnd_0193c4d2a1b07e4f9a3c5d6e7f805678",
"amount": "19.80",
"reference_transaction_id": "tx_0193c4d2a1b07e4f9a3c5d6e7f80aaaa",
"round_closed": true
}Example · Standalone progressive prize (same round as the ordinary win, different credit)
{
"player_id": "u-48213",
"currency": "USD",
"token": "casino-session-7f3a9c",
"session_id": "ses_0193c4d2a1b07e4f9a3c5d6e7f801234",
"game_code": "dice",
"operator_id": "op_0193c4d2a1b07e4f9a3c5d6e7f801234",
"transaction_id": "tx_0193c4d2a1b07e4f9a3c5d6e7f80ab12",
"round_id": "rnd_0193c4d2a1b07e4f9a3c5d6e7f805678",
"amount": "4821.35",
"reference_transaction_id": null,
"round_closed": true,
"kind": "jackpot",
"jackpot_win_id": "jpw_0193c4d2a1b07e4f9a3c5d6e7f801234",
"jackpot_pool_id": "jp_0193c4d2a1b07e4f9a3c5d6e7f805678",
"jackpot_pool_type": "network",
"jackpot_tier": "grand"
}Example · Lost round (zero win closes it)
{
"player_id": "u-48213",
"currency": "USD",
"token": "casino-session-7f3a9c",
"session_id": "ses_0193c4d2a1b07e4f9a3c5d6e7f801234",
"game_code": "dice",
"operator_id": "op_0193c4d2a1b07e4f9a3c5d6e7f801234",
"transaction_id": "tx_0193c4d2a1b07e4f9a3c5d6e7f80cccc",
"round_id": "rnd_0193c4d2a1b07e4f9a3c5d6e7f809999",
"amount": "0.00",
"reference_transaction_id": "tx_0193c4d2a1b07e4f9a3c5d6e7f80dddd",
"round_closed": true
}Example · Win of a free-round award (no bet preceded it)
{
"player_id": "u-48213",
"currency": "USD",
"token": "casino-session-7f3a9c",
"session_id": "ses_0193c4d2a1b07e4f9a3c5d6e7f801234",
"game_code": "thunder-anvil",
"operator_id": "op_0193c4d2a1b07e4f9a3c5d6e7f801234",
"transaction_id": "tx_0193c4d2a1b07e4f9a3c5d6e7f80eeee",
"round_id": "rnd_0193c4d2a1b07e4f9a3c5d6e7f80cccc",
"amount": "3.40",
"reference_transaction_id": null,
"round_closed": true,
"free_round": true,
"award_id": "fra_0193c4d2a1b07e4f9a3c5d6e7f80dddd",
"award_reference": "welcome-2026-12-u48213",
"free_round_number": 3,
"free_rounds_total": 20
}Responses
200 Success: {"balance": "<decimal string>"} with the balance **after** the ope
Success: {"balance": "<decimal string>"} with the balance after the operation. Or a definitive refusal / already-done answer: {"error": {"code", "message"}} (HTTP 200 is fine).
Schema (resolved)
{
"oneOf": [
{
"type": "object",
"required": [
"balance"
],
"properties": {
"balance": {
"type": "string",
"description": "Decimal string, at most the currency's decimals (2 fiat, 6 USDT/USDC/TRX, 8 BTC/ETH/LTC/SOL/DOGE). SPILVON always sends exactly the currency's decimals.",
"pattern": "^(0|[1-9]\\d{0,17})(\\.\\d{1,8})?$",
"examples": [
"10.00",
"0.00010000"
]
}
}
},
{
"type": "object",
"required": [
"error"
],
"properties": {
"error": {
"type": "object",
"required": [
"code"
],
"properties": {
"code": {
"type": "string",
"description": "Recognised codes and their effect:\n\n* Bet refusals (final, no rollback): `INSUFFICIENT_FUNDS`, `LIMIT_REACHED`,\n `PLAYER_BLOCKED`, `TOKEN_INVALID`, `TOKEN_EXPIRED`, `CURRENCY_MISMATCH`,\n `GAME_NOT_ALLOWED`.\n* Already done (win/rollback treated as acknowledged): `DUPLICATE_TRANSACTION`\n (only for an identical repeat); `TRANSACTION_NOT_FOUND` (rollback only).\n* Contract violations you must report this way (read by SPILVON as \"outcome\n unknown\", so they are retried and escalated): `TRANSACTION_MISMATCH` (id reused\n with other details, or a rollback that does not match its bet),\n `ROUND_ALREADY_SETTLED` (rollback after the round's win).\n* Anything else, including `INVALID_SIGNATURE` and `INTERNAL_ERROR`, means\n \"outcome unknown\".\n",
"examples": [
"INSUFFICIENT_FUNDS"
],
"anyOf": [
{
"enum": [
"INSUFFICIENT_FUNDS",
"LIMIT_REACHED",
"PLAYER_BLOCKED",
"TOKEN_INVALID",
"TOKEN_EXPIRED",
"CURRENCY_MISMATCH",
"GAME_NOT_ALLOWED",
"DUPLICATE_TRANSACTION",
"TRANSACTION_NOT_FOUND",
"TRANSACTION_MISMATCH",
"ROUND_ALREADY_SETTLED",
"INVALID_SIGNATURE",
"INTERNAL_ERROR"
]
},
{
"type": "string"
}
]
},
"message": {
"type": "string",
"description": "Optional text for your logs. Not shown to the player."
}
}
}
}
}
]
}Example · success
{
"balance": "987.50"
}Example · insufficient
{
"error": {
"code": "INSUFFICIENT_FUNDS",
"message": "not enough balance"
}
}Example · notFound
{
"error": {
"code": "TRANSACTION_NOT_FOUND",
"message": "no such bet; it will be refused if it arrives"
}
}Example · mismatch
{
"error": {
"code": "TRANSACTION_MISMATCH",
"message": "this transaction_id was already used with different details"
}
}4XX The same error body may be sent with a 4xx status (not 408 or 429, which me
The same error body may be sent with a 4xx status (not 408 or 429, which mean "unknown"). 401 with INVALID_SIGNATURE is the right answer to a request that fails verification (SPILVON treats it as outcome unknown and retries or rolls back).
errorobject · required
Schema (resolved)
{
"type": "object",
"required": [
"error"
],
"properties": {
"error": {
"type": "object",
"required": [
"code"
],
"properties": {
"code": {
"type": "string",
"description": "Recognised codes and their effect:\n\n* Bet refusals (final, no rollback): `INSUFFICIENT_FUNDS`, `LIMIT_REACHED`,\n `PLAYER_BLOCKED`, `TOKEN_INVALID`, `TOKEN_EXPIRED`, `CURRENCY_MISMATCH`,\n `GAME_NOT_ALLOWED`.\n* Already done (win/rollback treated as acknowledged): `DUPLICATE_TRANSACTION`\n (only for an identical repeat); `TRANSACTION_NOT_FOUND` (rollback only).\n* Contract violations you must report this way (read by SPILVON as \"outcome\n unknown\", so they are retried and escalated): `TRANSACTION_MISMATCH` (id reused\n with other details, or a rollback that does not match its bet),\n `ROUND_ALREADY_SETTLED` (rollback after the round's win).\n* Anything else, including `INVALID_SIGNATURE` and `INTERNAL_ERROR`, means\n \"outcome unknown\".\n",
"examples": [
"INSUFFICIENT_FUNDS"
],
"anyOf": [
{
"enum": [
"INSUFFICIENT_FUNDS",
"LIMIT_REACHED",
"PLAYER_BLOCKED",
"TOKEN_INVALID",
"TOKEN_EXPIRED",
"CURRENCY_MISMATCH",
"GAME_NOT_ALLOWED",
"DUPLICATE_TRANSACTION",
"TRANSACTION_NOT_FOUND",
"TRANSACTION_MISMATCH",
"ROUND_ALREADY_SETTLED",
"INVALID_SIGNATURE",
"INTERNAL_ERROR"
]
},
{
"type": "string"
}
]
},
"message": {
"type": "string",
"description": "Optional text for your logs. Not shown to the player."
}
}
}
}
}{
"error": {
"code": "INVALID_SIGNATURE",
"message": "signature check failed"
}
}Request signing samples
Canonical string and HMAC helpers from the downloadable samples. Wallet callbacks may also use Ed25519; see the wallet signing modes.
Node.js node/spilvon.mjs
export const signingString = (ts, method, pathAndQuery, body) => `${ts}.${method.toUpperCase()}.${pathAndQuery}.${body}`;
export const hmacHex = (secret, s) => createHmac("sha256", secret).update(s, "utf8").digest("hex");Python python/spilvon.py
def signing_string(ts: str, method: str, path_and_query: str, body: str) -> str:
return f"{ts}.{method.upper()}.{path_and_query}.{body}"
def hmac_hex(secret: str, s: str) -> str:
return hmac.new(secret.encode(), s.encode("utf-8"), hashlib.sha256).hexdigest()Go go/main.go
func signingString(ts, method, pathAndQuery, body string) string {
return ts + "." + strings.ToUpper(method) + "." + pathAndQuery + "." + body
}
func hmacHex(secret, s string) string {
m := hmac.New(sha256.New, []byte(secret))
m.Write([]byte(s))
return hex.EncodeToString(m.Sum(nil))
}PHP php/spilvon.php
function signing_string(string $ts, string $method, string $pathAndQuery, string $body): string {
return $ts . '.' . strtoupper($method) . '.' . $pathAndQuery . '.' . $body;
}
function hmac_hex(string $secret, string $s): string {
return hash_hmac('sha256', $s, $secret);
}Reviewed, not executed by the sample authors.