Get Balance
GET/api/v1/user-api/getBalance/:key/:checksum/:timestamp
Returns the user's current account balance.
The balance is returned in the message field, formatted as a decimal string.
Checksum
sha256({crc32(client_id)}{api_key}GetBalance{timestamp})
Values are concatenated directly without any separator. crc32(client_id) is the CRC32 hash of your client ID. Note the PascalCase GetBalance.
The timestamp is accepted when it is at most 6000 seconds (100 minutes) old. Timestamps in the future are not rejected.
Error handling
Every error is returned with HTTP 200. Do not branch on the status code - always read the status field, which is false on failure.
code | message | Cause |
|---|---|---|
| (none) | Invalid key | key is not a 32-character hexadecimal string |
| (none) | Api key does not exist! | No API key matches key |
BAD_CHECKSUM | Invalid key! | checksum is not a 64-character hexadecimal string. Despite the wording, this is a checksum problem, not a key problem. |
BAD_TIMESTAMP | Bad timestamp! | timestamp is more than 6000 seconds in the past |
BAD_CHECKSUM | Bad checksum! | The computed checksum does not match the one supplied |
USAGE_NOT_AUTHORIZED | Function is not allowed! | The get_balance permission is not enabled for this API key - contact dpay support |
The first two errors carry no code field, so match them on message.
Request
Responses
- 200
Balance info or an error - both share HTTP 200. Check the status field to tell them apart.