public string GetRequestUrl(string returnUrl, string notifyUrl, string orderId, decimal totalFee, string productInfo, string openId = null) { Config config = Utility <Config> .GetConfig(base.WorkDirectory); string str = "1"; notifyUrl = string.Format(notifyUrl, new object[0]); returnUrl = string.Format(returnUrl, new object[0]); string alipayAccount = config.AlipayAccount; string partner = config.Partner; string key = config.Key; string str1 = orderId.ToString(); string str2 = productInfo; string str3 = ""; string str4 = ""; string str5 = ""; SortedDictionary <string, string> strs = new SortedDictionary <string, string>() { { "partner", partner }, { "return_url", returnUrl }, { "seller_email", alipayAccount }, { "out_trade_no", str1 }, { "_input_charset", config.Input_charset }, { "service", "create_direct_pay_by_user" }, { "payment_type", str }, { "notify_url", notifyUrl }, { "subject", str2 }, { "total_fee", totalFee.ToString("F2") }, { "body", str3 }, { "anti_phishing_key", str4 }, { "exter_invoke_ip", str5 } }; return(Submit.BuildRequestUrl(strs, base.WorkDirectory, config)); }
public string GetRequestUrl(string returnUrl, string notifyUrl, string orderId, decimal totalFee, string productInfo, string openId = null) { Config config = _Config; //支付类型,必填,不能修改 string paymentType = "1"; //服务器异步通知页面路径 notifyUrl = string.Format(notifyUrl); //页面跳转同步通知页面路径 returnUrl = string.Format(returnUrl); //收款支付宝帐户 string sellerEmail = config.AlipayAccount; //合作者身份ID string partner = config.Partner; //交易安全检验码 string key = config.Key; //商户订单号 string outTradeNo = orderId.ToString(); //订单名称 string subject = productInfo; //订单描述 string body = ""; //防钓鱼时间戳 string anti_phishing_key = ""; //客户端的IP地址,非局域网的外网IP地址 string exter_invoke_ip = ""; //把请求参数打包成数组 Dictionary <string, string> parameters = new Dictionary <string, string>(); parameters.Add("partner", partner); parameters.Add("return_url", returnUrl); parameters.Add("seller_email", sellerEmail); parameters.Add("out_trade_no", outTradeNo); parameters.Add("_input_charset", config.Input_charset); parameters.Add("service", "create_direct_pay_by_user"); // parameters.Add("service", "trade_create_by_buyer"); parameters.Add("payment_type", paymentType); parameters.Add("notify_url", notifyUrl); parameters.Add("subject", subject); parameters.Add("total_fee", totalFee.ToString("F2")); parameters.Add("body", body); parameters.Add("anti_phishing_key", anti_phishing_key); parameters.Add("exter_invoke_ip", exter_invoke_ip); parameters.Add("it_b_pay", "30m"); return(Submit.BuildRequestUrl(parameters, config)); }