在PayuMoney与PHP的Web集成中,我正在访问success.PHP页面,但收到消息“”;无效事务.请再试一次&


In PayuMoney Web Integration with PHP I am reaching at success.php page but getting msg "Invalid Transaction. Please try again"

由于success.php中有一个代码,它比较发送给PayUMoney的$hash变量与我们接收的变量的相等性,如果它们不相等,则显示消息:

无效事务。请重试

所以我收到了这个消息,我不知道如何解决这个问题。

这里有一些成功的示例代码。php

<?php
$status=$_POST["status"];
$firstname=$_POST["firstname"];
$amount=$_POST["amount"];
$txnid=$_POST["txnid"];
$posted_hash=$_POST["hash"];
$key=$_POST["key"];
$productinfo=$_POST["productinfo"];
$email=$_POST["email"];
$salt="salt";
if (isset($_POST["additionalCharges"])) {
   $additionalCharges=$_POST["additionalCharges"];
    $retHashSeq =       $additionalCharges.'|'.$salt.'|'.$status.'|||||||||||'.$email.'|'.$firstname.'|'.$productinfo.'|'.$amount.'|'.$txnid.'|'.$key;
              }
else {    
    $retHashSeq =   $salt.'|'.$status.'|||||||||||'.$email.'|'.$firstname.'|'.$productinfo.'|'.$amount.'|'.$txnid.'|'.$key;
     }
     $hash = hash("sha512", $retHashSeq);
   if ($hash != $posted_hash) {
       echo "Invalid Transaction. Please try again";
       }
   else {
      echo "<h3>Thank You. Your order status is ". $status .".</h3>";
      echo "<h4>Your Transaction ID for this transaction is ".$txnid.".   </h4>";
      echo "<h4>We have received a payment of Rs. " . $amount . ". Your    order will soon be shipped.</h4>";
       }         
?>

第10行。$salt="salt";

它应该是$salt="您的盐从您的payumoney帐户enter code here">

示例

$status=$_POST["status"];
$firstname=$_POST["firstname"];
$amount=$_POST["amount"];
$txnid=$_POST["txnid"];
$posted_hash=$_POST["hash"];
$key=$_POST["key"];
$productinfo=$_POST["productinfo"];
$email=$_POST["email"];
$salt="GQs7yium";

这就是$retHastseq不等于$posted_hash的原因。

试试看。