每当我尝试将数据发布到localhost上的CCAvenue进行测试时,我都会收到错误。我正在关注此网站http://www.phpzag.com/ccavenue-payment-gateway-integration-in-php/。我有我们需要的所有凭证。
的index.php
<?php
include_once 'success.php';
// Merchant id provided by CCAvenue
// Item amount for which transaction perform
$Merchant_Id = 44071;
$Amount = 1000;
// Unique OrderId that should be passed to payment gateway
$Order_Id = "ORDER10203040";
// Unique Key provided by CCAvenue
$WorkingKey= "43E2EC833610E0295FCDEA09DB039382";
// Success page URL
$Redirect_Url="success.php";
//$Redirect_Url="http://watersportssimple.com/";
$Checksum = getCheckSum($Merchant_Id,$Amount,$Order_Id ,$Redirect_Url,$WorkingKey);
?>
<html>
<head>
<title>CCAvenue</title>
</head>
<body>
<!-- <form id="ccavenue" method="post" action="https://world.ccavenue.com/servlet/ccw.CCAvenueController">-->
<form id="ccavenu" method="post" action="https://test.ccavenue.com/transaction/transaction.do?command=initiateTransaction">
<input type="text" name="Merchant_Id" value="<?php echo $Merchant_Id; ?>">
<input type="text" name="Amount" value="<?php echo $Amount; ?>">
<input type="text" name="Order_Id" value="<?php echo $Order_Id; ?>">
<input type="text" name="Redirect_Url" value="<?php echo $Redirect_Url; ?>">
<input type="text" name="TxnType" value="A">
<input type="text" name="actionID" value="TXN">
<input type="text" name="Checksum" value="<?php echo $Checksum; ?>">
<?php
// Get the checksum
function getchecksum($MerchantId,$Amount,$OrderId ,$URL,$WorkingKey)
{
$str ="$MerchantId|$OrderId|$Amount|$URL|$WorkingKey";
$adler = 1;
$adler = adler32($adler,$str);
return $adler;
}
//Verify the the checksum
function verifychecksum($MerchantId,$OrderId,$Amount,$AuthDesc,$CheckSum,$WorkingKey)
{
$str = "$MerchantId|$OrderId|$Amount|$AuthDesc|$WorkingKey";
$adler = 1;
$adler = adler32($adler,$str);
if($adler == $CheckSum)
return "true";
else
return "false" ;
}
function leftshift($str , $num) {
$str = DecBin($str);
for( $i = 0 ; $i < (64-strlen($str)) ; $i++)
$str = "0".$str ;
for($i = 0 ; $i < $num ; $i++) {
$str = $str."0";
$str = substr($str , 1 ) ;
}
return cdec($str) ;
}
function cdec($num) {
for ($n = 0 ; $n < strlen($num) ; $n++) {
$temp = $num[$n] ;
$dec = $dec + $temp*pow(2 , strlen($num)-$n-1);
}
return $dec;
}
function adler32($adler , $str) {
$BASE = 65521 ;
$s1 = $adler & 0xffff ;
$s2 = ($adler >> 16) & 0xffff;
for($i = 0 ; $i < strlen($str) ; $i++) {
$s1 = ($s1 + Ord($str[$i])) % $BASE ;
$s2 = ($s2 + $s1) % $BASE ;
}
return leftshift($s2 , 16) + $s1;
}
?>
答案 0 :(得分:0)
错误代码:10001
PHP Mcrypt模块已用于将客户和商家数据加密到支付网关,因此它被禁用或您有一些禁用mcrypt的禁用功能。在PHP配置中,只设置disable_functions = show_source,system,passthru,popen,proc_open。如果您在共享主机上,请联系您的主机提供商以启用并允许PHP mcrypt。
在服务器端安装mcrypt模块。
sudo apt-get install php7.0-mcrypt
然后再试一次。
此链接可能有帮助。 https://www.acewebworld.com/blog/whmcs-ccavenue-m-c-p-g-module/