Cancel Debit
/cancelDebit
During a debit transaction, there may be some cases where the transaction should be cancelled. The Cancel API is designed to deal with exceptions received from the merchant (i.e. when the server disconnects, or an invalid error response is returned from the merchant’s end). In that case, a new transaction is created to cancel the debited amount. Cancel transactions are generated in response to the following events or errors received:
- No response is received from the merchant when no more bets are accepted.
- The merchant sends an exception.
When the merchant receives a cancel transaction, the main procedure should be as follows:
- If the debit transaction (with the provided transactionIdToCancel) has been accepted by the merchant (the balance was decreased), the cancel for the transaction must be processed. The balance should increase based on the cancel amount.
- If the debit transaction (with the provided transactionIdToCancel) has NOT been accepted by the merchant (the balance was not decreased), the cancel MUST be ignored to prevent the balance from unnecessarily changing. Yet reply with a proper response that the balance was not changed.

4.8.1 Cancel Debit Request
| Parameter Name | Data Type | Description | Required/Optional |
|---|---|---|---|
| merchantId | String | Merchant ID | Required |
| timestamp | long | Time representation in UNIX milliseconds format. | Required |
| betIdToCancel | UUID | HPGames debit bet id to be canceled | Required |
| transactionIdToCancel | UUID | HPGames debit transaction id to be canceled | Required |
| transactionId | UUID | Unique HPGames transaction id reference | Required |
| created | Datetime | Datetime when bet is created (ISO format in UTC timezone with 6 digits of precision) | Required |
| hash | String | String to Encode: merchantId + transactionIdToCancel + timestamp HMAC SHA256 Code Snippet | Required |
| playerId | String | Merchant’s unique identification for each player | Required |
| gameId | int | Unique HPGames game id | Optional |
| currency | String | The currency of the balance, Currency code (ISO 421) | Optional |
| authToken | String | Game session id | Required |
| amount | decimal | Amount to be credited to the player’s wallet | Required |
Request example:
{
"merchantId": "21385394-6dda-4171-a003-02fa4a975643",
"timestamp": 1643727556,
"betIdToCancel": "2185a9a1-1497-41bd-937d-cbce3fae8961",
"transactionIdToCancel": "1185a9a1-1497-41bd-937d-cbce3fae8961",
"transactionId": "5f95f6d2-3e61-4434-96b8-07905f0fd557",
"hash": "ee7aaaedbbb93d0e9c9db659a910be9b",
"playerId": "d02b5979-6d2a-4830-80e2-bf3fa608a2f2",
"gameId": 200100,
"currency": "EUR",
"authToken": "b5e10b6b-4d88-475c-9496-a461052a8448",
"amount": 10
}
4.8.2 Cancel Debit Response
| Parameter Name | Data Type | Description | Required/Optional |
|---|---|---|---|
| balance | decimal | Player’s wallet balance | Required |
| currency | String | The currency of user balance, Currency code (ISO 4217) | Required |
| accountTransactionId | String | Merchant’s transaction id | Required |
| transactionId | String | HPGames transaction id | Required |
| errorCode | int | Error code, default 0 | Optional |
| errorText | String | Error message | Optional |
Response example:
{
"errorCode": 0,
"errorText": "",
"balance": 1000.5,
"currency": "EUR",
"accountTransactionId": "3c930b71-1f97-4b2a-aba0-f62c36e0cd09",
"transactionId": "5f95f6d2-3e61-4434-96b8-07905f0fd557"
}
4.9 Bulk Cancel Debit
/bulkCancelDebit
Hash is calculated for each credit request separately.
4.9.1 Bulk Cancel Debit Request
| Parameter Name | Data Type | Description | Required/Optional |
|---|---|---|---|
| cancelDebitRequests | List<CancelDebitRequest> | List of Cancel Debit Requests described in 4.8.1 | Required |
Request example:
{
"cancelDebitRequests": [
{
"merchantId": "21385394-6dda-4171-a003-02fa4a975643",
"timestamp": 1643727556,
"betIdToCancel": "2185a9a1-1497-41bd-937d-cbce3fae8961",
"transactionIdToCancel": "1185a9a1-1497-41bd-937d-cbce3fae8961",
"transactionId": "5f95f6d2-3e61-4434-96b8-07905f0fd557",
"hash": "ee7aaaedbbb93d0e9c9db659a910be9b",
"playerId": "d02b5979-6d2a-4830-80e2-bf3fa608a2f2",
"gameId": 200100,
"currency": "EUR",
"authToken": "b5e10b6b-4d88-475c-9496-a461052a8448",
"amount": 10
}
]
}
4.9.2 Bulk Cancel Debit Response
| Parameter Name | Data Type | Description | Required/Optional |
|---|---|---|---|
| cancelDebitResponses | List<CancelDebitResponse> | List of Cancel Debit Responses described in 4.8.2 | Required |
Response example:
{
"cancelDebitResponses": [
{
"errorCode": 0,
"errorText": "",
"balance": 1000.5,
"currency": "EUR",
"accountTransactionId": "3c930b71-1f97-4b2a-aba0-f62c36e0cd09",
"transactionId": "5f95f6d2-3e61-4434-96b8-07905f0fd557"
}
]
}