1. Home
  2. PAYDirect WEB
  3. Transaction Payment Leg
  4. Request Hash Calculation

Request Hash Calculation

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 (note: amount is in minor denomination)
  • 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 – 6204

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_316204101125000http://www.mycompany.com/response/D3D1D05AFE42AD50818167EAC73C109168A0F108F32645C8B59E897FA930DA44F9230910DAC9E20641823799A107A02068F7BC0F4CC41D2952E249552255710F

After computing value…

Hash =
785DABC7870760EC4A29C0BB9125C99C72427ACF7D3899F9F77982AE44C9D3F7F44540703C03CF2D68049DE3353C868CAEEDBAD4A7C2D56F2EAB28DAB5038CEB

A good resource where you can check the hash you’re generating can be found at the link below-

SHA 512 Generator

Was this article helpful to you? Yes 1 No

How can we help?