protected void Page_Load(object sender, EventArgs e) { /// <summary> /// created by sunzhizhi 2006.5.21,[email protected]。 /// </summary> string partner = "2088001390620672"; //partner合作伙伴id(必须填写) string key = "kf69mv76m23a9vp34nkz6s16aux29h29"; //partner 的对应交易安全校验码(必须填写) string alipayNotifyURL = "https://www.alipay.com/cooperate/gateway.do?"; alipayNotifyURL = alipayNotifyURL + "service=notify_verify" + "&partner=" + partner + "¬ify_id=" + Request.Form["notify_id"]; //获取支付宝ATN返回结果,true是正确的订单信息,false 是无效的 string responseTxt = Get_Http(alipayNotifyURL, 120000); int i; NameValueCollection coll; coll = Request.Form; //Load Form variables into NameValueCollection variable. String[] requestarr = coll.AllKeys; // Get names of all forms into a string array. string[] Sortedstr = BubbleSort(requestarr); //进行排序; //构造待md5摘要字符串 ; string prestr = ""; for (i = 0; i < Sortedstr.Length; i++) { if (Request.Form[Sortedstr[i]] != "" && Sortedstr[i] != "sign" && Sortedstr[i] != "sign_type") { if (i == Sortedstr.Length - 1) { prestr = prestr + Sortedstr[i] + "=" + Request.Form[Sortedstr[i]]; } else { prestr = prestr + Sortedstr[i] + "=" + Request.Form[Sortedstr[i]] + "&"; } } } prestr = prestr + key; string mysign = GetMD5(prestr); string sign = Request.Form["sign"]; if (mysign == sign && responseTxt == "true") //验证支付发过来的消息,签名是否正确 { //先充值 后消费 string loginname = this.Page.User.Identity.Name; //业务逻辑处理 string orderNo = Request.QueryString["out_trade_no"].ToString().Trim(); string transaction_id = Request.QueryString["trade_no"].Trim(); string total_fee = Request.QueryString["total_fee"].Trim(); Tz888.BLL.Pay1.PayOrder bbl = new Tz888.BLL.Pay1.PayOrder(); bbl.PayVipSuccess(orderNo, loginname, total_fee); //Tz888.BLL.StrikeOrder dal = new Tz888.BLL.StrikeOrder(); //bool b = dal.StrikeSuccess(orderNo, "alipay", transaction_id, loginname); //bool num = dal.StrikeSuccess(orderNo, "alipay", transaction_id, loginname); //if (b) //{ // Tz888.Common.MessageBox.Show(this.Page, "RECV_ORD_ID_" + orderNo); //} //else //{ // Tz888.Common.MessageBox.Show(this.Page, "充值未成功,请联系我们的客服!"); //} } else { Tz888.Common.MessageBox.Show(this.Page, "交易失败!"); } }
protected void Page_Load(object sender, EventArgs e) { //lblPnr.Text = Request.QueryString["out_trade_no"].Trim(); //资源交易号 //lblSys.Text = Request.QueryString["trade_no"].Trim(); //外部交易号 //lblPayPoint.Text = Request.QueryString["total_fee"].Trim(); //实际支付金额 //lblPoint.Text = bll.getTotalFee(Convert.ToInt64(lblPnr.Text)); //需要支付的点数 lab_OrderNo.Text = Request.QueryString["out_trade_no"].Trim(); //资源交易号 lab_Point.Text = Request.QueryString["total_fee"].Trim(); //实际支付金额 lab_aliNo.Text = Request.QueryString["trade_no"].Trim(); //外部交易号 order_no = Request.QueryString["out_trade_no"].Trim(); /// <summary> /// created by sunzhizhi 2006.5.21,[email protected]。 /// </summary> string partner = "2088001390620672"; //***partner合作伙伴id(必须填写) string key = "kf69mv76m23a9vp34nkz6s16aux29h29"; //**partner 的对应交易安全校验码(必须填写) string alipayNotifyURL = "http://notify.alipay.com/trade/notify_query.do?"; alipayNotifyURL = alipayNotifyURL + "service=notify_verify" + "&partner=" + partner + "¬ify_id=" + Request.QueryString["notify_id"]; //获取支付宝ATN返回结果,true是正确的订单信息,false 是无效的 string responseTxt = Get_Http(alipayNotifyURL, 120000); int i; NameValueCollection coll; coll = Request.QueryString; //Load Form variables into NameValueCollection variable String[] requestarr = coll.AllKeys; // Get names of all forms into a string array. //进行排序; string[] Sortedstr = BubbleSort(requestarr); // for (i = 0; i < Sortedstr.Length; i++) // { // Response.Write("Form: " + Sortedstr[i] + "=" + Request.QueryString[Sortedstr[i]] + "<br>"); // } //构造待md5摘要字符串 ; StringBuilder prestr = new StringBuilder(); for (i = 0; i < Sortedstr.Length; i++) { if (Request.Form[Sortedstr[i]] != "" && Sortedstr[i] != "sign" && Sortedstr[i] != "sign_type") { if (i == Sortedstr.Length - 1) { prestr.Append(Sortedstr[i] + "=" + Request.QueryString[Sortedstr[i]]); } else { prestr.Append(Sortedstr[i] + "=" + Request.QueryString[Sortedstr[i]] + "&"); } } } prestr.Append(key); //生成Md5摘要; string mysign = GetMD5(prestr.ToString()); string sign = Request.QueryString["sign"]; if (mysign == sign && responseTxt == "true") //验证支付发过来的消息,签名是否正确 { //先充值 后消费 string loginname = this.Page.User.Identity.Name; //业务逻辑处理 string orderNo = Request.QueryString["out_trade_no"].ToString().Trim(); string transaction_id = Request.QueryString["trade_no"].Trim(); string total_fee = Request.QueryString["total_fee"].Trim(); Tz888.BLL.Pay1.PayOrder bbl = new Tz888.BLL.Pay1.PayOrder(); bbl.PayVipSuccess(orderNo, loginname, total_fee); //Tz888.BLL.StrikeOrder dal = new Tz888.BLL.StrikeOrder(); //bool b = dal.StrikeSuccess(orderNo, "alipay", transaction_id, loginname); } }