2

因为success.php中有一段代码,它比较$hash发送给PayUMoney的变量和我们收到的变量的相等性,如果它们不相等,它会显示消息:

交易无效。请再试一次

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

success.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>";

       }         
?>
4

1 回答 1

7

第 10 行。 $salt ="salt";

它应该是 $salt = "your salt from your payumoney account 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。

试试看。

于 2016-10-22T13:11:50.557 回答