protected void btnSub_Click(object sender, EventArgs e) { string apiurl = "https://gateway.nowtopay.com/NowtoPay.html"; string partner = "16962"; string key = "a7307538dab143fcaa7edb741a31629d"; string ordernumber = txtOrderNo.Text; string banktype = Request.Form["banktype"];// string attach = "buy"; string paymoney = txtMoney.Text; string callbackurl = "https://xxx/pay/callback.aspx"; string hrefbackurl = "https://xxx"; string isshow = "1"; string signSource = string.Format("partner={0}&banktype={1}&paymoney={2}&ordernumber={3}&callbackurl={4}{5}", partner, banktype, paymoney, ordernumber, callbackurl, key); string sign = NOWTOPAYCommon.MD5(signSource, false).ToLower(); string postUrl = apiurl + "?partner=" + partner; StringBuilder postData = new StringBuilder(postUrl); postData.Append("&banktype=" + banktype); postData.Append("&paymoney=" + paymoney); postData.Append("&ordernumber=" + ordernumber); postData.Append("&callbackurl=" + callbackurl); postData.Append("&hrefbackurl=" + hrefbackurl); postData.Append("&attach=" + attach); postData.Append("&isshow=" + isshow); postData.Append("&sign=" + sign); Response.Redirect(postData.ToString()); }
protected void Page_Load(object sender, EventArgs e) { string partner = "16962"; //商户ID string Key = "e23fd5edeb17d910f36ea04e6e08d67c"; //商户KEY int orderstatus = Convert.ToInt32(Request["orderstatus"]); string ordernumber = Request["ordernumber"]; string paymoney = Request["paymoney"]; string sign = Request["sign"]; string attach = Request["attach"]; string signSource = string.Format("partner={0}&ordernumber={1}&orderstatus={2}&paymoney={3}{4}", partner, ordernumber, orderstatus, paymoney, Key); if (sign == NOWTOPAYCommon.MD5(signSource, false))//签名正确 { //此处作逻辑处理 } Response.Write("ok"); Response.End(); }