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?