使用用户定义的字段时,由于Payu中错误地计算了哈希参数,导致交易失败

时间:2018-08-06 07:22:55

标签: php codeigniter hash payment-gateway payu

我已将Payu与codeigniter网站集成在一起。当udf1字段为空时,一切正常。当我尝试传递某些参数时,由于哈希计算参数计算错误,交易失败。

$amount =  $orderdata[0]['ototal'];
    $product_info = $orderdata[0]['product_name'];
    $customer_name = $orderdata[0]['fname'];
    $customer_emial = $orderdata[0]['email'];
    $customer_mobile = $orderdata[0]['phone'];
    $customer_address = $orderdata[0]['address2'].$orderdata[0]['address1'];
    //payumoney details


        $MERCHANT_KEY = "xxxxxxxxxxxxx"; //change  merchant with yours
        $SALT = "xxxxxxxxxx";  //change salt with yours 

        $txnid = substr(hash('sha256', mt_rand() . microtime()), 0, 20); 
        //optional udf values 
        $udf1 = $ord_id;
        $udf2 = '';
        $udf3 = '';
        $udf4 = '';
        $udf5 = '';

         $hashstring = $MERCHANT_KEY . '|' . $txnid . '|' . $amount . '|' . $product_info . '|' . $customer_name . '|' . $customer_emial . '|' . $udf1 . '|' . $udf2 . '|' . $udf3 . '|' . $udf4 . '|' . $udf5 . '||||||' . $SALT;
         $hash = strtolower(hash('sha512', $hashstring));

1 个答案:

答案 0 :(得分:0)

应该以这样的形式传递 $udf1

$email = "info@onlinefastag.in";
$productinfo = "New Fastag request";
$udf1 = $orderId;
$udf2 = "";
$udf3 = "";
$udf4 = "";
$udf5 = "";
<input name="udf1" input type= "hidden" value=" echo $udf1; "/>