HASH COMPUTATION
The following fields are to be combined and hashed using SHA512 algorithm and this private hash key assigned to the hash POST field:-
- txn_ref
- product_id
- pay_item_id
- amount
- site_redirect_url
- MacKey
where ‘+’ represents string concatenation of values (i.e, “a” + “b” = “ab”).
Please note the order of the parameters.
Mac Key:-
This is a 128 character alphanumeric string that is used to calculate the hash. It is usually provided when the merchant is about to Go Live (i.e start accepting real payments). For DEMO transactions, the following value should be used:-
D3D1D05AFE42AD50818167EAC73C109168A0F108F32645C8B59E897FA930DA44F9230910DAC9E20641823799A107A02068F7BC0F4CC41D2952E249552255710F
Please be wary of extra characters and spaces when working with the MAC Key and hash computation.
Hash Computation Example
For example for a transaction with the following field values –
1) txn_ref – MYC_060616_31
2) product_id – 6207
3) pay_item_id – 103
4) amount – 125000 (i.e ₦1,250)
5) site_redirect_url – http://www.myhigherinstitution.com/response/
6) MacKey –
CEF793CBBE838AA0CBB29B74D571113B4EA6586D3BA77E7CFA0B95E278364EFC4526ED7BD255A366CDDE11F1F607F0F844B09D93B16F7CFE87563B2272007AB3
String to be hashed =
MYC_060616_316207103125000http://www.myhigherinstitution.com/response/CEF793CBBE838AA0CBB29B74D571113B4EA6586D3BA77E7CFA0B95E278364EFC4526ED7BD255A366CDDE11F1F607F0F844B09D93B16F7CFE87563B2272007AB3
After computing value…
Hash =
BA2D7AB317C840970C63D1B0B9517ED73FEC0A399058D0F3BB9EFC7CB9A9F69025C704D944F0040C8EA344B5DA5BB7C74385380F7AC14E30F097AAFA92D2FBDE
A good resource where you can check the hash you;re generating can be found at the link below-