PayUMoney HashCode is not verifying in Java Spring Boot

263 views Asked by At

I am integrating a payment gateway for the first time. According to PayU's developer guide and the pattern given to create a hashcode. I have a hash sequence as the example below:

String hashSequence =
 "key|txnid|amount|productinfo|firstname|email|udf1|udf2|udf3|udf4|udf5|udf6|udf7|udf8|udf9|udf10";

and raw hashcodeSequence is

sMWHQy46|21|30|REAL ESTATE|Naeem|[email protected]|||||||||||DWsylTyIYs

Now I receive some hash from PayU after a successful transaction and I try to verify it using:

String hashSequence =     
"salt|status|udf10|udf9|udf8|udf7|udf6|udf5|udf4|udf3|udf2|udf1|email|firstname|productinfo|amount|txnid";

and my raw HashSequence for this is:

DWsylTyIYs|success|||||||||||[email protected]|Naeem|REAL ESTATE|30|21|sMWHQy46

But the hash is generating now is not equal to the one recieved from PayU. Why does this happen?

1

There are 1 answers

0
Yash Mhatre On
  1. Key is missing at the end when you're calculating the hash for the second time.

  2. try adding the additionalCharges while you're calculating the hash after the txn is successful :

    String hashSequence =  "additionalCharges|salt|status||||||udf5|udf4|udf3|udf2|udf1|email|firstname|productinfo|amount|txnid|key";