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
| Item | Name | Sample |
|---|---|---|
| Path | Path | <MerchantHost>/debit Like: http://www.game.com/debit |
| Request Method | Post |
Request Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| Sign Params | Y | API Integration Specification | |
| biz_id | string | Y | Transaction ID, globally unique, used for idempotency |
| round_id | string | Y | Game Round ID |
| game_id | int | N | Game ID |
| game_code | string | Y | Game index used to retrieve game data |
| user_id | string | Y | User Unique Identifier |
| currency | string | Y | Currency |
| amount | string | Y | Amount |
| reason | string | Y | Description |
| game_name | string | Y | game name |
Return Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| code | int | Y | |
| msg | string | Y | Error description for the code |
| data | object | Y | Body |
| data.balance | object | Y | Balance object |
| balance.user_id | string | Y | User unique identifier |
| balance.currency | string | Y | Currency |
| balance.amount | string | Y | Amount |
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"
}
}
}