CCAvenue Payment Gateway Integration in PHP

CCAvenue Payment Gateway Integration in PHP –
In this tutorial I am going to share simple php script to integrate CCAvenue Payment Gateway. It is most popular payment gateway but expensive as compared to any other gateway, but presents your customers with lot of payment options, including wallets. Also success rate and reliability is good. South Asia’s largest payment gateway solution powering thousands of eMerchants with real time, multi-currency, multiple payment options online payment processing services. The solution is powered by proprietary technology that integrates transaction-processing, advance shopping cart, auction payment collection facility, fraud control, financial reporting and order tracking. Collect payments in 27 major foreign currencies and allow your customer to pay in the currency they know best, Multilingual Checkout Page, 200+ Payment Options, 17+ Shopping cart plugins. So if your we based application in PHP then here you’ll get solution to integrate CCAvenue Payment Gateway in PHP.


Install library via composer.

composer require kishanio/ccavenue


Include the library on page, don’t forget to generate 'merchant_id', 'working_key', 'redirect_url' from CCAvenue website. and set required parameter like Amount, billing_cust_name, billing_cust_address and so on.

require_once __DIR__ . '/../vendor/autoload.php'; 
use Kishnio\CCAvenue\Payment as CCAvenueClient;
$ccavenue = new CCAvenueClient( '<merchant_id>', '<working_key>', '<redirect_url>' );
// set details 
$ccavenue->setAmount( '<Amount>' );
$ccavenue->setOrderId( '<order_id>' );
$ccavenue->setBillingName( '<billing_cust_name>' );
$ccavenue->setBillingAddress( '<billing_cust_address>' );
$ccavenue->setBillingCity( '<billing_cust_city>' );
$ccavenue->setBillingZip( '<billing_cust_zip>' );
$ccavenue->setBillingState( '<billing_cust_state>' );
$ccavenue->setBillingCountry( '<billing_cust_country>' );
$ccavenue->setBillingEmail( '<billing_cust_email>' );
$ccavenue->setBillingTel( '<billing_cust_tel>' );
$ccavenue->setBillingNotes( '<billing_cust_notes>' );
// copy all the billing details to chipping details
// get encrpyted data to be passed
$data = $ccavenue->getEncryptedData();
// merchant id to be passed along the param
$merchant = $ccavenue->getMerchantId();


Create simple form where which you can submit on user action.

<!-- Request -->
<form method="post" name="redirect" action=""> 
        echo '<input type=hidden name=encRequest value="'.$data.'"">';
        echo '<input type=hidden name=Merchant_Id value="'.$merchant.'">';
<script language='javascript'>document.redirect.submit();</script>

Payment Response

After successful payment process you will get payment response in below parameter and you now redirect invoice page or any page your want.

require_once __DIR__ . '/../vendor/autoload.php'; 
use Kishnio\CCAvenue\Payment as CCAvenueClient;
// Get Response
$ccavenue = new CCAvenueClient( '<merchant_id>', '<working_key>', '<redirect_url>' );
// Check if the transaction was successfull.
echo $ccavenue->response( $response );

See live demo and download source code.


This awesome script developed by kishanio, Visit their official github repository for more information and follow for future updates.

FREE PHP CCAvenue Payment Gateway Integration Script

Following are the list of popular top rated hand picked PHP CCAvenue Payment Gateway Integration.

I Hope you liked Hand-picked list of PHP CCAvenue Payment Gateway Integration, Don’t forget to Subscribe My Public Notebook for more useful Hand-picked PHP and MySql code examples, tutorials and articles.

Don’t forget to Subscribe My Public Notebook for more useful free scripts, tutorials and articles.

Posted in PHP