3

我已成功重定向到 ccavenue 支付网关,但在单击取消按钮时,它在重定向 url 页面中显示错误“安全错误。检测到非法访问” 。

这是我的重定向网址页面:

<?php include('Aes.php');include('adler32.php')?>
<?php
 $workingKey='myWorkingKey';        //Working Key should be provided here.
 $encResponse=$_POST["encResponse"];    //This is the response sent by the CCAvenue Server


$rcvdString=decrypt($encResponse,$workingKey);      
$AuthDesc="";
$MerchantId="";
$OrderId="";
$Amount=0;
$Checksum=0;
$veriChecksum=false;

$decryptValues=explode('&', $rcvdString);
$dataSize=sizeof($decryptValues);

echo "<center>";


for($i = 0; $i < $dataSize; $i++) 
{
    $information=explode('=',$decryptValues[$i]);
    if($i==0)   $MerchantId=$information[1];    
    if($i==1)   $OrderId=$information[1];
    if($i==2)   $Amount=$information[1];    
    if($i==3)   $AuthDesc=$information[1];
    if($i==4)   $Checksum=$information[1];  
}

$rcvdString=$MerchantId.'|'.$OrderId.'|'.$Amount.'|'.$AuthDesc.'|'.$workingKey;
$veriChecksum=verifyChecksum(genchecksum($rcvdString), $Checksum);

if($veriChecksum==TRUE && $AuthDesc==="Y")
{
    echo "<br>Thank you for shopping with us. Your credit card has been charged and your transaction is successful. We will be shipping your order to you soon.";

}
else if($veriChecksum==TRUE && $AuthDesc==="B")
{
    echo "<br>Thank you for shopping with us.We will keep you posted regarding the status of your order through e-mail";


}
else if($veriChecksum==TRUE && $AuthDesc==="N")
{
    echo "<br>Thank you for shopping with us.However,the transaction has been declined.";

}
else
{
    echo "<br>Security Error. Illegal access detected";

}


echo "<br><br>";

echo "<table cellspacing=4 cellpadding=4>";
for($i = 0; $i < $dataSize; $i++) 
{
    $information=explode('=',$decryptValues[$i]);
        echo '<tr><td>'.$information[0].'</td><td>'.$information[1].'</td></tr>';
}

echo "</table><br>";
echo "</center>";
?>

我用谷歌搜索了这个问题,但没有得到任何解决方案。如何解决此错误..请对此提出一些建议?

4

2 回答 2

4

我从文档中发现(可能已过时,但我找不到更新的文档),cancel_url如果客户在计费页面上取消交易,您需要传递一个名为 CCAvenue 的参数,该参数会将客户重定向到此 URL。

因此,在您创建付款的页面中,您需要添加到您的表单中,如下所示

<input type="hidden" id="cancel_url" name="cancel_url" value="the_url_where_you_will_proccess_canceled_orders">

你必须已经有类似的东西了redirect_url

于 2019-05-13T12:56:07.320 回答
1

您的代码没有任何问题。您需要为取消订单维护单独的页面,在该页面中您不需要使用 CC 渠道响应代码。由于用户没有完成付款,您将不会收到来自 ccavenue 的任何响应参数。因此,它们不需要$verifyCheckSum$AuthDesc变量。他们只是心甘情愿地取消了订单。因此,只需在您的网站上向他们显示一条消息“您的订单已取消” 。

于 2019-05-20T06:14:08.037 回答