How to Integrate CCAvenue Payment Gateway in PHP

By Deepak Sharma | Jan, 03 2019 05:28

How to Integrate CCAvenue Payment Gateway in PHP

      Hello Friends today I am talking about how we can integrate CCAvenue Payment Gateway in website, in simply and easy way.   Believe me,  most of the time we are facing problem during integration of any type of payment gate way, but it is not much hard as we think. Today I shall tell you to integrate CCAvenue payment gateway.   These are the following steps:   Step 1: First of all we need a php integration kit of CCAvenue we will provided by CCAvenue or from the merchant panel.   Step 2: Now extract the .zip in to your localhost root folder(www or htdocs).   Step 3: Now we found 4 files, adler32.php, Aes.php, Checkout.php, redirecturl.php.   Step 4: alder.php and Aes.php we donot modify these two files. we need to work on Checkout.php and redirecturl.php.   Step 5: Now open checkout.php. I this file first of all mention merchant_id and working key that are provides by the CCAvenue or From the merchant panel of CCAvenue.   Step 6: Rest are Post Parameter or variable as show bellow..   $amount=$_POST['Amount'];   // Here you can mention your amount or Product / Service.   $order_id=$_POST['Order_Id'];  //Here is your unique order Id generated by your system.   $url='./redirecturl.php';//$_POST['Redirect_Url']; //your redirect URL where your customer will be redirected after authorization from CCAvenue.   $billing_cust_name=$_POST['billing_cust_name']; //Here you can mention the name of customer   $billing_cust_address=$_POST['billing_cust_address'];//Here you can mention the address of customer.   $billing_cust_country=$_POST['billing_cust_country']; //Here customer country.   $billing_cust_state=$_POST['billing_cust_state'];//Customer state.   $billing_city=$_POST['billing_city']; // Customer City.   $billing_zip=$_POST['billing_zip']; // Customer Zip/Pincode .   $billing_cust_tel=$_POST['billing_cust_tel'];// Customer Mobile number.   $billing_cust_email=$_POST['billing_cust_email']; // Customer Email ID   //Now you need to mention customer delivery details. Most of the time delivery details are the same as customer billing details. So Write is same as Billing details.   $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'];   Step 7 : Now Come to redirecturl.php and pen it.   Step 8 : As I mention $url='./redirecturl.php'; in (Step 6), we you came back after successfully or unsuccessful transaction from the CCAvneue payment gateway this redirecturl.php is your next landing page where you go lost of parameter from CCAvenue Server in POST method that would be encrypted. Show as bellow...   $encResponse=$_POST["encResponse"]; //This is the response sent by the CCAvenue Server   Now there are 4 things happen 
  1. $AuthDesc==="Y", i.e 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.      
  //Here you need to put in the routines for a successful  //transaction such as sending an email to customer, //setting database status, informing logistics etc etc.        2. $AuthDesc==="B", i.e Thank you for shopping with us.We will keep you posted regarding the status of your order through e-mail         //Here you need to put in the routines/e-mail for a  "Batch Processing" order //This is only if payment for this transaction has been made by an American Express Card //since American Express authorisation status is available only after 5-6 hours by mail from ccavenue and at the "View Pending Orders"         3. $AuthDesc==="N", i.e Thank you for shopping with us.However,the transaction has been declined.   //Here you need to put in the routines for a failed //transaction such as sending an email to customer //setting database status etc etc.         4. i.e else condition Security Error. Illegal access detected.                  //Here you need to simply ignore this and dont need //to perform any operation in this condition   Step 9: Now you can perform any operation in the above condition such as Store in Database for future references Or Show to customer and so much, what ever you want.     Complete Demo of  Transaction shown in this video as below...    

Ask question and get answer MyInboxHub - The Tutorial Points</h3> <xmp> 

 

   

Thanks for reading, for more details go through MyInboxHub - The Tutorial Points</h3> <xmp> 


0 comments

No comment posted yet

Leave a comment