How to implement CCAvenue payment gateway option [closed]
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
开发者_运维问答Closed 8 years ago.
Improve this questionWe need to implement CCAvenue payment gateway option. How can I do this using ASP.net/C#?
Please check the Integration Manual in ccavenue offical site.I hope it will help you
http://world.ccavenue.com/content/works_any_shoppingcart.jsp
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.
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();
}
}
Another property to return checksum is
public string propcheckSum
{
get {
libfuncs objLib = new libfuncs();
string strCheckSum = objLib.getchecksum("YourMerchantID", Session["ClientID"].ToString(), strAmount, "UrReturnUrl", "your working key");
return strCheckSum;
}
}
And used this property in design source view as like below
<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>
You can get the merchant ID and generate the working key in CCAvenue website. That is in merchant login.
Hope this helps someone atleast.
You will have to signup first or contact them and ask for their payment integration manual. I don't think its same as integrating paypal in your website.
精彩评论