Integrate CCAvenue Payment Gateway using PHP

CCAvenue is a popular Payment Gateway that allows e-transaction. It is designed to integrate quickly and hassle free. This is authorized by Indian financial institutions and one of the most secure payment gateway to transact money for an online e-commerce/shopping. I will explain you step by step process to Integrate CCAvenue Payment Gateway using PHP for accept online payment.This is a very simple example, you can just copy paste and change according to your requirement.
Steps 1: Create Account and integrate CCAvenue Payment Gateway
  • Create Merchant Account.
  • Login to Merchant Dashboard and download CCAvenue payment integration kit.
  • CCAvenue verify your website and provide all required details like Marchant ID, Working Key etc.
  • 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.
The following screenshot shows the CCAvenue merchant sign-up form used to create a new account as the first step of this payment integration.
Before started to implement the Integrate CCAvenue Payment Gateway using PHP, look files structure:
  • integrate-ccavenue-payment-gateway-using-php
    • css
      • style.css
    • images
    • templates
      • header.php
      • footer.php
    • config.php
    • index.php
    • ccAvenueRequestHandler.php
    • Crypto.php
    • ccAvenueResponseHandler.php
Step 2: Create a file named index (index.php)
Step 3 : Create a file named ccAvenueRequestHandler (ccAvenueRequestHandler.php)
Step 4: Create a file named Crypto (Crypto.php)
This file contains the functions to encrypt or decrypt the payment information posted via the HTML
Step 5: Create a file named ccAvenueResponseHandler (ccAvenueResponseHandler.php)
Step 6: Create files named (header and footer)
Create a view files named header.php and footer.php inside “templates” folder.
This view contains the headerand footer 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
footer.php