Callbacks
To ensure the authenticity and security of callback notifications sent from our API to your systems, each notification includes a signature in the HTTP headers under the key signature
. This signature allows you to validate that the notification originated from us and was not tampered with during transmission.
Signature Generation
1. Payload and Customer Identification
Each notification has a unique payload (payload
) and is associated with a specific customer (customerUuid
).
2. Data to Be Signed
We concatenate the payload and customer UUID in the following format:
{payload}+{customerUuid}
• payload: The JSON stringified body of the callback notification. • customerUuid: The unique identifier of your account.
3. Key for Signing
We use a secret API key (api_key) associated with your account to generate the signature. This key is securely stored and unique for each customer.
4. Hash Algorithm
We use the HMAC (Hash-Based Message Authentication Code) algorithm with SHA-256 to compute the signature. The formula is:
signature = HMAC_SHA256(api_key, "{payload}+{customerUuid}")
5. Output:
The resulting HMAC digest is converted to a hexadecimal string and sent as the signature header.
Example Notification Header
Validating the Signature on Your Side
To validate the authenticity of a callback notification follow this steps:
1. Retrieve the Header Signature
Extract the signature from the headers of the received notification.
2. Recreate the Signature
Using your API key (shared during account setup), and your customer UUID recreate the signature following the same process we use:
• JSON stringify the payload exactly as received. • Concatenate the payload and customer UUID with a +. • Compute the HMAC using the SHA-256 algorithm and your API key.
Example in Node.js:
3. Compare Signatures
• Compare the recreatedSignature
with the signature header value.
• If they match, the notification is valid and originated from our API. If not, reject the notification.
Example in Node.js
Security Notes
• API Key Confidentiality: Keep your API key secure and never expose it publicly or hard-code it into client-side code.
• Validate Payload Integrity: If the signature does not match, reject the notification and log the attempt.
By following these steps, you can ensure that the callback notifications you receive are authentic and trustworthy. If you have any issues or questions, please contact our support team.
Last updated