Skip to content

Debit

Description

  • This interface is called when a player places a bet.
  • Verifies if the player has sufficient balance, deducts the amount, and returns the player's remaining balance.
  • If no response is received from the operator due to network or other factors, the player's bet will be cancelled.
  • Ensure transactional integrity of the debit operation to maintain atomicity and prevent partial success scenarios.
  • The interface must be idempotent, using biz_id as the idempotency key. For duplicate requests, return the result of the first successful request.

Request Method

ItemNameSample
PathPath<MerchantHost>/debit
Like: http://www.game.com/debit
Request MethodPost

Request Parameters

NameTypeRequiredDescription
Sign ParamsYAPI Integration Specification
biz_idstringYTransaction ID, globally unique, used for idempotency
round_idstringYGame Round ID
game_idintNGame ID
game_codestringYGame index used to retrieve game data
user_idstringYUser Unique Identifier
currencystringYCurrency
amountstringYAmount
reasonstringYDescription
game_namestringYgame name

Return Parameters

NameTypeRequiredDescription
codeintY
msgstringYError description for the code
dataobjectYBody
data.balanceobjectYBalance object
balance.user_idstringYUser unique identifier
balance.currencystringYCurrency
balance.amountstringYAmount

Request Example

Http Request
    Post Method
    URL : <MerchantHost>/debit?mid=1697028447&sign=7e0c05f463f4a4111202b948f20a10d77263d5bb347ff2f339e77ef32062556e&ts=1713768205
    Content-Type:application/json
    {"biz_id":"1782299428894699520","round_id":"1782299428861145088","game_code":"gp_classic_4","user_id":"jUhNj+meQ16inuksiKj0zR88","currency":"PHP","amount":"12.52","reason":"","game_name":"scratch_match"}

Http Response(success)
    {
        "code": 0,
        "msg": "",
        "data": {
            "balance": {
                "amount": "23.12",
                "currency": "PHP",
                "user_id": "jUhNj+meQ16inuksiKj0zR88"
            }
        }
    }