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 – 6205
3) pay_item_id – 101
4) amount – 125000 (i.e ₦1,250)
5) site_redirect_url – http://www.mycompany.com/response/
6) MacKey –
D3D1D05AFE42AD50818167EAC73C109168A0F108F32645C8B59E897FA930DA44F9230910DAC9E20641823799A107A02068F7BC0F4CC41D2952E249552255710F
String to be hashed =
MYC_060616_316205101125000http://www.mycompany.com/response/D3D1D05AFE42AD50818167EAC73C109168A0F108F32645C8B59E897FA930DA44F9230910DAC9E20641823799A107A02068F7BC0F4CC41D2952E249552255710F
After computing value…
Hash =
79D9AC677F21A44D37D5993FD0E0BCB0FF633F18F82B6472CFD1B21EF26B00C79B4D5B4B7C8C7FD2794B11A77581EA3326B80A94307B9EB6548DE2BA77662088
A good resource where you can check the hash you;re generating can be found at the link below-