Create Signature

Signature generation and verification is mandatory to ensure the request being called is not tampered during the transit.

Overview

The signature generation process involves creating a unique cryptographic hash value based on payment parameters and your merchant private key to ensure data integrity and authenticity.

Process

  • Generate signature when you are creating a new payment.

  • Construct String: Concatenate the necessary parameters into a single string before applying the hash function. The parameters typically include:

    • order_id: The unique identifier for the order or transaction.

    • merchant_public: The public key of your merchant.

    • amount: The amount of the transaction.

    • merchant_private: The private key of the merchant.

  • Apply Hash Function: Use a secure hashing algorithm such as SHA-256 to calculate the hash value of the before-hash string.

  • Pass the signature variable along with other parameters to the 'New Payment' endpoint.

Sample code in Javascript

import sha256 from 'crypto'; //Install crypto package

const merchantPublic = process.env.MERCHANT_PUBLIC;
const merchantPrivate = process.env.MERCHANT_PRIVATE;

const string = order_id + merchantPublic + amount + merchantPrivate;
const signature = sha256(string); //Sha256, hex digest

Last updated