# How to integrate CcAvenue payment gateway in ASP.NET MVC ?

## Prerequisites

You should have a ccavenue account.

## Problem

• The second step is the problem I faced while integrating the ccavenue page.I found out that most of the people were finding the same.As we are developing something we need to first test it in development environment.

Inside your ccavenue account they have already given you the access code,merchant Id and access key for a url.But those credentials will only work if you are redirecting to the ccavenue page from that url only.

For ex:If url set up in your account is https://xyz.com then only if you redirect from https://xyz.com then you will be redirected to the correct page else you will get 1002 i.e Merchant Authentication failed.

## Solution

• Drop a mail to service@ccavenue.com along with your merchant id and test url.They will set it up for you !! Cheers 🙂

But what if they do not respond? So there is another solution.

• You can login to your account and they have a tab called support.In that support when you enter an email id an email comes to that mail id with some credentials.Login to that url with your credentials and raise a ticket there on urgent basis.Your issue will be resolved 😀 (100%).

Now comes the very important part i.e the implementation.

## Implementation

### Request

• Add 4 keys yo your web.config file inside .Development environment and production environment for both keys are different.We can only get the values from config files not set them.Storing them in web.config is the best place.
<add key="CcAvenueMerchantId" value="your-merchant-id"/>
/*checkout url for development is https://test.ccavenue.com/transaction/transaction.do?command=initiateTransaction
For production its https://secure.ccavenue.com/transaction/transaction.do?command=initiateTransaction */

• Add a controller method called Payment.