Complete guide to integrate CCAvenue Payment gateway into ASP.NET website – with Screenshot

About this tutorial

This is an end-to-end guide to integrating a CCAvenue payment gateway into ASP.NET web application using official kit. Starting from account setup to successful payment.

Pre-Requirement

  1. Visual Studio
  2. Active CCAvenue account
    1. Merchant ID
    2. Access Code
    3. Working Key
  3. Official CCAvenue kit
  4. Little knowledge about C# & ASP.NET

Setting up your CCAvenue account for localhost

In order to run your CCAvenuepayment gateway in localhost, we need to add our localhost into CCAvenue account. You have to write an email to [email protected] and ask him to add your localhost.  Kindly refer screenshot below for more details.

Example: http://localhost:55181/

Screenshot 1

Download Integration Kit from CCAvenue website

Integration kit will be available on http://ccavenue.com → Resources → Web Integration Kit → Download Integration Kit → Download ASP.NET 3.5

Also, you can download from here: ASP.Net_Kit_Version_3.5

Extract the Integration Kit

Open the Project in Visual Studio

  1. Open Visual Studio
  2. Choose Open → Project/Solution from the file menu.

3. Browse to the downloaded Integration kit. Open the NON-SEAMLESS KIT

4. Open MCPG.ASP.net.ENC

Add Reference to the project [Very Important]

Many people used to face an issue in this stage. But it is really an easy step. Kindly follow the screenshot.

Right-click the References in solution explorer → Add Reference

Note: Reference DLL file will be available in downloaded integration kit itself.

Browse the downloaded folder

  1. bin → MCPG.ASP.net.ENC.dll & add it to the project.
  2. lib → MCPG.CCA.Util.dll & add it to project.

Note: REMOVE existing dll, if any. You have to add fresh dll.

Add localhost to the project

This step is mandatory to run the CCAvenue setup in local system i.e in a development system. If you didn’t ask localhost, this setup won’t work because by default asp.net project will point to some default IP like http://127.0.0.1/

So, better add your localhost i.e In my case it is which http://localhost:55181/ is same as in my CCAvenue Account, which we have added in step 1.

Right click project → Properties

Change Merchant ID, Acess Code and Working Key in our application

Pages to be modified:-

  1. ccavRequestHandler.aspx.cs
  2. ccavResponseHandler.aspx.cs
  3. dataFrom.htm

Change workingKey and strAccessCode in ccavRequestHandler.aspx.cs

Change workingKey again in  ccavResponseHandler.aspx.cs

Change merchant_id, redirect_url, cancel_url – VERY IMPORTANT

Great 🙂 If you followed all the step, you can build & run

Choose between Testing/Live environment

You can choose Testing or Live environment from the ccavRequestHandler.aspx

For Live Environment 

https://secure.ccavenue.com/transaction/transaction.do?command=initiateTransaction

For Testing Environment

https://test.ccavenue.com/transaction/transaction.do?command=initiateTransaction

Making Payment in Live (Production) Environment

Run the application, you will see the following account.

Fill the details & Proceed to checkout

Choose the preferred payment gateway from Credit Card/Debit Card/Net Baking etc..

Enter the required details and click on make payment

Finally, Complete the payment 🙂

That’s all 🙂 You can push your code to Live Website 🙂

I tried my best to cover all the steps in screenshot & steps. If I missed any steps, kindly drop the queries in a comment section.

Also, for any clarification or doubt, please write back to me on comment section. I will try to reply as soon as possible.

How to test CCAvenue Payment Gateway in localhost? (Avoid Error Code: 10002 Merchant Authentication failed)

In this tutorial, I am going to discuss how to test a CCAvenue payment gateway on your local system.

Why this tutorial?

  1. To test CCAvenue in localhost.
  2. To avoid issues on the Live website.

CCAvenue is one of the leading payment gateway providers in India, though their documentation is not up to the industry standard. It is hard to understand. While googling I found many peoples are getting 1002 Authentication Failed.

Reason for CCAvenue 10002 Authentication Failure

  • Wrong/invalid merchant ID
  • Wrong/invalid Working Key
  • Wrong/invalid access Key
  • URL of the registered website

aravin.net_10002_error_code_this_happen_to_best_of_us

But, that CCAvenue error message 10002 does not provide much information on which part it is failing because of security reason. However, many of them think that they are using wrong merchant id or access key or working key. But actual reason for this issue is URL of the account.

Example

If you are registered for www.aravin.net, your payment gateway will work only on www.aravin.net, you cannot use it for any other website.

Also, you cannot use this API keys for your localhost such as http://localhost/ or http://127.0.0.1

So, How to test CCAvenue in localhost or Testing Environment?

  1. Adding your localhost URL to CCAvenue Account
  2. Getting API Keys (Merchant ID, Access Code, Working key)
  3. Start Testing in localhost

1. Adding your localhost URL to CCAvenue Account

In order to add your localhost URL to CCAvenue account, you have to write an email to [email protected] from your registered email with required localhost URL.

Sample Localhost URL

http://192.168.0.3:1234/

2. Getting API Keys (Merchant ID, Access Code, Working key)

Once, your localhost or local IP address is added to your account, you can find the valid API keys in the following path

CCAvenue website -> Settings -> API Keys

Sample API Keys for localhostCCAvenue Account

3. Start Testing in localhost

Now, you can download your preferred programming language integration from the CCAvenue website & use the test API Keys.

That’s all 🙂


Quick Links

  1. CCAvenue Best Practice: http://aravin.net/best-practices-ensure-transaction-integrity-ccavenue-payment-gateway/
  2. How to integrate CCAvenue in ASP.NET website: http://aravin.net/how-to-integration-ccavenue-payment-gateway-into-your-website-using-asp-net-with-screenshot/

Updated Post Here: http://aravin.net/complete-guide-integrate-ccavenue-payment-gateway-asp-net-website-screenshot/

How to integrate CCAvenue payment gateway into your website using ASP.NET? (with Screenshot)

Today, I am going to write about CCAvenuge Payment Gateway integration into your own website. Let’s go!

Your Pre-requisites

  • CCAvenue accounts with Activation.
    – Merchant ID
    – Access Code
    – Secret or Encryption or Working Key
  • Integration kit from CCAvenue website.
  • Visual Studio 2012 or Later

Steps to Integration

1. Downloading Integration Kit

Login into you CCAvenue account. Then go to Resources -> Web Integration Kit -> Download Integration kit & then choose “Download ASP.NET (V3.5) as show in image below. Also, I have attached download link of ASP.NET integration kit here: ASP.Net_Kit_Version_3.5.
CCAvenue Integration

2. Choose the Integration Method

CCAvenue gives 3 different types of integration.

  • Billing Page (Non-Seamless)
  • iFrame Checkout
  • Checkout Form

In our tutorial, we are going to use Billing page method. In backend almost theses 3 methods are same but front-end behaviours will vary. You can find more details about this integration method in ccavenue website.

3. Opening Project in Visual Studio

Extract the file downloaded in step 1, it will 3 folders. Go to folder NON_SEAMLESS_KIT and open the file MCPG.ASP.net.ENC.sln using Visual Studio
CCAvenue Payment Gateway Integration

4. Adding Access Code, Encryption Key and Merchant ID into Project

1. Open the file named ccavRequestHandler.aspx and provide Access Code and Encryption Key as shown in below.
CCAvenue Payment Gateway Integration

2. Open the file ccavResponseHandler.aspx and provide Encryption Key.

3. Open the file dataFrom.htm and provide Merchant Key as shown in the image below.
CCAvenue Payment Gateway Integration

5. Adding Reference to the Project (Most Important)

i. Right click on “Reference” to the solution explorer in Visual Studio.
Adding Reference in Visual Studio

ii. Browse for the MCPG.CCA.Util.dll and add it to project reference.
Adding DLL into Visual Studio

6. Build the Project

i. Clean the project.
ii. Build the project.

Then go to the project folder -> Obj -> Release folder, you will find recently generated MCPG.ASP.net.ENC.dll

7. Run the Project

That’s all! Run the project. You will get dataFrom.htm
ccavenue payment gateway integration

If you followed all these steps as mentioned, you will redirect to ccavenue website while clicking on `checkout` button.
ccavenue payment gateway integration

If you have any queries/concern, please drop in the comment section below.

Quick Info

Updated Post Here: http://aravin.net/complete-guide-integrate-ccavenue-payment-gateway-asp-net-website-screenshot/

  1. Complete List of CCAvenue Error Codes with reason
  2. Complete list of CCAvenue Response code with description
  3. How to integrate CCAvenue payment gateway into ASP.NET Razor website?