Hashing Algorithms
Hashing plays a crucial role in securing the integrity and authenticity of data exchanged within the payment API. In this document, we'll focus on utilizing the SHA-256 hashing algorithm, a widely adopted cryptographic hash function known for its strength and security.
Enable the hashing
Login to the portal with your credential, then access to setting page you will see the option to enable hash for payment.

Hashing format
Payment
{service}_{method}_{method provider}_{order id}_{secondary key}
Service: COLLECTION or PAYOUT
Webhook
{order id}_{secondary key}
Code sample to generate the hash
C#
using System;
using System.Security.Cryptography;
using System.Text;
public class HashGenerator
{
public static string ComputeSHA256Hash(string input)
{
using (SHA256 sha256 = SHA256.Create())
{
byte[] inputBytes = Encoding.UTF8.GetBytes(input);
byte[] hashBytes = sha256.ComputeHash(inputBytes);
StringBuilder builder = new StringBuilder();
for (int i = 0; i < hashBytes.Length; i++)
{
builder.Append(hashBytes[i].ToString("x2"));
}
return builder.ToString();
}
}
}
Java:
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
public class HashGenerator {
public static String computeSHA256Hash(String input) throws NoSuchAlgorithmException {
MessageDigest digest = MessageDigest.getInstance("SHA-256");
byte[] hashBytes = digest.digest(input.getBytes());
StringBuilder builder = new StringBuilder();
for (byte b : hashBytes) {
builder.append(String.format("%02x", b));
}
return builder.toString();
}
}
Javascript:
const crypto = require('crypto');
function computeSHA256Hash(input) {
const hash = crypto.createHash('sha256');
hash.update(input);
return hash.digest('hex');
}
Last updated