protected void Page_Load(object sender, EventArgs e) { Lebi_OnlinePay pay = B_Lebi_OnlinePay.GetModel("Code='95epay'"); if (pay == null) { Log.Add("在线支付接口 95epay 配置错误"); Response.End(); return; } Lebi_Currency currendy = B_Lebi_Currency.GetModel(pay.Currency_id); int order_id = RequestTool.RequestInt("order_id", 0); Lebi_Order order = B_Lebi_Order.GetModel(order_id); if (order == null) { Response.Write("订单错误"); Response.End(); return; } sorder.ord_no = order.Code; //订单编号 sorder.ord_amt = order.Money_Pay * currendy.ExchangeRate; //订单金额 sorder.ord_date = DateTime.Now.ToString("yyyyMMdd"); //交易日期时间 sorder.ver = "01"; sorder.mrch_no = pay.UserName; }
public WxPayConfig(Lebi_Order order) { string where = ""; if (order != null) { where = "id = " + order.OnlinePay_id + ""; } else { where = "Code='weixinpayh5'"; } Lebi_OnlinePay onlinepay = B_Lebi_OnlinePay.GetModel(where); if (onlinepay == null) { Log.Add("在线支付接口 weixinpay 配置错误"); return; } Shop.Bussiness.Site site = new Shop.Bussiness.Site(); B_BaseConfig bconfig = new B_BaseConfig(); BaseConfig SYS = bconfig.LoadConfig(); MCHID = onlinepay.UserName; KEY = onlinepay.UserKey; APPID = onlinepay.Appid; //SystemLog.Add("weixinpay-WxPayConfig" + "MCHID : " + MCHID + ",KEY : " + KEY + ",APPID : " + APPID); //APPSECRET = onlinepay.Appkey; //IP = HttpContext.Current.Request.ServerVariables.Get("Local_Addr"); NOTIFY_URL = "http://" + RequestTool.GetRequestDomain() + site.WebPath + "/onlinepay/weixinpayh5/payNotifyUrl.aspx"; }
static Config() { //↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ Lebi_OnlinePay pay = B_Lebi_OnlinePay.GetModel("Code='alipaybatch'"); if (pay == null) { return; } //合作身份者ID,以2088开头由16位纯数字组成的字符串 partner = pay.UserName; //交易安全检验码,由数字和字母组成的32位字符串 key = pay.UserKey; //↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ //字符编码格式 目前支持 gbk 或 utf-8 input_charset = "utf-8"; //签名方式,选择项:RSA、DSA、MD5 sign_type = "MD5"; }
protected void Page_Load(object sender, EventArgs e) { Lebi_OnlinePay pay = B_Lebi_OnlinePay.GetModel("Code='weixinpay'"); if (pay == null) { Log.Add("在线支付接口 weixinpay 配置错误"); return; } Lebi_Currency currendy = B_Lebi_Currency.GetModel(pay.Currency_id); int order_id = RequestTool.RequestInt("order_id", 0); Lebi_Order order = B_Lebi_Order.GetModel(order_id); if (order == null) { Response.Write("订单错误"); Response.End(); return; } TenpayUtil tu = new TenpayUtil(); string sp_billno = order.Code; //当前时间 yyyyMMdd string date = DateTime.Now.ToString("yyyyMMdd"); //if (null == sp_billno) //{ // //生成订单10位序列号,此处用时间和随机数生成,商户根据自己调整,保证唯一 // sp_billno = DateTime.Now.ToString("HHmmss") + TenpayUtil.BuildRandomStr(4); //} //else //{ // sp_billno = Request["order_no"].ToString(); //} sp_billno = TenpayUtil.partner + sp_billno; RequestHandler outParams = new RequestHandler(Context); outParams.init(); string productid = sp_billno; string timeStamp = TenpayUtil.getTimestamp(); string nonceStr = TenpayUtil.getNoncestr(); RequestHandler Params = new RequestHandler(Context); Params.setParameter("appid", TenpayUtil.appid); Params.setParameter("appkey", TenpayUtil.appkey); Params.setParameter("noncestr", nonceStr); Params.setParameter("timestamp", timeStamp); Params.setParameter("productid", productid); string sign = Params.createSHA1Sign(); Params.setParameter("sign", sign); parm = "weixin://wxpay/bizpayurl?sign=" + sign + "&appid=" + TenpayUtil.appid + "&productid=" + productid + "&timeStamp=" + timeStamp + "&nonceStr=" + nonceStr; Response.Write(parm); parm = QRfromGoogle(parm); }
public Lebi_OnlinePay Getpay(int id) { Lebi_OnlinePay model = B_Lebi_OnlinePay.GetModel("Supplier_id=" + CurrentSupplier.id + " and parentid=" + id); if (model == null) { model = new Lebi_OnlinePay(); } return(model); }
/// <summary> /// 编辑在线支付 /// </summary> public void OnlinePay_Edit() { int id = RequestTool.RequestInt("id", 0); Lebi_OnlinePay parentmodel = B_Lebi_OnlinePay.GetModel(id); if (parentmodel == null) { Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}"); return; } Lebi_OnlinePay model = B_Lebi_OnlinePay.GetModel("parentid=" + parentmodel.id + " and Supplier_id=" + CurrentSupplier.id + ""); if (model == null) { model = new Lebi_OnlinePay(); } if (model.id == 0) { if (!Power("onlinepay_add", "添加在线支付")) { AjaxNoPower(); return; } } else { if (!Power("onlinepay_edit", "编辑在线支付")) { AjaxNoPower(); return; } } model.UserName = RequestTool.RequestSafeString("UserName"); model.UserKey = RequestTool.RequestSafeString("UserKey"); model.Email = RequestTool.RequestSafeString("Email"); model.Sort = RequestTool.RequestInt("Sort", 0); model.IsUsed = RequestTool.RequestInt("IsUsed", 0); model.Supplier_id = CurrentSupplier.id; model.parentid = parentmodel.id; if (model.id == 0) { B_Lebi_OnlinePay.Add(model); model.id = B_Lebi_OnlinePay.GetMaxId(); } else { B_Lebi_OnlinePay.Update(model); } Log.Add("编辑在线支付", "OnlinePay", model.id.ToString(), CurrentSupplier, id.ToString()); Response.Write("{\"msg\":\"OK\",\"id\":\"" + model.id + "\"}"); }
protected void Page_Load(object sender, EventArgs e) { int id = RequestTool.RequestInt("id", 0); parentmodel = B_Lebi_OnlinePay.GetModel(id); if (parentmodel == null) { PageError(); return; } model = B_Lebi_OnlinePay.GetModel("parentid=" + parentmodel.id + " and Supplier_id=" + CurrentSupplier.id + ""); if (model == null) { model = new Lebi_OnlinePay(); } if (model.id == 0) { if (!Power("onlinepay_add", "添加在线支付")) { WindowNoPower(); } } else { if (!Power("onlinepay_edit", "编辑在线支付")) { WindowNoPower(); } } switch (model.Code) { case "molpay": username = "******"; key = "Verify Key"; email = Tag("邮箱"); break; case "wangyinzaixian": username = "******"; key = "MD5密钥"; email = Tag("邮箱"); break; default: username = Tag("帐号"); key = Tag("KEY"); email = Tag("邮箱"); break; } }
/** * 生成直接支付url,支付url有效期为2小时,模式二 * @param productId 商品ID * @return 模式二URL */ public static string GetPayUrl(string productId) { //Log.Info(this.GetType().ToString(), "Native pay mode 2 url is producing..."); Lebi_Order order = B_Lebi_Order.GetModel("id=" + productId); if (order == null) { return(""); } Lebi_OnlinePay pay = B_Lebi_OnlinePay.GetModel("id = " + order.OnlinePay_id + " and Code='weixinpayh5'"); if (pay == null) { Log.Add("在线支付接口 weixinpay 配置错误"); return(""); } Lebi_Currency currendy = B_Lebi_Currency.GetModel(pay.Currency_id); if (pay.FeeRate > 0) { order.Money_OnlinepayFee = order.Money_Pay * pay.FeeRate / 100; } string order_price = (order.Money_Pay * currendy.ExchangeRate * 100 * (1 + (pay.FeeRate / 100))).ToString("0"); WxPayData data = new WxPayData(); data.SetValue("body", "订单号:" + order.Code); //商品描述 data.SetValue("attach", ""); //附加数据 data.SetValue("out_trade_no", order.Code); data.SetValue("total_fee", order_price); //总金额 data.SetValue("time_start", DateTime.Now.ToString("yyyyMMddHHmmss")); //交易起始时间 data.SetValue("time_expire", DateTime.Now.AddMinutes(10).ToString("yyyyMMddHHmmss")); //交易结束时间 data.SetValue("goods_tag", "订单号:" + order.Code); //商品标记 data.SetValue("trade_type", "NATIVE"); //交易类型 data.SetValue("product_id", productId); //商品ID try { WxPayData result = WxPayApi.UnifiedOrder(data); //调用统一下单接口 string url = result.GetValue("code_url").ToString(); //获得统一下单接口返回的二维码链接 //Log.Info(this.GetType().ToString(), "Get native pay mode 2 url : " + url); return(url); } catch (System.NullReferenceException) { return(""); } }
public string tenpay_notify = ""; //支付完成后的回调处理页面,*替换成notify_url.asp所在路径 public TenpayUtil(Lebi_Order order) { Lebi_OnlinePay onlinepay = B_Lebi_OnlinePay.GetModel("id = " + order.OnlinePay_id + ""); if (onlinepay == null) { Log.Add("在线支付接口 weixinpay 配置错误"); return; } Shop.Bussiness.Site site = new Shop.Bussiness.Site(); //B_BaseConfig bconfig = new B_BaseConfig(); //BaseConfig SYS = bconfig.LoadConfig(); mch_id = onlinepay.UserName; key = onlinepay.UserKey; appid = onlinepay.Appid; // SYS.platform_weixin_id; appkey = onlinepay.UserKey; tenpay_notify = "http://" + RequestTool.GetRequestDomain() + site.WebPath + "/onlinepay/weixinpay/payNotifyUrl.aspx"; }
/// <summary> /// 获取一个支付方式的对于供应商设置或(默认设置) /// </summary> /// <param name="pay"></param> /// <returns></returns> public Lebi_OnlinePay Getpay(Lebi_OnlinePay pay) { if (order.IsSupplierCash == 0) { return(pay); } Lebi_Supplier supplier = B_Lebi_Supplier.GetModel(order.Supplier_id); if (supplier != null) { //供应商发货商城收款的情况 if (supplier.IsCash == 0) { return(pay); } } Lebi_OnlinePay p = B_Lebi_OnlinePay.GetModel("parentid=" + pay.id + " and Supplier_id=" + order.Supplier_id + " and IsUsed=1"); if (p != null) { if (Lang(p.Name) == "") { p.Name = pay.Name; } if (Lang(p.Description) == "") { p.Name = pay.Name; } if (p.Logo == "") { p.Logo = pay.Logo; } } return(p); }
public static string package = ""; //进行支付需要的包 protected void Page_Load(object sender, EventArgs e) { Lebi_OnlinePay pay = B_Lebi_OnlinePay.GetModel("Code='weixinpay'"); if (pay == null) { Log.Add("在线支付接口 weixinpay 配置错误"); return; } Shop.Bussiness.Site site = new Shop.Bussiness.Site(); B_BaseConfig bconfig = new B_BaseConfig(); BaseConfig SYS = bconfig.LoadConfig(); partnerid = pay.UserName; partnerkey = pay.UserKey; appid = SYS.platform_weixin_id; appsecret = SYS.platform_weixin_secret; appkey = ""; notify_url = "http://" + RequestTool.GetRequestDomain() + site.WebPath + "/onlinepay/weixinpay.aspx"; Lebi_Currency currendy = B_Lebi_Currency.GetModel(pay.Currency_id); int order_id = RequestTool.RequestInt("order_id", 0); Lebi_Order order = B_Lebi_Order.GetModel(order_id); if (order == null) { Response.Write("订单错误"); Response.End(); return; } string order_price = (order.Money_Pay * currendy.ExchangeRate * 100).ToString(); string sp_billno = order.Code; Lebi_User user = B_Lebi_User.GetModel(order.User_id); if (user == null) { Response.Write("订单错误"); Response.End(); return; } /////////////////////////////////////////////////////////////////////////////////////////////// //当前时间 yyyyMMdd string date = DateTime.Now.ToString("yyyyMMdd"); if (null == sp_billno) { //生成订单10位序列号,此处用时间和随机数生成,商户根据自己调整,保证唯一 sp_billno = DateTime.Now.ToString("HHmmss") + TenpayUtil.BuildRandomStr(4); } else { sp_billno = Request["order_no"]; } sp_billno = partnerid + sp_billno; //创建支付应答对象 var packageReqHandler = new RequestHandler(Context); //初始化 packageReqHandler.init(); timeStamp = TenpayUtil.getTimestamp(); nonceStr = TenpayUtil.getNoncestr(); //设置package订单参数 packageReqHandler.setParameter("body", "test"); //商品信息 127字符 packageReqHandler.setParameter("appid", user.bind_weixin_id); packageReqHandler.setParameter("mch_id", mchid); packageReqHandler.setParameter("nonce_str", nonceStr.ToLower()); packageReqHandler.setParameter("notify_url", notify_url); packageReqHandler.setParameter("openid", "openid"); packageReqHandler.setParameter("out_trade_no", sp_billno); //商家订单号 packageReqHandler.setParameter("spbill_create_ip", Page.Request.UserHostAddress); //用户的公网ip,不是商户服务器IP packageReqHandler.setParameter("total_fee", "1"); //商品金额,以分为单位(money * 100).ToString() packageReqHandler.setParameter("trade_type", "JSAPI"); //获取package包 sign = packageReqHandler.CreateMd5Sign("key", appkey); WriteFile(Server.MapPath("") + "\\Log.txt", sign); packageReqHandler.setParameter("sign", sign); string data = packageReqHandler.parseXML(); WriteFile(Server.MapPath("") + "\\Log.txt", data); string prepayXml = HttpUtil.Send(data, "https://api.mch.weixin.qq.com/pay/unifiedorder"); WriteFile(Server.MapPath("") + "\\Log.txt", prepayXml); //获取预支付ID var xdoc = new XmlDocument(); xdoc.LoadXml(prepayXml); XmlNode xn = xdoc.SelectSingleNode("xml"); XmlNodeList xnl = xn.ChildNodes; if (xnl.Count > 7) { prepayId = xnl[7].InnerText; package = string.Format("prepay_id={0}", prepayId); WriteFile(Server.MapPath("") + "\\Log.txt", package); } //设置支付参数 var paySignReqHandler = new RequestHandler(Context); paySignReqHandler.setParameter("appId", appId); paySignReqHandler.setParameter("timeStamp", timeStamp); paySignReqHandler.setParameter("nonceStr", nonceStr); paySignReqHandler.setParameter("package", package); paySignReqHandler.setParameter("signType", "MD5"); paySign = paySignReqHandler.CreateMd5Sign("key", appkey); WriteFile(Server.MapPath("") + "\\Log.txt", paySign); }
protected void Page_Load(object sender, EventArgs e) { //创建ResponseHandler实例 ResponseHandler resHandler = new ResponseHandler(Context); //判断签名 try { //string return_code = RequestTool.RequestString("return_code");//SUCCESS/FAIL此字段是通信标识,非交易标识,交易是否成功需要查看 result_code 来判断 //string return_msg = RequestTool.RequestString("return_msg");//返回信息,如非空,为错误原因/签名失败/参数格式校验错误 //string appid = RequestTool.RequestString("appid"); //string mch_id = RequestTool.RequestString("mch_id"); //string nonce_str = RequestTool.RequestString("nonce_str"); //string sign = RequestTool.RequestString("sign"); //string result_code = RequestTool.RequestString("result_code");//业务结果SUCCESS/FAIL //string error_code = RequestTool.RequestString("error_code"); //string error_code_des = RequestTool.RequestString("error_code_des"); //string openid = RequestTool.RequestString("openid"); //string trade_type = RequestTool.RequestString("trade_type");//交易类型 //string bank_type = RequestTool.RequestString("bank_type");//out_trade_no //string total_fee = RequestTool.RequestString("total_fee"); //string out_trade_no = RequestTool.RequestString("out_trade_no"); //string attach = RequestTool.RequestString("attach");//商家数据包,原样返回 //string time_end = RequestTool.RequestString("time_end"); //string transaction_id = RequestTool.RequestString("transaction_id");//微信支付单号 #region 协议参数===================================== //--------------协议参数-------------------------------------------------------- //SUCCESS/FAIL此字段是通信标识,非交易标识,交易是否成功需要查 string return_code = resHandler.getParameter("return_code"); //返回信息,如非空,为错误原因签名失败参数格式校验错误 string return_msg = resHandler.getParameter("return_msg"); //微信分配的公众账号 ID string appid = resHandler.getParameter("appid"); //以下字段在 return_code 为 SUCCESS 的时候有返回-------------------------------- //微信支付分配的商户号 string mch_id = resHandler.getParameter("mch_id"); //微信支付分配的终端设备号 string device_info = resHandler.getParameter("device_info"); //微信分配的公众账号 ID string nonce_str = resHandler.getParameter("nonce_str"); //业务结果 SUCCESS/FAIL string result_code = resHandler.getParameter("result_code"); //错误代码 string err_code = resHandler.getParameter("err_code"); //结果信息描述 string err_code_des = resHandler.getParameter("err_code_des"); //以下字段在 return_code 和 result_code 都为 SUCCESS 的时候有返回--------------- //-------------业务参数--------------------------------------------------------- //用户在商户 appid 下的唯一标识 string openid = resHandler.getParameter("openid"); //用户是否关注公众账号,Y-关注,N-未关注,仅在公众账号类型支付有效 string is_subscribe = resHandler.getParameter("is_subscribe"); //JSAPI、NATIVE、MICROPAY、APP string trade_type = resHandler.getParameter("trade_type"); //银行类型,采用字符串类型的银行标识 string bank_type = resHandler.getParameter("bank_type"); //订单总金额,单位为分 string total_fee = resHandler.getParameter("total_fee"); //货币类型,符合 ISO 4217 标准的三位字母代码,默认人民币:CNY string fee_type = resHandler.getParameter("fee_type"); //微信支付订单号 string transaction_id = resHandler.getParameter("transaction_id"); //商户系统的订单号,与请求一致。 string out_trade_no = resHandler.getParameter("out_trade_no"); //商家数据包,原样返回 string attach = resHandler.getParameter("attach"); //支 付 完 成 时 间 , 格 式 为yyyyMMddhhmmss,如 2009 年12 月27日 9点 10分 10 秒表示为 20091227091010。时区为 GMT+8 beijing。该时间取自微信支付服务器 string time_end = resHandler.getParameter("time_end"); #endregion SystemLog.Add("JSAPI微信支付回调payNotifyUrl"); Lebi_Order order = B_Lebi_Order.GetModel("Code=lbsql{'" + out_trade_no + "'}"); if (order == null) { Response.Write("系统错误"); SystemLog.Add("JSAPI微信支付-订单号" + out_trade_no + "不存在"); Response.End(); return; } TenpayUtil tu = new TenpayUtil(order); //SystemLog.Add(return_code + "|||" + result_code + "|||" + openid + "|||" + mch_id + "|||" + out_trade_no); if (return_code == "SUCCESS" && result_code == "SUCCESS") { Lebi_User user = B_Lebi_User.GetModel(order.User_id); Lebi_OnlinePay pay = B_Lebi_OnlinePay.GetModel("Code='weixinpay' and ','+Language_ids+',' like '%," + order.Language_id + ",%'"); if (pay == null) { Log.Add("在线支付接口 weixinpay 配置错误"); SystemLog.Add("JSAPI微信支付-接口配置错误"); return; } //if (user.bind_weixin_id == openid && pay.UserName == mch_id) //{ Order.OnlinePaySuccess(out_trade_no, transaction_id, false); Response.Write(paysuccess()); return; //} } SystemLog.Add("JSAPI微信支付-签名失败"); Response.Write(payerror("签名失败")); } catch (Exception ex) { SystemLog.Add("JSAPI微信支付-参数格式校验错误[" + ex.ToString() + "]"); Response.Write(payerror("参数格式校验错误")); } }
/// <summary> /// 生成新订单 /// </summary> public void order_save() { if (CurrentUserLevel.BuyRight != 1) { Response.Write("{\"msg\":\"" + Tag("您所在的分组不允许下单") + "\"}"); return; } int pay_id = RequestTool.RequestInt("pay_id", 0); int sid = RequestTool.RequestInt("sid", 0);//结算供应商ID int onlinepay_id = RequestTool.RequestInt("onlinepay_id", 0); decimal Money_UserCut = RequestTool.RequestDecimal("Money_UserCut", 0); int usermoneytype = RequestTool.RequestInt("usermoneytype", 0); string Pay_Password = RequestTool.RequestSafeString("Pay_Password"); Lebi_PickUp pick = null; DateTime pickdate = System.DateTime.Now; if (usermoneytype == 3) { if (Pay_Password == "") { Response.Write("{\"msg\":\"" + Tag("请输入支付密码") + "\"}"); return; } else { if (EX_User.MD5(Pay_Password) != CurrentUser.Pay_Password) { Response.Write("{\"msg\":\"" + Tag("支付密码不正确") + "\"}"); return; } } if (Money_UserCut > 0 && Money_UserCut > CurrentUser.Money) { Response.Write("{\"msg\":\"" + Tag("余额不足") + "\"}"); return; } } Lebi_Pay pay = B_Lebi_Pay.GetModel(pay_id); if (pay == null) { Response.Write("{\"msg\":\"" + Tag("请设置付款方式") + "\"}"); return; } Basket basket = new Basket(sid); int CustomOfflineMoney = RequestTool.RequestInt("CustomOfflineMoney" + pay.id, 0); decimal OfflineMoney = RequestTool.RequestDecimal("OfflineMoney" + pay.id, 0); if (CustomOfflineMoney == 1) { if (pay.Code != "OfflinePay" && pay.Code != "OnlinePay") { //订单如果选择了线下支付,并且非货到付款 if (OfflineMoney < basket.Money_Product) { Response.Write("{\"msg\":\"" + Tag("打款金额不能少于订单金额") + "\"}"); return; } } } if (pay.Code == "OnlinePay") { Lebi_OnlinePay onpay = B_Lebi_OnlinePay.GetModel(onlinepay_id); if (onpay == null) { Response.Write("{\"msg\":\"" + Tag("请设置付款方式") + "\"}"); return; } } if (basket.Products.Count == 0) { Response.Write("{\"msg\":\"" + Tag("购物车为空") + "\"}"); return; } foreach (Lebi_User_Product up in basket.Products) { if (up.count < 1) { Response.Write("{\"msg\":\"" + Tag("购物车异常") + "\"}"); return; } } if (basket.Point_Buy > 0 && (basket.Point_Buy > CurrentUser.Point)) { Response.Write("{\"msg\":\"" + Tag("积分不足") + "\"}"); return; } int ProductCount = 0; foreach (Lebi_User_Product up in basket.Products) { Lebi_Product pro = B_Lebi_Product.GetModel(up.Product_id); if (pro.Type_id_ProductType != 323) { ProductCount += up.count; } //<-{ 判断是否上架状态 by lebi.kingdge 2015-02-10 if (pro.Type_id_ProductStatus != 101) { Response.Write("{\"msg\":\"" + Lang(pro.Name) + " " + Tag("该商品已经下架") + "\"}"); return; } //}-> if (pro.Type_id_ProductType != 324) { int levelcount = ProductLevelCount(pro); if (up.count < levelcount) { Response.Write("{\"msg\":\"" + Lang(pro.Name) + " " + Tag("起订量") + " " + levelcount + "\"}"); return; } } if (pro.Type_id_ProductType != 320 && pro.Time_Expired > System.DateTime.Now) { if (pro.Count_Limit < up.count && pro.Count_Limit > 0) { Response.Write("{\"msg\":\"" + Tag("购买数量大于限购数量") + "\"}"); return; } } if (SYS.IsNullStockSale != "1") { if (pro.Count_Stock - pro.Count_Freeze < up.count && pro.Type_id_ProductType != 324) { Response.Write("{\"msg\":\"" + Lang(pro.Name) + "" + Tag("库存不足") + "\"}"); return; } } } //验证当前分组允许的最低订单提交金额 if (CurrentUserLevel.OrderSubmit > 0) { if (basket.Money_Product < CurrentUserLevel.OrderSubmit) { Response.Write("{\"msg\":\"" + Tag("单笔订单最低金额为:") + FormatMoney(CurrentUserLevel.OrderSubmit) + "\"}"); return; } } //验证当前分组允许的最低订单提交数量 if (CurrentUserLevel.OrderSubmitCount > 0 && ProductCount > 0) { if (ProductCount < CurrentUserLevel.OrderSubmitCount) { Response.Write("{\"msg\":\"" + Tag("单笔订单最低数量为:") + CurrentUserLevel.OrderSubmitCount + "\"}"); return; } } Lebi_User_Address shouhuo = B_Lebi_User_Address.GetModel(CurrentUser.User_Address_id); if (shouhuo == null) { Response.Write("{\"msg\":\"" + Tag("未设置收获地址") + "\"}"); return; } if (CurrentUser.Transport_Price_id == "") { Response.Write("{\"msg\":\"" + Tag("运费设置错误") + "\"}"); return; } foreach (BasketShop shop in basket.Shops) { Lebi_Transport_Price tprice = B_Lebi_Transport_Price.GetModel("id in (lbsql{" + CurrentUser.Transport_Price_id + "}) and Supplier_id=" + shop.Shop.id + ""); if (tprice == null) { Response.Write("{\"msg\":\"" + Tag("运费设置错误") + "\"}"); return; } Lebi_Transport transport = B_Lebi_Transport.GetModel(tprice.Transport_id); if (tprice == null) { Response.Write("{\"msg\":\"" + Tag("运费设置错误") + "\"}"); return; } //检查运费设置是否正确 if (!EX_Area.CheckAreaPrice(tprice, shouhuo.Area_id)) { Response.Write("{\"msg\":\"" + Tag("运费设置错误") + "\"}"); return; } if (transport.Type_id_TransportType == 332)//自提检查 { int pickup_id = RequestTool.RequestInt("pickup_id" + shop.Shop.id); string pickdate_ = RequestTool.RequestString("pickupdate_" + pickup_id); try { pickdate = Convert.ToDateTime(pickdate_); } catch { Response.Write("{\"msg\":\"" + Tag("配送方式设置错误") + "\"}"); return; } pick = B_Lebi_PickUp.GetModel(pickup_id); if (pick == null) { Response.Write("{\"msg\":\"" + Tag("配送方式设置错误") + "\"}"); return; } if (pick.IsCanWeekend == 0 && (pickdate.DayOfWeek == DayOfWeek.Saturday || pickdate.DayOfWeek == DayOfWeek.Sunday)) { Response.Write("{\"msg\":\"" + Tag("配送方式设置错误") + "\"}"); return; } if (System.DateTime.Now.Date.AddDays(pick.BeginDays) > pickdate) { Response.Write("{\"msg\":\"" + Tag("配送方式设置错误") + "\"}"); return; } string NoServiceDays = pick.NoServiceDays.TrimStart('0').Replace(".0", "."); string nowday = pickdate.ToString("M.d"); if (("," + NoServiceDays + ",").Contains("," + nowday + ",")) { Response.Write("{\"msg\":\"" + Tag("配送方式设置错误") + "\"}"); return; } } } //检查代金券 string pay312 = RequestTool.RequestSafeString("pay312"); if (pay312 != "") { List <Lebi_Card> cs = B_Lebi_Card.GetList("User_id=" + CurrentUser.id + " and id in (lbsql{" + pay312 + "})", "id asc"); int flag = cs.FirstOrDefault().IsCanOtherUse; if (flag == 0 && cs.Count > 1) { Response.Write("{\"msg\":\"" + Tag("代金券异常") + "\"}"); return; } foreach (Lebi_Card c in cs) { if (flag != c.IsCanOtherUse) { Response.Write("{\"msg\":\"" + Tag("代金券异常") + "\"}"); return; } if (!Basket.CheckCard(basket, c)) { Response.Write("{\"msg\":\"" + Tag("代金券异常") + "\"}"); return; } } } //检查代金券结束 //检查发票信息 int billtype_id = RequestTool.RequestInt("billtype_id", 0); Lebi_BillType billtype = B_Lebi_BillType.GetModel(billtype_id); if (ShopCache.GetBaseConfig().BillFlag == "1") { if (billtype == null) { Response.Write("{\"msg\":\"" + Tag("请设置发票内容") + "\"}"); return; } } CurrentUser.Pay_id = pay.id; CurrentUser.OnlinePay_id = onlinepay_id; Lebi_Order ordergroup; List <Lebi_Order> orders = Shop.Bussiness.Order.CreateOrder(CurrentUser, basket, shouhuo, billtype, CurrentCurrency, CurrentSite, CurrentLanguage, out ordergroup); CurrentUser.Count_Order = CurrentUser.Count_Order + orders.Count; B_Lebi_User.Update(CurrentUser); List <Lebi_Order> ordermodel = B_Lebi_Order.GetList("User_id=" + CurrentUser.id + "", "id desc"); ordergroup = ordermodel.FirstOrDefault(); if (OfflineMoney == 0) { OfflineMoney = ordergroup.Money_Order; } string remark = RequestTool.RequestSafeString("remark"); ordergroup.Remark_User = remark; bool needupdate = false; if (remark != "") { Lebi_Comment model = new Lebi_Comment(); model.Content = remark; model.Keyid = ordergroup.id; model.TableName = "Order"; model.User_id = CurrentUser.id; model.User_UserName = CurrentUser.UserName; B_Lebi_Comment.Add(model); needupdate = true; } if (pick != null) { ordergroup.PickUp_Date = pickdate; ordergroup.PickUp_id = pick.id; ordergroup.PickUp_Name = pick.Name; needupdate = true; } if (needupdate) { B_Lebi_Order.Update(ordergroup); } if (pay.Code != "OfflinePay" && pay.Code != "OnlinePay") { //订单如果选择了线下支付,并且非货到付款 //生成一笔充值单 //OfflineMoney Lebi_Currency DefaultCurrency = B_Lebi_Currency.GetModel("IsDefault=1"); if (DefaultCurrency == null) { DefaultCurrency = B_Lebi_Currency.GetList("", "Sort desc").FirstOrDefault(); } Lebi_Order order = new Lebi_Order(); order.Code = "M" + Shop.Bussiness.Order.CreateOrderCode(); order.Money_Order = OfflineMoney; order.Money_Pay = OfflineMoney; order.User_id = CurrentUser.id; order.User_UserName = CurrentUser.UserName; order.IsPaid = 0; order.Currency_Code = ordergroup.Currency_Code; order.Currency_ExchangeRate = ordergroup.Currency_ExchangeRate; order.Currency_id = ordergroup.Currency_id; order.Currency_Msige = ordergroup.Currency_Msige; order.Type_id_OrderType = 214; order.Pay_id = pay.id; order.Pay = pay.Name; order.Site_id = CurrentSite.id; order.Language_id = CurrentLanguage.id; order.Remark_Admin = ""; order.Order_id = ordergroup.id; B_Lebi_Order.Add(order); } //if (orders.Count == 1) // ordergroup = orders.FirstOrDefault(); //Shop.Bussiness.Order.SupplierOrder(order);//根据商品供应商分单 Response.Write("{\"msg\":\"OK\",\"id\":\"" + ordergroup.id + "\"}"); return; }
protected override void LoadPage(string themecode, int siteid, string languagecode, string pcode) { LoadTheme(themecode, siteid, languagecode, pcode); path = "<a href=\"" + URL("P_Index", "") + "\" class=\"home\" title=\"" + Tag("首页") + "\"><span>" + Tag("首页") + "</span></a><em class=\"home\">»</em><a href=\"" + URL("P_Pay", "") + "\"><span>" + Tag("在线付款") + "</span></a>"; order_id = Rint("order_id"); pagefrom = Rstring("pagefrom"); order = B_Lebi_Order.GetModel(order_id); if (order == null) { PageError(); } if (order.User_id != CurrentUser.id) { Response.Redirect(URL("P_Login", "" + HttpUtility.UrlEncode(RequestTool.GetRequestUrlNonDomain()) + "," + GetUrlToken(RequestTool.GetRequestUrlNonDomain()) + "")); } if (order.IsPaid == 1) { Response.Redirect(URL("P_UserOrderDetails", order.id)); } if (order.IsInvalid == 1) { PageError(); } else { if (order.Type_id_OrderType == 215) { List <Lebi_Order> ors = B_Lebi_Order.GetList("Order_id=" + order.id + "", ""); decimal moeny = 0; foreach (Lebi_Order or in ors) { moeny += or.Money_Pay; } order.Money_Pay = moeny; B_Lebi_Order.Update(order); } } //string onpaywhere = "IsUsed=1 and Supplier_id=" + order.Supplier_id + " and ','+Language_ids+',' like '%," + order.Language_id + ",%'"; string onpaywhere = "IsUsed=1 and parentid=0 and ','+Language_ids+',' like '%," + CurrentLanguage.id + ",%'"; //if (order.Supplier_id == 0) // onpaywhere += " and ','+Language_ids+',' like '%," + CurrentLanguage.id + ",%' and Supplier_id=0"; //if (order.Supplier_id > 0) //{ // if (EX_Supplier.GetUser(order.Supplier_id).IsCash == 1) // { // onpaywhere += " and Supplier_id=" + order.Supplier_id + ""; // } // else // { // onpaywhere += " and Supplier_id=0"; // } //} if (CurrentSite.IsMobile == 1) { onpaywhere += " and (showtype='' or showtype like '%wap%')"; } else { onpaywhere += " and (showtype='' or showtype like '%web%')"; } onlinepays = B_Lebi_OnlinePay.GetList(onpaywhere, "Sort desc"); order_products = B_Lebi_Order_Product.GetList("Order_id = " + order.id, "id desc"); string useragent = Request.UserAgent.ToString().ToLower(); if (useragent.Contains("micromessenger")) { Isweixin = true; } //<-{支付快捷跳转 by lebi.kingdge 2018-07-05 bool IsRedirect = false; Lebi_OnlinePay op = B_Lebi_OnlinePay.GetModel(order.OnlinePay_id); if (op == null) { op = new Lebi_OnlinePay(); } Lebi_OnlinePay_Log log = B_Lebi_OnlinePay_Log.GetModel("Order_id = " + order.id + " and OnlinePay_id = " + order.OnlinePay_id + ""); if (log == null) { IsRedirect = true; log = new Lebi_OnlinePay_Log(); log.Order_id = order.id; log.OnlinePay_id = order.OnlinePay_id; log.Time_add = DateTime.Now; B_Lebi_OnlinePay_Log.Add(log); } else { B_Lebi_OnlinePay_Log.Delete(log.id); } if (!Isweixin && op.Code == "weixinpay") { IsRedirect = false; } if (IsRedirect) { if (op.Url.IndexOf("?") > -1) { HttpContext.Current.Response.Redirect(WebPath.TrimEnd('/') + op.Url + "&order_id=" + order.id + "&opid=" + order.OnlinePay_id); } else { HttpContext.Current.Response.Redirect(WebPath.TrimEnd('/') + op.Url + "?order_id=" + order.id + "&opid=" + order.OnlinePay_id); } } //}-> }
protected void Page_Load(object sender, EventArgs e) { int order_id = RequestTool.RequestInt("order_id", 0); order = B_Lebi_Order.GetModel(order_id); if (order == null) { Response.Write("ERROR"); Response.End(); return; } Lebi_Language language = B_Lebi_Language.GetModel(order.Language_id); if (order.IsPaid == 1) { Response.Write(Language.Tag("已付款", language.Code)); Response.End(); return; } order.Site_id_pay = CurrentSite.id; order.Language_id = CurrentLanguage.id; Lebi_OnlinePay pay = B_Lebi_OnlinePay.GetModel("id = " + order.OnlinePay_id + ""); if (pay == null) { Log.Add("在线支付接口 weixinpay 配置错误"); return; } Lebi_Currency currendy = B_Lebi_Currency.GetModel(pay.Currency_id); if (pay.FeeRate > 0) { order.Money_OnlinepayFee = order.Money_Pay * pay.FeeRate / 100; } if (order.OnlinePay_id != pay.id) { order.OnlinePay_id = pay.id; order.OnlinePay_Code = pay.Code; order.OnlinePay = pay.Name; } B_Lebi_Order.Update(order); Lebi_User user = B_Lebi_User.GetModel(order.User_id); if (user == null) { Response.Write("订单错误"); Response.End(); return; } returnurl = URL("P_UserOrderDetails", order.id); TenpayUtil tu = new TenpayUtil(order); appId = tu.appid; timeStamp = TenpayUtil.getTimestamp(); nonceStr = TenpayUtil.getNoncestr(); string order_price = (order.Money_Pay * currendy.ExchangeRate * 100 * (1 + (pay.FeeRate / 100))).ToString("0"); string sp_billno = order.Code; shopname = Lang(CurrentSite.Name); string prepayId = order.weixin_prepay_id; if (prepayId == "" || prepayId == "INVALID_REQUEST") { //创建支付应答对象 RequestHandler packageReqHandler = new RequestHandler(Context); //初始化 packageReqHandler.init(); //设置package订单参数 packageReqHandler.setParameter("body", order.Code); //商品信息 127字符 packageReqHandler.setParameter("appid", tu.appid); packageReqHandler.setParameter("mch_id", tu.mch_id); packageReqHandler.setParameter("nonce_str", nonceStr); packageReqHandler.setParameter("openid", user.bind_weixin_id); packageReqHandler.setParameter("out_trade_no", sp_billno); //商家订单号 packageReqHandler.setParameter("spbill_create_ip", RequestTool.GetClientIP()); //Page.Request.UserHostAddress); //用户的公网ip,不是商户服务器IP packageReqHandler.setParameter("total_fee", order_price); //商品金额,以分为单位(money * 100).ToString() packageReqHandler.setParameter("trade_type", "MWEB"); //packageReqHandler.setParameter("notify_url", HttpUtility.UrlEncode(tu.tenpay_notify)); packageReqHandler.setParameter("notify_url", tu.tenpay_notify); //Response.Write("body:" + order.Code + ",appid:" + tu.appid + ",mch_id:" + tu.mch_id + ",nonce_str:" + nonceStr + ",notify_url:" + HttpUtility.UrlEncode(tu.tenpay_notify) + ",openid:" + user.bind_weixin_id + ",out_trade_no:" + sp_billno + ",spbill_create_ip:" + RequestTool.GetClientIP() + ",total_fee:" + order_price + ",key:" + tu.key + ""); string sign = packageReqHandler.createMd5Sign("key", tu.key); packageReqHandler.setParameter("sign", sign); string data = packageReqHandler.parseXML(); string prepayXml = HttpUtil.Send(data, "https://api.mch.weixin.qq.com/pay/unifiedorder"); SystemLog.Add(prepayXml); Response.Write(prepayXml); return; //获取预支付ID var xdoc = new XmlDocument(); xdoc.LoadXml(prepayXml); XmlNode xn = xdoc.SelectSingleNode("xml"); XmlNodeList xnl = xn.ChildNodes; //Response.Write("<br/>xml:" + xnl[0].InnerText + "|" + xnl[1].InnerText + "|" + xnl[2].InnerText + "|" + xnl[3].InnerText + "|" + xnl[4].InnerText + "|" + xnl[5].InnerText + "|" + xnl[6].InnerText + "|" + xnl[7].InnerText + "|" + xnl[8].InnerText + ""); if (xnl.Count > 7) { prepayId = xnl[7].InnerText; order.weixin_prepay_id = prepayId; B_Lebi_Order.Update(order); } } //Response.Write("prepayId:" + prepayId + ""); packageValue = string.Format("prepay_id={0}", prepayId); var paySignReqHandler = new RequestHandler(Context); paySignReqHandler.setParameter("appId", appId); paySignReqHandler.setParameter("timeStamp", timeStamp); paySignReqHandler.setParameter("nonceStr", nonceStr); paySignReqHandler.setParameter("package", packageValue); paySignReqHandler.setParameter("signType", "MD5"); paySign = paySignReqHandler.createMd5Sign("key", tu.key); //获取debug信息,建议把请求和debug信息写入日志,方便定位问题 //string pakcageDebuginfo = packageReqHandler.getDebugInfo(); //Response.Write("<br/>pakcageDebuginfo:" + pakcageDebuginfo + "<br/>"); //string paySignDebuginfo = paySignReqHandler.getDebugInfo(); //Response.Write("<br/>paySignDebuginfo:" + paySignDebuginfo + "<br/>"); }
protected void Page_Load(object sender, EventArgs e) { Lebi_OnlinePay pay = B_Lebi_OnlinePay.GetModel("Code='alipaybatch'"); if (pay == null) { Response.Write("参数错误"); Response.End(); return; } SortedDictionary <string, string> sPara = GetRequestPost(); if (sPara.Count > 0)//判断是否有带返回参数 { Notify aliNotify = new Notify(); bool verifyResult = aliNotify.Verify(sPara, Request.Form["notify_id"], Request.Form["sign"]); if (verifyResult)//验证成功 { ///////////////////////////////////////////////////////////////////////////////////////////////////////////// //请在这里加上商户的业务逻辑程序代码 string batch_no = RequestTool.RequestSafeString("batch_no"); Lebi_Cash_alipay cash = B_Lebi_Cash_alipay.GetModel("Code='" + batch_no + "'"); if (cash != null) { //——请根据您的业务逻辑来编写程序(以下代码仅作参考)—— //获取支付宝的通知返回参数,可参考技术文档中服务器异步通知参数列表 //批量付款数据中转账成功的详细信息 //格式为:流水号^收款方账号^收款 //账号姓名^付款金额^成功标识(S)^ //成功原因(null)^支付宝内部流水号 //^完成时间。 //每条记录以“ |”间隔 string success_details = RequestTool.RequestString("success_details"); //批量付款数据中转账失败的详细信息 string fail_details = RequestTool.RequestString("fail_details"); string[] arr = success_details.Split('|'); foreach (string temp in arr) { string[] item = temp.Split('^'); Lebi_Cash model = B_Lebi_Cash.GetModel("id=" + item[0] + ""); if (model != null) { model.Type_id_CashStatus = 402; B_Lebi_Cash.Update(model); } } cash.Time_Paid = System.DateTime.Now; cash.IsPaid = 1; cash.result_no = fail_details; cash.result_yes = success_details; B_Lebi_Cash_alipay.Update(cash); //判断是否在商户网站中已经做过了这次通知返回的处理 //如果没有做过处理,那么执行商户的业务程序 //如果有做过处理,那么不执行商户的业务程序 } Response.Write("success"); //请不要修改或删除 //——请根据您的业务逻辑来编写程序(以上代码仅作参考)—— ///////////////////////////////////////////////////////////////////////////////////////////////////////////// } else//验证失败 { Response.Write("fail"); } } else { Response.Write("无通知参数"); } }
protected void Page_Load(object sender, EventArgs e) { int id = RequestTool.RequestInt("id", 0); if (id == 0) { if (!EX_Admin.Power("onlinepay_add", "添加在线支付")) { WindowNoPower(); } } else { if (!EX_Admin.Power("onlinepay_edit", "编辑在线支付")) { WindowNoPower(); } } model = B_Lebi_OnlinePay.GetModel(id); if (model == null) { model = new Lebi_OnlinePay(); } string where = "parentid=0"; models = B_Lebi_OnlinePay.GetList(where, "IsUsed desc,Sort desc", PageSize, page); switch (model.Code) { case "molpay": username = "******"; key = "Verify Key"; email = Tag("邮箱"); break; case "wangyinzaixian": username = "******"; key = "MD5密钥"; email = Tag("邮箱"); break; case "alipayJSDZ": username = "******"; key = "安全校验码(Key)"; email = "支付宝账号"; break; case "alipayDBJY": username = "******"; key = "安全校验码(Key)"; email = "支付宝账号"; break; case "alipaySJK": username = "******"; key = "安全校验码(Key)"; email = "支付宝账号"; break; case "alipayWAP": username = "******"; key = "安全校验码(Key)"; email = "支付宝账号"; break; case "alipaybatch": username = "******"; key = "安全校验码(Key)"; email = "支付宝账号"; break; case "chinapnr": username = "******"; key = "公钥相对路径"; email = "私钥相对路径"; break; default: username = Tag("帐号"); key = Tag("KEY"); email = Tag("邮箱"); break; } }
/// <summary> /// 生成充值订单 /// </summary> public void CreateMoneyOrder() { decimal money = RequestTool.RequestDecimal("RMoney", 0); if (money == 0) { Response.Write("{\"msg\":\"" + Tag("充值金额必须大于0") + "\"}"); return; } Lebi_Currency DefaultCurrency = B_Lebi_Currency.GetModel("IsDefault=1"); if (DefaultCurrency == null) { DefaultCurrency = B_Lebi_Currency.GetList("", "Sort desc").FirstOrDefault(); } int onlinepay_id = RequestTool.RequestInt("onlinepay_id"); int pay_id = RequestTool.RequestInt("Pay_id"); int paytype = RequestTool.RequestInt("paytype"); //Lebi_MoneyOrder order = new Lebi_MoneyOrder(); //order.Code = "M" + Shop.Bussiness.Order.CreateOrderCode(); //order.Money = money; //order.User_id = CurrentUser.id; //order.User_UserName = CurrentUser.UserName; //order.IsPaid = 0; //order.Currency_Code = DefaultCurrency.Code; //order.Currency_ExchangeRate = DefaultCurrency.ExchangeRate; //order.Currency_id = DefaultCurrency.id; //order.Currency_Msige = DefaultCurrency.Msige; //B_Lebi_MoneyOrder.Add(order); Lebi_Order order = new Lebi_Order(); order.Code = "M" + Shop.Bussiness.Order.CreateOrderCode(); order.Money_Order = money; order.Money_Pay = money; order.User_id = CurrentUser.id; order.User_UserName = CurrentUser.UserName; order.IsPaid = 0; order.Currency_Code = DefaultCurrency.Code; order.Currency_ExchangeRate = DefaultCurrency.ExchangeRate; order.Currency_id = DefaultCurrency.id; order.Currency_Msige = DefaultCurrency.Msige; order.Type_id_OrderType = 214; Lebi_Pay pay = B_Lebi_Pay.GetModel(pay_id); if (paytype == 0) { Lebi_OnlinePay onlinepay = B_Lebi_OnlinePay.GetModel(onlinepay_id); if (onlinepay == null) { onlinepay = new Lebi_OnlinePay(); } order.OnlinePay_id = onlinepay.id; order.OnlinePay = onlinepay.Name; pay = B_Lebi_Pay.GetModel("Code='OnlinePay'"); } if (pay == null) { pay = new Lebi_Pay(); } order.Pay_id = pay.id; order.Pay = pay.Name; order.Site_id = CurrentSite.id; order.Language_id = CurrentLanguage.id; B_Lebi_Order.Add(order); order.id = B_Lebi_Order.GetMaxId(); Response.Write("{\"msg\":\"OK\",\"id\":\"" + order.id + "\",\"code\":\"" + order.Code + "\",\"url\":\"" + URL("P_Pay", order.id + "," + order.Code) + "\"}"); }
protected void Page_Load(object sender, EventArgs e) { Lebi_OnlinePay pay = B_Lebi_OnlinePay.GetModel("Code='alipaybatch'"); if (pay == null) { Response.Write("参数错误"); Response.End(); return; } Shop.Bussiness.Site site = new Shop.Bussiness.Site(); string ids = RequestTool.RequestString("ids"); if (ids == "") { Response.Write("参数错误"); Response.End(); return; } List <Lebi_Cash> models = B_Lebi_Cash.GetList("id in (" + ids + ")", ""); decimal money = 0; string con = ""; foreach (Lebi_Cash model in models) { money = money + model.Money - model.Fee; //string t = "" + model.id + "^" + model.AccountCode + "^" + model.AccountName + "^" + (model.Money - model.Fee) + "^" + model.Remark + ""; string t = "" + model.id + "^" + model.AccountCode + "^" + model.AccountName + "^" + (model.Money - model.Fee) + "^提现申请"; con += t + "|"; } con = con.TrimEnd('|'); Lebi_Cash_alipay cash = new Lebi_Cash_alipay(); cash.alipay_user = pay.Email; cash.alipay_username = ""; cash.Cash_ids = ids; cash.Code = Shop.Bussiness.Order.CreateOrderCode(); cash.Content = con; cash.count = models.Count; cash.Money = money; B_Lebi_Cash_alipay.Add(cash); //服务器异步通知页面路径 string notify_url = "http://" + RequestTool.GetRequestDomain() + site.WebPath + "/onlinepay/alipaybatch/notify_url.aspx"; //需http://格式的完整路径,不能加?id=123这类自定义参数 //页面跳转同步通知页面路径 string return_url = "http://" + RequestTool.GetRequestDomain() + site.WebPath + "/onlinepay/alipaybatch/return_url.aspx"; //需http://格式的完整路径,不能加?id=123这类自定义参数,不能写成http://localhost/ //需http://格式的完整路径,不允许加?id=123这类自定义参数 //付款账号 string email = pay.Email; //必填 //付款账户名 string account_name = pay.UserRealName; //必填,个人支付宝账号是真实姓名公司支付宝账号是公司名称 //付款当天日期 string pay_date = System.DateTime.Now.ToString("yyyyMMdd"); //必填,格式:年[4位]月[2位]日[2位],如:20100801 //批次号 string batch_no = cash.Code; //必填,格式:当天日期[8位]+序列号[3至16位],如:201008010000001 //付款总金额 string batch_fee = money.ToString(); //必填,即参数detail_data的值中所有金额的总和 //付款笔数 string batch_num = models.Count.ToString(); //必填,即参数detail_data的值中,“|”字符出现的数量加1,最大支持1000笔(即“|”字符出现的数量999个) //付款详细数据 string detail_data = con; //必填,格式:流水号1^收款方帐号1^真实姓名^付款金额1^备注说明1|流水号2^收款方帐号2^真实姓名^付款金额2^备注说明2.... //////////////////////////////////////////////////////////////////////////////////////////////// //把请求参数打包成数组 SortedDictionary <string, string> sParaTemp = new SortedDictionary <string, string>(); sParaTemp.Add("partner", Config.Partner); sParaTemp.Add("_input_charset", Config.Input_charset.ToLower()); sParaTemp.Add("service", "batch_trans_notify"); sParaTemp.Add("notify_url", notify_url); sParaTemp.Add("email", email); sParaTemp.Add("account_name", account_name); sParaTemp.Add("pay_date", pay_date); sParaTemp.Add("batch_no", batch_no); sParaTemp.Add("batch_fee", batch_fee); sParaTemp.Add("batch_num", batch_num); sParaTemp.Add("detail_data", detail_data); //建立请求 string sHtmlText = Submit.BuildRequest(sParaTemp, "get", "确认"); Response.Write(sHtmlText); }