Api endpoint:
https://merchant.blackhatco.in/api/<methodName>
Where <methodName> is a proper API method (see below).
The request parameters can be passed through POST or GET method (only one method should be used for all request parameters, POST is in priority)
To use the API interface you need to obtain API key and API secret key in "Settings" menu.
ATTENTION! It's only possible to see the generated API keys right after their generation. It's recommended to copy them to the safe place. You are also able to re-generate the API keys, but keep in mind that the old ones will stop working immediately.
For the security reasons, it's possible to whitelist IP addresses from which is planned to make API requests.
Making an authorized API request:
Required parameters for each request
- key: your API key
- ts: current timestamp (with milliseconds, always should be higher than in previous request)
- parameters required by the API method (see the API methods description below)
- sign: hmac sha256 signed hash of the request (API secret key is used)
Example:
Source data (example values):
- API Key: dd181df0c163c9271530eb5f165c6a63
- API secret Key: c8b67c66595af67a78ece3cb881491a2
- Method: getInvoice, invoice_id=0549991d-e3ea-476b-a8fa-5921a257c33a
The method's payload will be look like:
key=dd181df0c163c9271530eb5f165c6a63
ts=1651480109.1231
invoice_id=0549991d-e3ea-476b-a8fa-5921a257c33a
The string should be created from the request parameters and values sorted alphabetically by parameters names, like this:
invoice_id=0549991d-e3ea-476b-a8fa-5921a257c33a&key=dd181df0c163c9271530eb5f165c6a63&ts=1651480109.1231
Hashing this string with hmac sha256 using our API secret key we get this:
24ba6a52cf45b6f4dd542ed4016970a7db04e34a975dcca891fcd0010a2ad968
This is will be our sign value.
So, our final request payload will be look like:
key=dd181df0c163c9271530eb5f165c6a63
ts=1651480109.1231
invoice_id=0549991d-e3ea-476b-a8fa-5921a257c33a
sign=24ba6a52cf45b6f4dd542ed4016970a7db04e34a975dcca891fcd0010a2ad968