Signature Validation
Last updated
Last updated
Payright signature authentication enhances API security by generating a unique signature for every request. This mechanism ensures both the validity and integrity of API interactions. Each signature contains iat
(issued at) and exp
(expires at) fields, giving merchants flexibility to define the request's expiration timeframe. Merchants can choose to activate or deactivate this feature depending on their specific security preferences.
Merchants can manage the signature feature by navigating to Account > API Keys > Edit > JWT Verification, where they can enable or disable it as needed.
Once enabled, the system will validate each incoming API request by encoding the following payload using JWT with the HS256 algorithm.
Request Header Injection
Merchant application must generate a JWT-encoded (HS256) signature of the JSON object using the hash key as the secret key. This hash key is available in the Merchant Portal, and the resulting encoded output will be used as the X-Signature.
The generated X-Signature is added to the request headers. These headers will contain the following:
x-signature
: The HMAC-SHA256 signature.
The server verifies the X-Signature by reconstructing the message and comparing it with the signature included in the header. If the two signatures align, the request is deemed valid and proceeds for processing.
An example of an API request header with an HMAC signature and supplementary headers is shown below: