// GET: Payment public ActionResult Index() { var PaymentStatus = "none"; SortedList <String, String> _responseFields = new SortedList <String, String>(new VPCStringComparer()); try { string hashSecret = ConfigurationManager.AppSettings["MigsSecureHashSecret"]; var secureHash = Request.QueryString["vpc_SecureHash"]; var txnResponseCode = Request.QueryString["vpc_TxnResponseCode"]; if (!string.IsNullOrEmpty(secureHash)) { if (!string.IsNullOrEmpty(hashSecret)) { var rawHashData = hashSecret + string.Join("", Request.QueryString.AllKeys.Where(k => k != "vpc_SecureHash").Select(k => Request.QueryString[k])); Request.QueryString.AllKeys.All(c => { _responseFields.Add(c, Request.QueryString[c]); return(true); }); var signature = PaymentHelperMethods.CreateSHA256Signature(_responseFields); if (signature != secureHash || txnResponseCode != "0") { PaymentStatus = "invalid"; //return View("Error", new ApplicationException("Invalid request.")); } else { PaymentStatus = "approved"; } } } ViewBag.PaymentStatus = PaymentStatus; var vpcResponse = new PaymentResponse(Request); return(View(vpcResponse)); } catch (Exception ex) { var message = "Exception encountered. " + ex.Message; return(View("Error", ex)); } }