I am new to payment gateways. I would like to integrate CCAvenue into my website using PHP. I downloaded their Intergration kit, included my seller ID and working key, activated my account, and tried to perform a dummy transaction in the index file that they provided on my local host.
But when I click the "Submit" button on the form, it leads me to the CCAvenue transaction transaction page without an error code and error description.
Please let me know where I am making a mistake and what else I need to do.
I would be happy if someone pointed me to a tutorial other than the CCAvenue Integration Guide.
Codes: Checkout.php
<html>
<head>
<title> Checkout</title>
</head>
<body>
<?php include('adler32.php')?>
<?php include('Aes.php')?>
<?php
error_reporting(0);
$merchant_id=$_POST['Merchant_Id'];
$amount=$_POST['Amount'];
$order_id=$_POST['Order_Id'];
$url=$_POST['Redirect_Url'];
$billing_cust_name=$_POST['billing_cust_name'];
$billing_cust_address=$_POST['billing_cust_address'];
$billing_cust_country=$_POST['billing_cust_country'];
$billing_cust_state=$_POST['billing_cust_state'];
$billing_city=$_POST['billing_city'];
$billing_zip=$_POST['billing_zip'];
$billing_cust_tel=$_POST['billing_cust_tel'];
$billing_cust_email=$_POST['billing_cust_email'];
$delivery_cust_name=$_POST['delivery_cust_name'];
$delivery_cust_address=$_POST['delivery_cust_address'];
$delivery_cust_country=$_POST['delivery_cust_country'];
$delivery_cust_state=$_POST['delivery_cust_state'];
$delivery_city=$_POST['delivery_city'];
$delivery_zip=$_POST['delivery_zip'];
$delivery_cust_tel=$_POST['delivery_cust_tel'];
$delivery_cust_notes=$_POST['delivery_cust_notes'];
$working_key=;
$checksum=getchecksum($merchant_id,$amount,$order_id,$url,$working_key);
$merchant_data= 'Merchant_Id='.$merchant_id.'&Amount='.$amount.'&Order_Id='.$order_id.'&Redirect_Url='.$url '&billing_cust_name='.$billing_cust_name.'&billing_cust_address='.$billing_cust_address.'&billing_cust_country='.$billing_cust_country.'&billing_cust_state='.$billing_cust_state.'&billing_cust_city='.$billing_city.'&billing_zip_code='.$billing_zip.'&billing_cust_tel='.$billing_cust_tel.'&billing_cust_email='.$billing_cust_email.'&delivery_cust_name='.$delivery_cust_name.'&delivery_cust_address='.$delivery_cust_address.'&delivery_cust_country='.$delivery_cust_country.'&delivery_cust_state='.$delivery_cust_state.'&delivery_cust_city='.$delivery_city.'&delivery_zip_code='.$delivery_zip.'&delivery_cust_tel='.$delivery_cust_tel.'&billing_cust_notes='.$delivery_cust_notes.'&Checksum='.$checksum ;
$encrypted_data=encrypt($merchant_data,$working_key);
?>
<form method="post" name="redirect" action="http://www.ccavenue.com/shopzone/cc_details.jsp">
<?php
echo "<input type=hidden name=encRequest value=$encrypted_data>";
echo "<input type=hidden name=Merchant_Id value=$merchant_id>";
?>
</form>
<script type='text/javascript'>document.redirect.submit();</script>
</body>
</html>
And my Redirecturl.php
<?php include('Aes.php')?>
<?php include('adler32.php')?>
<?php
error_reporting(0);
$workingKey=;
$encResponse=$_POST["encResponse"];
$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>";
?>
I also included Adler.php and Aes.php, which comes with an integration kit.