Skip to main content

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:

  1. No response is received from the merchant when no more bets are accepted.
  2. 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.

Debit

4.8.1 Cancel Debit Request

Parameter NameData TypeDescriptionRequired/Optional
merchantIdStringMerchant IDRequired
timestamplongTime representation in UNIX milliseconds format.Required
betIdToCancelUUIDHPGames debit bet id to be canceledRequired
transactionIdToCancelUUIDHPGames debit transaction id to be canceledRequired
transactionIdUUIDUnique HPGames transaction id referenceRequired
createdDatetimeDatetime when bet is created (ISO format in UTC timezone with 6 digits of precision)Required
hashStringString to Encode: merchantId + transactionIdToCancel + timestamp
HMAC SHA256 Code Snippet
Required
playerIdStringMerchant’s unique identification for each playerRequired
gameIdintUnique HPGames game idOptional
currencyStringThe currency of the balance, Currency code (ISO 421)Optional
authTokenStringGame session idRequired
amountdecimalAmount to be credited to the player’s walletRequired

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 NameData TypeDescriptionRequired/Optional
balancedecimalPlayer’s wallet balanceRequired
currencyStringThe currency of user balance, Currency code (ISO 4217)Required
accountTransactionIdStringMerchant’s transaction idRequired
transactionIdStringHPGames transaction idRequired
errorCodeintError code, default 0Optional
errorTextStringError messageOptional

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 NameData TypeDescriptionRequired/Optional
cancelDebitRequestsList<CancelDebitRequest>List of Cancel Debit Requests described in 4.8.1Required

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 NameData TypeDescriptionRequired/Optional
cancelDebitResponsesList<CancelDebitResponse>List of Cancel Debit Responses described in 4.8.2Required

Response example:

{
"cancelDebitResponses": [
{
"errorCode": 0,
"errorText": "",
"balance": 1000.5,
"currency": "EUR",
"accountTransactionId": "3c930b71-1f97-4b2a-aba0-f62c36e0cd09",
"transactionId": "5f95f6d2-3e61-4434-96b8-07905f0fd557"
}
]
}