You should have a ccavenue account.
- 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.
- Drop a mail to firstname.lastname@example.org 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.
- 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"/> <add key="CcAvenueWorkingKey" value="your-working-key"/> <add key="CcAvenueAccessCode" value="your-access-code"/> <add key="CcAvenueCheckoutUrl" value="your-checkout-url"/> /*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.
- Add its view i.e Payment.cshtml and add the following code.
- Add a post action for payment.
- Create a View called ccAvenue.cshtml.
This bit of file does the trick.It redirects to the ccAvenue page on page load.
Create an Action method to which you will redirect after success.
Thats it and you are done 🙂
Download the sample project here.