Wallet callbacks
The calls the platform makes to your wallet, what each expects back, and how to make them idempotent.
Each call is a POST to your wallet URL plus the path, sent as application/x-www-form-urlencoded and signed as Signatures describes. Answer with JSON within 10 seconds. The platform does not follow a redirect. How the platform reads your error is on Errors. Which call a trade or a market sends is on Market lifecycle.
Changed in v1.1 (Changes from v1.0):
/endRoundis no longer sent. You may keep the route./roundDetailsand/adjustmentare not part of the protocol.gameIdandroundIdcarry the market slug.amountis sent at the currency’s precision:12.50in TRY, never12.5.
Idempotency on reference
/bet,/resultand/refundcarry areference. Apply eachreferenceonce. When areferenceyou already applied arrives again, move no money and answererror0or8.- A
/betis never sent twice. - A
/resultor/refundwithout a readable answer is sent again: 17 attempts, the first after 1 second, each wait twice the last (about 18 hours). A credit you refuse, or one whose attempts run out, becomes a pending payment. A person may send it again later, under the samereference. - Each attempt carries a new
timestamp, so itshashchanges. Match onreference, never onhash. /resultand/refundare sent whether or not the player session is open and whatever the status of your operator: the money is owed.
/authenticate
Sent when the player app opens the launch token. It confirms the player and sets the bet limits.
The same token can arrive more than once while the player session is open: each time the player app is opened with it, for example after a relaunch that continues the session. Confirm the player each time; the launch token is not single-use. A refusal signs the player out of every open tab of that session.
POST /authenticate
Content-Type: application/x-www-form-urlencoded
token=5f2b9c0e7a1d4b3f8e6c2a9d0b7f4e1c&operatorId=3f1c2b7e-8a4d-4e6b-9c1a-2d5e7f0a1b3c&userId=player-1001&gameId=prediction&hash=2bda678a708026b28f2c4d320d49ee2dHTTP/1.1 200
Content-Type: application/json
{
"userId": "player-1001",
"currency": "TRY",
"cash": 1000,
"bonus": 0,
"betLimits": {
"minBet": 1,
"maxBet": 5000
},
"error": 0,
"description": "OK"
}tokenis the launch token,userIdyourexternalPlayerId, andgameIdis alwaysprediction.- Only
errorandbetLimitsare read.minBetandmaxBetmust be JSON numbers,0or more; otherwise the player is refused.0means no bound on that side. WhenmaxBetis above0,minBetmust not be greater than it. - The limits bound the stake of a buy and of a limit BUY order. A sell is not bounded.
Changed in v1.1 (Changes from v1.0): operatorId is your operator’s lifetime id, a UUID.
/balance
Sent each time the player app shows the balance.
POST /balance
Content-Type: application/x-www-form-urlencoded
hash=5f83de86d51d033abd25b1b44f3f82ca&userId=player-1001HTTP/1.1 200
Content-Type: application/json
{
"currency": "TRY",
"cash": 1000,
"bonus": 0,
"totalBalance": 1000,
"error": 0,
"description": "OK"
}cashmust be a JSON number.bonusis optional.- If you send
currency, it must be the session’s currency. - Any other answer shows the player an unknown balance, never
0.
/bet
Takes a stake: a buy’s, or a limit BUY order’s escrow.
POST /bet
Content-Type: application/x-www-form-urlencoded
hash=682833f2db99bbf90975d9f4273d8c82&userId=player-1001&token=5f2b9c0e7a1d4b3f8e6c2a9d0b7f4e1c&gameId=btc-above-100k-2026-12-31&roundId=btc-above-100k-2026-12-31&amount=12.50&reference=7c9e6679-7425-40de-944b-e07fc1f90ae7×tamp=1793793600000&roundDetails=%7B%22action%22%3A%22BUY%22%2C%22outcomeKey%22%3A%22yes%22%2C%22amount%22%3A%2212.50%22%7DHTTP/1.1 200
Content-Type: application/json
{
"transactionId": "op-tx-1",
"currency": "TRY",
"cash": 987.5,
"bonus": 0,
"usedPromo": 0,
"error": 0,
"description": "OK"
}tokenis the launch token of the player’s open session. You may check it.referenceis the trade’s id. A later/refundof this stake uses it.roundDetailsis JSON, for your records.actionisBUY(withoutcomeKeyandamountorshares) orPLACE_ORDER(withoutcomeKey,direction,sharesandlimitPrice).- Only
errorand an optionaltransactionIdare read.
A /bet you refuse, with any error other than 0 or 8: the trade does not happen, and nothing follows.
HTTP/1.1 200
Content-Type: application/json
{
"error": 1,
"description": "Insufficient balance"
}A /bet whose answer the platform cannot read, such as a 5xx, a time-out or a body without a numeric error: the trade does not happen, and the whole stake is given back by the /refund below, under the same reference.
HTTP/1.1 503
Content-Type: application/json
{
"description": "Service Unavailable"
}Changed in v1.1 (Changes from v1.0): /bet always carries the launch token, inside the signature. A /bet you refuse is not followed by a /refund.
/result
Pays the player: a sell’s proceeds, an order’s fill or a market’s payout.
POST /result
Content-Type: application/x-www-form-urlencoded
hash=0307fcf262c867d2d2bd3d22c464ba34&userId=player-1001&gameId=btc-above-100k-2026-12-31&roundId=btc-above-100k-2026-12-31&amount=25.00&reference=9b2d4f61-3c8a-4e17-b5d0-6a1f2e9c7b84×tamp=1793793600000&roundDetails=%7B%22action%22%3A%22SELL%22%7DHTTP/1.1 200
Content-Type: application/json
{
"transactionId": "op-tx-3",
"currency": "TRY",
"cash": 1000.26,
"bonus": 0,
"error": 0,
"description": "OK"
}roundDetails.actionisSELL,ORDER_FILL, orCLAIMwithstatusRESOLVEDorCANCELLED.- Only
errorand an optionaltransactionIdare read.
/refund
Gives back money a /bet took. It carries no roundDetails.
POST /refund
Content-Type: application/x-www-form-urlencoded
hash=f6605684a330c4f4b1927f5e38f6eaf3&userId=player-1001&reference=7c9e6679-7425-40de-944b-e07fc1f90ae7&amount=12.50&gameId=btc-above-100k-2026-12-31&roundId=btc-above-100k-2026-12-31×tamp=1793793600000HTTP/1.1 200
Content-Type: application/json
{
"transactionId": "op-tx-7",
"error": 0,
"description": "OK"
}reference | Gives back |
|---|---|
<stake reference> | the whole stake |
<stake reference>:remainder | the part of a buy’s stake the buy did not spend |
<stake reference>:cancel-refund | a limit BUY order’s unspent escrow, when the order is cancelled or the market stops trading |
The /refund rule. A /refund of a stake you never charged moves nothing and answers error 0. It happens when a /bet got no answer the platform could read. A /bet you refused is never followed by a /refund.
Changed in v1.1 (Changes from v1.0): the /refund rule above. The :cancel-refund reference of a cancelled order’s give-back is as in v1.0, now written down.
The /refund of a /bet without a readable answer can reach you before your wallet has finished that /bet, for example when your answer took longer than 10 seconds: keep the reference of every /refund you answered, and take no money for a /bet under that reference processed after it. Handle a /bet and a /refund of the same reference one at a time.
/session/expired
Tells you a player session ended: idle time-out, a relaunch, your close, a logout, your operator paused or archived, or a key rotation.
POST /session/expired
Content-Type: application/x-www-form-urlencoded
hash=7ca77861a7fbc701d893ba76d57bdb2c&sessionId=5f2b9c0e7a1d4b3f8e6c2a9d0b7f4e1c&playerId=player-1001HTTP/1.1 200
Content-Type: application/json
{
"error": 0,
"description": "OK"
}sessionIdis the session’s launch token, not the launch answer’ssessionId.playerIdis yourexternalPlayerId.- An answer with a numeric
error, whatever its value, or an HTTP 4xx counts as delivered. Anything else is sent again on the schedule of a credit (above).