public void SetPay(string baozhengjin,string orderid) { order o = new order(); string ali_account = o.OrderGetAliAccount(); System.DateTime currentTime = new System.DateTime(); currentTime = System.DateTime.Now; string out_order_no = ""; out_order_no = orderid + "_AA"; //out_trade_no 外部商家订单号 string out_trade_no = ""; out_trade_no = orderid + "_BB"; //业务参数赋值; string gateway = "https://www.alipay.com/cooperate/gateway.do?"; //'支付接口 string service = "unfreeze2fastpay"; string partner = "2088201885472720"; //partner 合作伙伴ID 保留字段 string sign_type = "MD5"; string key = "o272s6dqq0s60tm44sy314jvnsfeihd0"; //partner账户的支付宝安全校验码 string out_order_dt = "2008-01-17 21:46:00"; //外部系统订单生成时间 string buyer_nick = ali_account; //买家昵称 string seller_nick = "*****@*****.**"; //卖家昵称 string order_from = "100002"; //(6) 订单的来源地(电子客票使用,淘宝=100001) Y string old_out_order_no = orderid; //(64) 外部系统的冻结资金时的订单号 string goods_detail = "PREPAY"; //(400) 购买商品详情(不同于商品名称) Y string totle_fee = baozhengjin; // 交易总金额 (0.01-100000000.00元) N string price = baozhengjin; // 商品价格(0.01-100000000.00元) N string other_fee = "0"; // 其他费用(0.00-100000000.00元) N string op_type = "0006"; //(50) 见业务类型表 N string _input_charset = "utf-8"; string aliay_url = CreatUrl2( gateway, service, partner, sign_type, out_order_no, out_trade_no, seller_nick, buyer_nick, _input_charset, out_order_dt, op_type, totle_fee, price, other_fee, old_out_order_no, order_from, goods_detail, key ); // sign_type = "MD5" ' 见签名方式N //aliay_url = aliay_url.Replace("订舱保证金", "%e8%ae%a2%e8%88%b1%e4%bf%9d%e8%af%81%e9%87%91").Replace("返还订舱保证金", "%e8%bf%94%e8%bf%98%e8%ae%a2%e8%88%b1%e4%bf%9d%e8%af%81%e9%87%91"); aliay_url = aliay_url.Replace("预存费用", "%e9%a2%84%e5%ad%98%e8%b4%b9%e7%94%a8"); XmlTextReader textReader = null; try { textReader = new XmlTextReader(aliay_url); textReader.Read(); textReader.WhitespaceHandling = WhitespaceHandling.None; baozhengjin = baozhengjin.ToString(); //实际订舱费比支付宝放大10w倍,正式版去掉 o.OrderAddCredit(baozhengjin, "1", orderid, "0", "1");//预存保证金 data_conn cn = new data_conn(); string sql = "UPDATE TB_ORDER_ALIPREPAY SET alipay_pay_return = 1 WHERE order_code = '" + orderid + "'"; //更新存根状态 cn.mdb_exe(sql); ScriptManager.RegisterStartupScript(this, this.GetType(), "提示", "alert(\"支付宝到账成功!\");", true); //Response.Write("成功"); //while (textReader.Read()) //{ // Response.Write("<br>Type=" + textReader.NodeType + "<br>Name=" + textReader.Name + "<br>Value=" + textReader.Value + "<br>LocalName=" + textReader.LocalName + "<br>XmlLang=" + textReader.XmlLang); // 自己定义输出格式 //} } catch { ScriptManager.RegisterStartupScript(this, this.GetType(), "提示", "alert(\"支付宝到账失败!\");", true); } finally { if (textReader != null) { textReader.Close(); } } //ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "提示", "window.open('" + aliay_url + "' ,'_blank','');", true); }