Generating Signature and Making API Requests

This section of the documentation explains how to generate a signature for requests and how to make requests to the E-Gates API to work with the payment method.

Generating a Signature

  1. Prepare Parameters: For each request, prepare the parameters that will be passed. Include all necessary parameters in the request.

  2. Create Query String: Formulate the query string, including all sorted parameters in the format key=value, separated by the & symbol.

  3. Sign Query String: Use your private key to create a signature for the query string. Depending on the programming language you're using, you can use the following functions:

    In PHP:

    $queryString = urldecode(http_build_query($params));
    $signature = hash_hmac('sha256', $queryString, $secretKey);

    In JavaScript (using CryptoJS library):

    let queryString = Object.keys(paramsObject).map((key) => {
            return `${key}=${paramsObject[key]}`;
        }).join('&');
    let signature = CryptoJS.HmacSHA256(queryString, secretKey).toString();

Making API Requests

  1. Set Headers: When making a request, set the following headers:

    • API-KEY: The value of the API key you created in your account.

    • SIGNATURE: The signature generated in the previous step.

    • CONNECTION-TOKEN: Token, generated by the Administrator and transmitted to the client

  2. Make Request: Use the programming language of your choice to perform an HTTP request to the E-Gates API. Pass all necessary parameters, headers, and the signature in the request.

  3. Process Result: Handle the API response. Typically, successful responses contain required information, such as created invoices or other details.

    Headers

    • CONNECTION-TOKEN {{connection-token}}: Connection token, required for authentication.

    • API-KEY {{api-key}}: API key for authentication.

    • Content-Type application/json: Content type in the request body (JSON).

    • Accept application/json: The expected data type in the response.

Conclusion

Following this guide, you'll be able to successfully generate signatures for requests and interact with the E-Gates API to work with the payment method. Please ensure you follow all security measures and provide accurate parameters when forming requests and signatures.

Last updated