DevelopersPayment GatewayHash Generation
Hash Generation
Every SDK transaction must include a server-generated SHA-512 hash.
Hash Formula
text
sha512("{{amount}}|{{public_key}}|{{reference}}")If discount is supplied, append the exact JSON string used in the request.
text
sha512("{{amount}}|{{public_key}}|{{reference}}|{{discount_json}}")Rules
amountis sent in minor units, for example500000for NGN 5,000.00.referencemust be unique per transaction.public_keymust be the Maker Checker integration public key.- Generate hashes in your backend, not in browser code.
Node.js Example
javascript
const crypto = require("crypto");
function generateKongaPayHash({ amount, publicKey, reference, discount }) {
let plain = amount + "|" + publicKey + "|" + reference;
if (discount) plain += "|" + JSON.stringify(discount);
return crypto.createHash("sha512").update(plain).digest("hex");
}