MAC VALIDATION FALED

0

Q.

Hello Babafemi,

The Error on the address bar when I hit cancel on the security message is as given below..

https://stageserv.interswitchng.com/test_paydirect/Pay/ResponsePost/?resp=Z4&desc=,%20mac%20validation%20failed&txnRef=CH23345464666464663829938847837&payRef=&retRef=&cardNum=0&apprAmt=0&url=http%3a%2f%2flocalhost%3a45892%2fPaymentSuccess.aspx

A.

Good day sir,

Greetings.

This means your hash value is wrong and you need to review your hash computation procedure .

Steps to take :

  1. Ensure your parameter values are consistent and same value in form and hash concatenation .
      • 1.a. Amount must always be in kobo and must be same value in form and hash concatenation
      • 1.b. txn_ref must be unique for every transaction and must be same value in form and hash concatenation
      • 1.c.Product_id, pay_item_id and mac key are correct as provided by interswitch and same value used in your form
      • 1.d. Ensure there is no space or additional characters in your mac key when copied. You copy to notepad and then copy to your IDE to eliminate spaces
  2. Ensure you are performing SHA512 Hash of txn_ref,product_id,pay_item_id,amount,site_redirect_url and mac key.
  3. Ensure all mandatory fields are provided in your form with the correct parameters

 

P.S: Here is a sample working form:

mac validation failed

mac validation failed

You can use your current hash procedure to perform the SHA512 hash as described and compare values with the one in the form, you hash computation procedure is not correct till we can get same value using the same parameters as shown in the form above (strings given below as well).

String hashed =  50348662051011000000http://localhost/webpaytest/tpay.phpD3D1D05AFE42AD50818167EAC73C109168A0F108F32645C8B59E897FA930DA44F9230910DAC9E20641823799A107A02068F7BC0F4CC41D2952E249552255710F

Hash result (same as shown in the form above) =

B5E0B3B6DB5C260C5B44DA20779984597DF1EF752BBB8BFD7D601F8E53E8AC2723A7230BAF708A884DDEEB03347FA1D1A1F03FD03C54BB664511F491DEEDB421

Regards

Category: asked July 18, 2016

Your Contribution

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>