Skip to main content

Bet Endpoint

This document describes the Bet endpoint for Klas Gaming Casino integration. This endpoint is used to withdraw funds from the player account. The operation is idempotent: if the wallet receives more than one request with the same transfer_id, the transaction must be registered only once.


Endpoint

POST {WEBHOOK_URL}/bet

Note: {WEBHOOK_URL} is the webhook URL provided by the operator. Klas Gaming will send POST requests to this endpoint.


Headers

  • X-Signature: HMAC-SHA256 signature for message integrity (see Security Headers)
  • Content-Type: application/json

Request Body

{
"request_id": "string",
// Required. Unique request identifier.
"timestamp": 1234567890,
// Required. Timestamp of the request (number).
"session_id": "string"",
// Required. Unique session identifier.
"player_id": "string",
// Required. Unique player identifier from operator system.
"game_code": "string",
// Required. Game key of the active player's game.
"transfer_id": "string",
// Required. Unique reference of the transaction.
"round_id": "string",
// Required. Unique reference of the game round.
"round_completed": true,
// Required. Specify if this is the last transaction for the current round (boolean).
"amount": "100",
// Required. Transfer amount.
"currency": "EUR",
// Required. Currency code (ISO-4217, e.g., EUR, USD).
"reason": "BET",
// Required. Transfer reason.
"gift_spin": {
// Optional. Object with bonus/campaign info.
// ...
}
}
ParameterTypeMandatoryDescription
request_idstringYesUnique request identifier.
timestampnumberYesTimestamp of the request.
session_idstringYesUnique identifier of the current player session.
player_idstringYesUnique identifier of the player from the operator's system.
game_codestringYesGame key of the active player's game.
transfer_idstringYesUnique reference of the transaction.
round_idstringYesUnique reference of the game round.
round_completedbooleanYesSpecify if this is the last transaction for the current round.
amountstringYesTransfer amount.
currencystringYesCurrency code (ISO-4217, e.g., EUR, USD).
reasonstringYesTransfer reason.
gift_spinobjectNoObject with bonus/campaign info (bonus code, campaign id, spins, etc.).

Response Body

{
"balance": "30",
// Player balance (e.g., 30 EUR)
"casino_transfer_id": "string",
// Unique reference of the transfer created in the operator's system
"bonus_amount": "0",
// Amount withdrawn from player's bonus money account
"real_amount": "100",
// Amount withdrawn from player's real money account
"status_code": "OK"
// Status code of the execution
}
ParameterTypeMandatoryDescription
balancestringYesPlayer balance (EUR 30).
casino_transfer_idstringYesUnique reference of the transfer created in the operator's system.
bonus_amountstringYesAmount withdrawn from the player's bonus money account. Return 0 if the operator's backend does not support bonus money. Example: If a player bets 100 units and 30 units are from bonus money, then bonus_amount = 30.
real_amountstringYesAmount withdrawn from the player's real money account. If the operator's backend does not support bonus money, then the value of this field should be equal to the amount of the transaction request. Example: If a player bets 100 units and 70 units are from real money, then real_amount = 70.
status_codestringYesStatus code of the execution.

Note:

  • If your backend does not support bonus money, always set bonus_amount to 0 and real_amount to the full transaction amount.
  • These fields help distinguish between real and bonus funds used in a transaction.

Possible Status Codes

Status CodeReason
OKRequest successful
ERR_INTEGRITY_CHECK_FAILEDMessage integrity check failed
ERR_NOT_ENOUGH_MONEYPlayer account does not have sufficient funds
ERR_LIMIT_REACHEDPlayer has exceeded his game limits (responsible gaming)
ERR_UNKNOWNInternal server error
ERR_TIMEOUTTimeout exception

Flow Description

  1. Klas Gaming sends a POST request to /bet with the required fields and headers.
  2. The backend processes the request, withdraws the funds, and returns the updated balance and transaction details.
  3. The response includes the player's balance, transaction references, and a status code indicating the result.

Example Request

curl -X POST https://<your-api>/bet \
-H "Content-Type: application/json" \
-H "X-Signature: <hmac_signature>" \
-d '{
"request_id": "1234-5678-90ab-cdef12345678",
"timestamp": 1710000000,
"session_id": "1234-5678-90ab-cdef12345678",
"player_id": "12001",
"game_code": "ABSlot",
"transfer_id": "1234-5678-90ab-cdef12345678",
"round_id": "1234-5678-90ab-cdef12345678",
"round_completed": true,
"amount": "100",
"currency": "EUR",
"reason": "BET",
"gift_spin": {}
}'

Example Response

{
"balance": "30",
"casino_transfer_id": "operator_tx_1234-5678-90ab-cdef12345678",
"bonus_amount": "0",
"real_amount": "100",
"status_code": "OK"
}

Notes

-- The operation is idempotent: if the same transfer_id is used more than once, the transaction is only registered once.

  • All requests must be signed using the HMAC mechanism described in Security Headers.
  • For more details, refer to the Klas Gaming integration documentation or contact your integration representative.