CCAvenue Payment Gateway Integration using PHP

CCavenue is most popular Payment gateway for online online e-commerce/shopping and e-transaction.It is designed to help merchants accept online payments through a spectrum of new-age payment options including major Credit Cards, Debit Cards (All MasterCard /Visa /Maestro /RuPay Cards), Amex EzeClick, Net Banking, Prepaid Instruments, UPI and Multi Bank EMI options.This is a very simple example, you can just copy paste and change according to your requirement.
Create Account and Integrate Payment Gateway
  • At first Create Merchant Account.
  • After successful registration CCavenue team will verify your provided phone no. and email Id.
  • Login to Merchant Dashboard
  • download CCAvenue payment integration kit
  • Go to dashboard and click on setting tab then select API KEYS
  • Configure CCAvenue security keys and (test/live) endpoint in your PHP application.
  • Create Payment form and deploy request / response handlers and with the guidance of the integration kit.
  • Create return pages for handling payment notification on success or cancel.
CCavenue Payment Gateway features:
  • All the major payment method like debit,credit card , netbanking
  • 7 major Credit Cards
  • 98+ Debit Cards (All MasterCard /Visa /Maestro /RuPay Cards), Amex EzeClick
  • Accept online payment from 53+ banks
  • CCavenue payment gateway is very safe and secure
  • Easy and hassle free integration
  • Payment gateway kit available on multiple programming language
  • 16 Prepaid Instruments
  • UPI and Up to 13 Multi Bank EMI options
Following screenshot shows the CCAvenue merchant Sign up form used to create a new account as the first step of CCavenue payment integration.
Before started to implement the CCAvenue Payment Gateway Integration using PHP, look files structure:
  • ccavenue-payment-gateway-integration-using-php
    • css
      • style.css
    • images
    • templates
      • header.php
      • footer.php
    • constants.php
    • index.php
    • ccAvenueRequestHandler.php
    • Crypto.php
    • ccAvenueResponseHandler.php
Step 1: Create a file named constants.php and define Merchant ID, Access Code and Working Key
	
Step 2: Create HTML form named index.php


CCAvenue Payment Gateway Integration using PHP

Step 3: Create a file named Crypto.php
This file contains the functions to encrypt or decrypt the payment information posted via the HTML

Step 4 : Create a file named ccAvenueRequestHandler.php


CCAvenue Payment Gateway Integration using PHP

	
		
$value){ $merchant_data.=$key.'='.$value.'&'; } $merchant_data .= "order_id=".$orderId; $encrypted_data=encrypt($merchant_data,$working_key); ?>
"; echo ""; ?>
Step 5: Create a file named ccAvenueResponseHandler.php

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($order_status==="Aborted") { $msg = ''; } else if($order_status==="Failure") { $msg = ''; } else { $msg = ''; } ?>

CCAvenue Payment Gateway Integration using PHP

:
'; } } ?>
Create header.php and footer.php section of the webpage. The Bootstrap library is used to provide a better UI, so, include it in the header and footer section.
header.php



  
    
  
  
  
  
  
  
  
  
  CCAvenue Payment Gateway Integration using PHP | Web Haunt
  
  
  
  
  
  
  
   


  
  
footer.php