duanhuang3074 2017-04-25 12:49
浏览 54

CCAvenue错误代码:10001无效请求 - 加密请求在localhost上无效/不存在

I am getting error whenever I am trying to post data to CCAvenue on localhost for testing purpose. I am following this website http://www.phpzag.com/ccavenue-payment-gateway-integration-in-php/. I have every credential what we need.

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; ?>">

Success.php

<?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;
}
?>

screenshot

  • 写回答

1条回答 默认 最新

  • duafagm1066 2017-04-27 07:09
    关注

    Error Code: 10001

    PHP Mcrypt module has been used to encrypt customers and merchant data to the payment gateway so either it is disabled or you have some disabled functions which is blocking mcrypt. In your PHP Configurations set only disable_functions = show_source, system, passthru, popen, proc_open. If you are on a shared hosting then contact your hosting provider to enable and allow PHP mcrypt.

    at server side install mcrypt module.

    sudo apt-get install php7.0-mcrypt

    Then try again.

    This link may helpful. https://www.acewebworld.com/blog/whmcs-ccavenue-m-c-p-g-module/

    评论

报告相同问题?

悬赏问题

  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 个人网站被恶意大量访问,怎么办
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大