Authentication - V2

The EllyPay API V2 uses a key pair (API and Secret Keys) for authentication. To make an authenticated request to our API, you need to pass 4 (four) custom headers as described in this section.

Obtain the Keys

The API and Secret keys are shared in the email that's sent to you when your account is approved. These keys should sent as headers with the header names; ApiKey and SecretKey

Please ensure that your keys are stored safely and not shared with the public. In the event your keys are compromised, please contact us immediately for assistance. Please equally note the all requests will be from whitelisted IP(s) only.

Generate Request Signature

The third header is the request signature with the header name; Signature and it is generated by concatenating the API Key and the current timestamp in milliseconds. The concatenation is in the format; timestamp:ApiKey and below is the description of how the signature is generated. The final value sent in the signature header takes the format t=timestamp,s=hmac_hash

<?php
function generateSignature() {
    $apiKey = "EPYPUB-****";
    $secretKey = "EPYSEC-****";
    $milliseconds = microtime(true) * 1000; /*get current timestamp in milliseconds*/

    $stringToSign = $milliseconds.":".$apiKey;
    $hash = hash_hmac('sha256', $stringToSign, $secretKey, false);
    
    return "t=".$milliseconds.",s=".$hash;
}
?>

For V2 of the API to behave as expected, the fourth mandatory parameter X-API-Version needs to be passed and with the value as 2. When this header is omitted completely, the API will default to the V1 (old) authenticaiton requirements. Please also note that a value greater than 2 will not be accepted unless further improvements allow it so.

Request Headers

For all the API requests on V2, the following headers are required for the requests to succeed. These headers are obtained as described above.

Last updated