Skip to content

Instantly share code, notes, and snippets.

@razarahil
Created February 17, 2016 04:55
Show Gist options
  • Save razarahil/697683ceca6ed107f26c to your computer and use it in GitHub Desktop.
Save razarahil/697683ceca6ed107f26c to your computer and use it in GitHub Desktop.
public void PayNow()
{
//initialize
tokenContext.setPaymentMessageSession(null);
ViewData["PaymentMessage"] = null;
EMedical.DataModel.UserLabTest labTest = tokenContext.getCurrentUserTest();
if (labTest != null)
{
string firstName = labTest.PatientName;
string amount = labTest.PayablePrice.ToString();
string productInfo = "Lab Product Purchase Online";
string email = labTest.Email;
string phone = labTest.ContactNumber;
RemotePost myremotepost = new RemotePost();
string key = ConfigurationManager.AppSettings["MERCHANT_KEY"];
string salt = ConfigurationManager.AppSettings["SALT"];
var DomainName = System.Web.HttpContext.Current.Request.Url.Host;
//posting all the parameters required for integration.
myremotepost.Url = ConfigurationManager.AppSettings["PAYU_BASE_URL"];
myremotepost.Add("key", ConfigurationManager.AppSettings["MERCHANT_KEY"]);
string txnid = Generatetxnid();
myremotepost.Add("txnid", txnid);
myremotepost.Add("amount", amount);
myremotepost.Add("productinfo", productInfo);
myremotepost.Add("firstname", firstName);
myremotepost.Add("phone", phone);
myremotepost.Add("email", email);
//myremotepost.Add("surl", "http://localhost:3677/User/Return");//Change the success url here depending upon the port number of your local system.
//myremotepost.Add("furl", "http://localhost:3677/User/Return");//Change the failure url here depending upon the port number of your local system.
myremotepost.Add("surl", "http://" + DomainName + "/User/Return");//Change the success url here depending upon the port number of your local system.
myremotepost.Add("furl", "http://" + DomainName + "/User/Return");//Change the failure url here depending upon the port number of your local system.
myremotepost.Add("service_provider", "payu_paisa");
string hashString = key + "|" + txnid + "|" + amount + "|" + productInfo + "|" + firstName + "|" + email + "|||||||||||" + salt;
//string hashString = "3Q5c3q|2590640|3053.00|OnlineBooking|vimallad|ladvimal@gmail.com|||||||||||mE2RxRwx";
string hash = Generatehash512(hashString);
myremotepost.Add("hash", hash);
myremotepost.Post();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment