Cancel tip
Live{base}/api/cancel-tipSent when a tip is cancelled. Credit the previously debited tip back to the player's wallet.
Process the whole txns[] batch in one DB transaction (atomic) — if any txn fails, roll back the batch and reply an error with balance_before == balance_after
If the same txn_id arrives again, do not apply it a second time; reply the current balance with code 0, or reply 20002. The only exception is a transaction that follows a /rollback of that round: it carries a corrected result and must be applied (see "re-settle after rollback" on the Contract page).
A 0 amount is real — a feature spin, a bought feature, a tip, or a stake the provider could not supply. Do not reject it: process it as a zero-value transaction and reply code 0 without moving the balance.
Always reply HTTP 200 even for business errors
Headers
| Field | Type | Required | Description |
|---|---|---|---|
| X-Api-Key | string | Yes | The API key best-system issued to you (verify it matches) |
| X-Signature | string | Yes | hex(HMAC-SHA256(secret, raw body)) — verify against the raw bytes, never re-serialize. Mismatch → code 30002 |
Request bodyapplication/json
| Field | Type | Required | Description |
|---|---|---|---|
| request_id | string | Yes | Id of this request |
| player_username | string | Yes | The player's username on your system |
| currency | string | Yes | The player's currency code in ISO 4217, e.g. THB |
| product_code | string | — | Game-provider code (e.g. PGSOFT) |
| timestamp | number | Yes | Send time in unix milliseconds |
| txns | object[] | Yes | Cancelled tips — amount = the tip to credit back |
| └ txn_id | string | Yes | Transaction ID. Used as the idempotency key (see the notes) |
| └ round_id | string | Yes | Round ID |
| └ amount | number | Yes | Amount for this transaction, never negative and may be 0 (see the notes). Direction comes from the endpoint or the direction field |
| └ game_code | string | — | Game code |
| └ is_feature | boolean | — | Whether this is a free or feature spin. Absent means false |
| └ status | string | — | Vendor bet status. Always REFUND — the same value as /refund; tell them apart by endpoint, not statusOPEN | WAITING | SETTLED | REFUND | REJECT | ROLLBACK | VOID | TIPS |
| └ play_info | string | — | The player's position or choice, e.g. player/banker, or the game name. `UNKNOWN` means the provider could not identify it — display only |
| └ transaction_type | string | — | Either BY_TRANSACTION or BY_ROUND (see the notes)BY_TRANSACTION | BY_ROUND |
| └ bet_amount | number | — | The vendor's stake. Same value as this callback's amount |
| └ ref_txn_id | string | Yes | txn_id of the original tip being cancelled — must be a tip actually debited on your system; not found → reply 20001 |
{
"request_id": "e5f6a7b8-c9d0-4123-a4b5-c6d7e8f90a1b",
"player_username": "foobar",
"currency": "THB",
"timestamp": 1783236607000,
"txns": [
{
"txn_id": "T-006",
"round_id": "R-1",
"amount": 50,
"is_feature": false,
"ref_txn_id": "T-005"
}
]
}Expected Response
Fields in data
| Field | Type | Required | Description |
|---|---|---|---|
| code | number | Yes | 0 = success · see the Seamless codes page |
| request_id | string | Yes | Echoed from the request |
| username | string | Yes | Echo of player_username (defensive) |
| currency | string | Yes | Echoed from the request |
| balance_before | number | Yes | Balance before processing the whole txns[] batch |
| balance_after | number | Yes | Balance after processing the whole batch |
| timestamp | number | Yes | When you processed it (unix ms) |
{
"code": 0,
"request_id": "e5f6a7b8-c9d0-4123-a4b5-c6d7e8f90a1b",
"username": "foobar",
"currency": "THB",
"balance_before": 1000,
"balance_after": 1050,
"timestamp": 1783236607091
}Possible error codes
| code | Name | HTTP | Message |
|---|---|---|---|
| 10001 | SEAMLESS_USER_NOT_FOUND | 200 | Player not found on the agent system |
| 20001 | SEAMLESS_TXN_NOT_FOUND | 200 | Referenced transaction (ref_txn_id) not found |
| 20002 | SEAMLESS_DUPLICATE_TXN | 200 | Duplicate transaction (txn_id already processed) |
| 30002 | SEAMLESS_INVALID_SIGNATURE | 401 | Invalid X-Signature |
| 40003 | SEAMLESS_FORBIDDEN | 200 | Forbidden (api-key/IP) |
| 50001 | SEAMLESS_INTERNAL_ERROR | 200 | Internal error on the agent system |