how to use ccavenue payment gateway in asp.net

14,486

Solution 1

  1. Add all dll from the Library folder which is sent by CCAvenue to your Gac
  2. From Avenue Integration kit you will get three pages - Data.aspx, SubmitData.aspx and ResponseHandler.aspx
  3. On your button you have to pass your OrderID, MerchantID (given by CCAvenue), Amount and Redirect URL (your website url so ASA Payment will complete user redirect to your site) to Data.aspx page.
  4. Initialize your TextBox of Data.aspx as per the value which you will get after click of checkout button as i shown above in 3rd picture.
  5. In SubmitData.aspx.cs page, initialize your working key on workingkey variable ( you will get your working key after login into your CCAvenue account).

After following this step you can integrate Avenue gateway to your button

For details refer this -

http://bhartiwebworld.blogspot.in/2013/09/how-to-do-ccavenue-payment-gateway.html

You can also integrate using magento. For magento check this video -

https://www.youtube.com/watch?v=4e1SiQM-sHA

Solution 2

I have got it resolved. Yes CCAvenue provides good support. But the person who uses asp.net forum will always look for asp.net codes and direct answers. :)

I hope this will help someone. I have created two properties in code behind. One is to return checksum value and another one is to return details about the checkout items.

enter code here

public string CCAvenueItemList
 {
     get
     {
         StringBuilder CCAvenueItems = new StringBuilder();
         DataTable dt = new DataTable();
         DataTable dtClientInfo = new DataTable();
         dt = (DataTable)Session["CheckedItems"];
         dtClientInfo = (DataTable)Session["ClientInfo"];
         for (int i = 0; i <= dt.Rows.Count - 1; i++)
         {

             string amountTemplate = "<input type=\"hidden\" name=\"Amount\" value=\"$Amount$\" />\n";
             string orderTemplate = "<input type=\"hidden\" name=\"Order_Id\" value=\"$Order_Id$\" />\n";

            // BILLING INFO
             string billingNameTemplate = "<input type=\"hidden\" name=\"billing_cust_name\" value=\"$billing_cust_name$\" />\n";
             string billingCustAddressTemplate = "<input type=\"hidden\" name=\"billing_cust_address\" value=\"$billing_cust_address$\" />\n";
             string billingCountryTemplate = "<input type=\"hidden\" name=\"billing_cust_country\" value=\"$billing_cust_country$\" />\n";
             string billingEmailTemplate = "<input type=\"hidden\" name=\"billing_cust_email\" value=\"$billing_cust_email$\" />\n";
             string billingTelTemplate = "<input type=\"hidden\" name=\"billing_cust_tel\" value=\"$billing_cust_tel$\" />\n";
             string billingStateTemplate = "<input type=\"hidden\" name=\"billing_cust_state\" value=\"$billing_cust_state$\" />\n";
             string billingCityTemplate = "<input type=\"hidden\" name=\"billing_cust_city\" value=\"$billing_cust_city$\" />\n";
             string billingZipTemplate = "<input type=\"hidden\" name=\"billing_zip_code\" value=\"$billing_zip_code$\" />\n";

            billingCustAddressTemplate = billingCustAddressTemplate.Replace("$billing_cust_address$", dtClientInfo.Rows[0]["Address"].ToString());
             billingCountryTemplate = billingCountryTemplate.Replace("$billing_cust_country$", dtClientInfo.Rows[0]["Country"].ToString());
             billingEmailTemplate = billingEmailTemplate.Replace("$billing_cust_email$", dtClientInfo.Rows[0]["Email_ID"].ToString());
             billingTelTemplate = billingTelTemplate.Replace("$billing_cust_tel$", dtClientInfo.Rows[0]["Phone_no"].ToString());
             billingStateTemplate = billingStateTemplate.Replace("$billing_cust_state$", dtClientInfo.Rows[0]["State"].ToString());
             billingCityTemplate = billingCityTemplate.Replace("$billing_cust_city$", dtClientInfo.Rows[0]["City"].ToString());
             billingZipTemplate = billingZipTemplate.Replace("$billing_zip_code$", dtClientInfo.Rows[0]["ZipCode"].ToString());

            strAmount = dt.Rows[i]["INR"].ToString();
             amountTemplate = amountTemplate.Replace("$Amount$", dt.Rows[i]["INR"].ToString());
             orderTemplate = orderTemplate.Replace("$Order_Id$", dt.Rows[i]["ClientID"].ToString());
             billingNameTemplate = billingNameTemplate.Replace("$billing_cust_name$", dtClientInfo.Rows[0]["Name"].ToString());

            CCAvenueItems.Append(amountTemplate)
                 .Append(orderTemplate)
                 .Append(billingNameTemplate)
                 .Append(billingCustAddressTemplate)
                 .Append(billingCountryTemplate)
                 .Append(billingEmailTemplate)
                 .Append(billingTelTemplate)
                 .Append(billingStateTemplate)
                 .Append(billingCityTemplate)
                 .Append(billingZipTemplate)
                 .Append(deliveryNameTemplate)
                 .Append(deliveryCustAddressTemplate)
                 .Append(deliveryCountryTemplate)
           }
         return CCAvenueItems.ToString();
     }
 }


public string propcheckSum
 {
     get {
         libfuncs objLib = new libfuncs();
         string strCheckSum = objLib.getchecksum("YourMerchantID", Session["ClientID"].ToString(), strAmount, "UrReturnUrl", "your working key");
         return strCheckSum;
     }
 }



<div>
     <%=CCAvenueItemList%>
     <input type="hidden" name="Merchant_Id" value="yourmerchantID" />
     <input type="hidden" name="Checksum" value="<%=propcheckSum%>" />
     <input type="hidden" name="Redirect_Url" value="YourWebsite'sThankyoupage.aspx" />
     <input type="submit" value="Submit" runat="server" />
 </div> 

Solution 3

I have to implement ccavenue payment gateway in asp.net.

Are you sure you mean you need to implement this? Do you mean you want to integrate it?

Official Documentation

CC Avenue Documentation on page 12 talks about how you can integrate CCAvenue with your ASP.Net application.

Section 1.4 (page 17) provides a ASP.Net sample and Section 1.5 (page 19) shows how to test it. If these do not work, reaching out to CCAvenue's integration support sounds like a good idea.

The documentation also mentions on page 2

[email protected]

+91 22 26000816/846

+91 22 26491524

Being a paid service, they tend to provide good technical support to their end users to help them integrate their gateway with supported languages (of which ASP.Net is one from what I see).

ASP.NET example using C Sharp

Folks over at the ASP.Net forum have a post and response regarding CCAvenue integration using C#. Hope it helps.

Alternate Queries

A clearer question as to what part of the integration you're having issues with would help. The bounty seems to be looking for official/credible sources which the documentation linked to above is. The following questions come to mind:

  1. When attempting to use their sample did you ensure you replaced the test authentication keys with real ones?
  2. Was your return URL correctly configured on the CCAvenue website?
Share:
14,486
p.k
Author by

p.k

Updated on June 09, 2022

Comments

  • p.k
    p.k almost 2 years

    I have to implement ccavenue payment gateway in asp.net.

    I have searched lot on the internet but not able to find single working example with asp.net.

    I have tried example from site also but it is not documented and not proper . I have no idea about how to use this service with asp.net .

  • javatarz
    javatarz almost 10 years
    You've simply pasted the post I linked to in my answer 19 hours before your reply. :|
  • vivek
    vivek over 7 years
    First link has been removed. If possible update your answer. Thanks