Skip to content
Back office

User Balance (Site Endpoint)

Called to retrieve the current balance for a user before or during gameplay.

Markdown

Endpoint

POST https://{YOUR_SITE}/gold_api

Content-Type: application/json

Method: user_balance

Request

JSON
{
    "method": "user_balance",
    "agent_code": "your_agent_code",
    "agent_secret": "your_agent_secret",
    "user_code": "test",
    "user_token": "c3041c6d9146a164387fa454eff7b432",
    "game_code": "vs20olympgate"
}
FieldTypeRequiredDescription
methodstringYesMust be user_balance
agent_codestringYesAgent code
agent_secretstringYesAgent secret key
user_codestringYesUser identifier
user_tokenstringYesUser session token
game_codestringNoGame being played. Can be missing or empty (e.g. for sportsbook)

Response

Success

Return balance even if it is 0:

JSON
{
    "status": 1,
    "user_balance": 0
}

Failure

JSON
{
    "status": 0,
    "user_balance": 0,
    "msg": "INTERNAL_ERROR"
}

Any status other than 1 is a failure, and so is no answer within 5 seconds, a network error or an HTTP status other than 2xx: the balance request then fails. The user_balance and msg of a failure answer are not used (msg is only logged).