[英]Security Error. Illegal access detected using ccavenue in php
我成功地重定向到ccavenue支付网关但是在点击取消按钮时,它在重定向网页中显示错误“安全错误。检测到非法访问” 。
这是我的重定向页面:
<?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>";
?>
我搜索了这个问题,但无法得到任何解决方案。 如何解决这个错误..请给出一些相同的建议?
我从文档中发现(可能已经过时但我找不到更新的文档)您需要传递一个名为cancel_url
的参数,如果客户在结算页面上取消了该交易,CCAvenue会将客户重定向到此URL。
因此,在您创建付款的页面中,您需要向表单添加类似的内容
<input type="hidden" id="cancel_url" name="cancel_url" value="the_url_where_you_will_proccess_canceled_orders">
您必须已经拥有与redirect_url
类似的东西
您的代码没有任何问题。 您需要为取消订单维护单独的页面,您不需要使用CC途径响应代码。 由于用户未完成付款,因此您无法从ccavenue收到任何响应参数。 所以,他们不需要$ verifyCheckSum和$ AuthDesc变量。 他们只是自愿取消订单。 因此,只需要在您的网站上向他们显示一条消息“您的订单已被取消” 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.