How to integrate CCAvenue payment gateway into ASP.NET Razor website? (with steps & screenshots)

Hi All, this tutorial is about CCAvenue payment gateway integration for ASP.NET Razor website (.CSHTML). If you are using ASP.NET web pages (.ASPX) you can check the tutorial here.


  1. Visual Studio 2012 or Latest
  2. CCAvenue Active account with
    1. Merchant ID
    2. Encryption Key
    3. Access Code
  3. CCAvenue Integration Kit for ASP.NET
  4. Custom ASP.NET Integration Kit for Razor (Download here: ccavenue_aspnet_razor_kit_1)

Steps for Integration

1. Download Custom ASP.NET Integration Kit for Razor

Download the ASP.NET Integration Kit for Razor from the above link and import into your project. [Download Now]

2. Adding reference to the project

Download the CCAvenue Integration kit and add Right click on your visual studio project -> Add -> Reference and choose the reference file MCPG.CCA.Util.dll and import it into the visual studio project.

CCAvenue Reference

3. Adding Access Code, Encryption and Merchant ID

Add Working key and Merchant ID to index.cshml file.

Search for Snippet

string workingKey = "add_your_32_bit_working_key_here";

Replace with your 32 secret key given from CCAvenue

Add Working Key, Access Code to processor.chtml file.

Search for Snippet

var workingKey = "add_your_32_bit_working_key_here";

and Snippet

var strAccessCode = "add_your_access_key_here";

Replace with your working key and access key.

4. Set Test/Production environment

Open processor.cshtml and change form action as following,

For Testing

For Release,

CCAvenue Environment

5. Build & Run the project

i. Clean the project.

ii. Build the Project.

iii. Run the Project.

That’s all 🙂

if you did all the steps as mentioned, you will get the website as shown below

CCAvenue Checkout page

Once you filled out this form, you will redirect to CCAvenue checkout page. Kindly drop your concern/issues/suggestion in below comment section.

48 thoughts on “How to integrate CCAvenue payment gateway into ASP.NET Razor website? (with steps & screenshots)

  1. nandani mishra says:

    plz give me whole source code of cc avenue process because not available on net for mvc …
    how to integrate cc avenue in my mvc application and cart also define

    • aravin says:

      Hi Nandani, here is the full source code for razor syntax. []

  2. Samir Mistry says:

    Hello Arvin, Can you please provide me link of source code because provided link is not working and even in blog the image you have uploaded is not in place. Can you please email me source code to me. [email protected]

  3. Rahul Patel says:

    Hello, Arvin, Can you please provide me link of source code of razor syntax because provided code not worked and give me error like Error Code: 10002 Merchant Authentication failed.

    Don’t worry… It happens to the best of us. Can you please email me source code to me with attachment . And where we pass merchant id in source code because we download the source but merchant id not pass any where.

  4. Prithvi says:

    Hi Aravin,

    Can you please send the whole source code for ASP.NET MVC 5 compiled in .Net 4.5.2 framework. The link which you have provided doesnt contain the Dlls and the ones i downloaded from the CCAVenue are compiled against .Net 2.0.0 framework.


  5. Pavan R says:

    Hi Aravin, I’m using the test URL
    But getting an error saying that the merchant authentication failed
    Could you please help me in this issue

  6. Priyanka says:

    I am using angualr js for integration CCavenue. I have succesfully submit an form and after make a payment How can i get the ccavenue response. ?

  7. Hemang says:

    download project from []
    then implement in my project but when checkout that time only showing “Processing…”
    so why this not goto at ccavenue page?

  8. Harsha K N says:

    Hi Aravin,

    In your code that you have posted, the Working key and Access Code are in the hidden field of the form. But don’t you think it’s exposed, even though it’s in a hidden field? Anyone who has little knowledge about the HTML and source code can easily get the merchant id, working key and AccessCode. So is there any way we can do all these in C# and not in the front end? Even posting the request and going to the Payment Gateway page.


    Harsha K N

    • aravin says:

      Hi Harsha,

      You’re correct!

      You should not expose any data to outside. My code is to integrate the payment.

      You can use forms and store the data in the configuration file for better security.

  9. Sunil says:

    How I configure in aspx form?
    I mean replace data from.htm to submit data.aspx?
    I don’t want data from.htm file , I want to change it into aspx file.
    If you have code please share it in my email id.
    Thank you.

    • aravin says:

      Hi Sunil,

      There is no major change. Simply use the normal aspx respected for each html field.

      Or you can rename html file to aspx, it will work as expected.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.