Search code examples
phppayumoneypayu

PayU web checkout - checksum failed


I keep getting the Checksum failed error when trying to integrate with PayU. From what I see in the docs, the integration should be straightforward, but I think I'm messing up the hash generation. In particular, I'm not sure how the udf fields are to be handled.

Here's how I'm calculating the hash:

$seq = "xxxxxxxx|11aa|400.00|Cleaning|Ankush|[email protected]|||||||||||xxxxxx";
$hash = strtolower(hash("sha512", $seq));

I've verified the key and salt values, but the ||||||||||| part looks dubious to me. I don't have any user-defined fields; is this how this should be done?


Solution

  • This error happens only when value in form and in

    $seq = "xxxxxxxx|11aa|400.00|Cleaning|Ankush|[email protected]|||||||||||xxxxxx";
    

    mismatch so compare the thing you wil sure get the difference and wil correct to get rid of this error.

    Would like to point out two things here which might not be available in the official docs:

    1. The string containing amount SHOULD end with '.00'. Add them if you have to manually do it.
    2. This one is the one which most people have to figure out the hard way: you are only allowed 11 UDFs (user defined fields). Either you should have values like udf1|udf2|udf3 or have pipes instead of that like this |. Or else the checksum will fail. And if you are not passing any udfs add 11 pipes.