- 微信合单支付能将订单金额全部支付给商户平台并完成分账吗?
微信合单支付可以将订单金额全部支付给平台,这个我是测试过的。但是分账那里却走不通?请问一下微信合单支付能将订单金额全部支付给商户平台并完成分账吗?
2020-11-30 - 二级商户进件申请返回401未授权,官方大佬能帮我解答吗?
签名串: POST /v3/ecommerce/applyments 1605145064 5996ab2bd6be421986a44dbc735387f1 {"out_request_no":"APPLYMENT_20201112093741281661","organization_type":"2","business_license_info":{"business_license_copy":"h7lncwZ2vOC45E7Vfm0oRDW5MCkP9OVtmTApEvPXXBkYjXbRfuH37eMQdO4EzwcWoYXBgtF9jSTAUbfASBTaztZ4PAGZK2-y9gK2s2C4mOg","business_license_number":"91210000MA0QDFAL8D","merchant_name":"1111","legal_person":"111"},"id_card_info":{"id_card_copy":"h7lncwZ2vOC45E7Vfm0oRIoaJTU-DKp2eiwlektu-yAn4NZIl4u_2Yx7HvRNT3KOjXTC-3ojC4ZTtzeol3BftF_qm_PDffaFL_8PzLMHv_4","id_card_national":"h7lncwZ2vOC45E7Vfm0oRIRC2nJuCU9ipS-VqOsONQc_VqMs0I-cS5kl0dc2quY_xit6n3zqUVwbi_SdvlUbqik_IoC4hyqXFGNXjvGuM3I","id_card_name":"","id_card_number":"HEtVxNcKlf0nZ/R8wcngqXO2dRyb0zXZxLTqjJblfNcoGrXjTyoA+FHW26JeGCLULIk2GUFV4owEJfJxgpcCNdh05dELmFzYPNzr7Fv9K48i5/sAmVTSF3nVPuD/SkDI2vcjlfK8QEnG3ZC7NkRLvNJhpB+XrDu7cF2DSYODLih4rvAYMoiDrQ5xsSf+jEVzsMupD7h9QIknPfu/dUolzK8pCwP69VxtS6UB5+jk4w2taRs55bhOTWuN3xdkDu7Geo9lIPkn47E6+dRzrxyUKvlHoES1DwGLnz/0N0ecnmEDbAw3vAbEhcgGm1rkWCzAq2mg+2V+fUn505byHw3Plw==","id_card_valid_time":"111"},"need_account_info":true,"account_info":{"bank_account_type":"74","account_bank":"111","account_name":"SAoe/w3J6nVhk1UT84nnkQDKExQ1dgyUyC8DQx3qCBWTxLsmsCg5CZ9JcOp6K+xTK7VXkA4Wz9jYNNfQGv2sHODIEik/u8KotqEY6vsjJzl/BwSM6esD6zjucJASIacQDzUxUvXJCbobfka+si3KM9bXHeQT/0TmbU/vtvpTNe1YlbJmmpqUpEnRVsc0V8vDyieIINTHyFHfwiyHQebCnHmtAbFRZMA4444QipjGlsmPhJw1VJYSZlfC0FEYnaZJHslTFYT7v1RBiv2ScNPllVy8LdbbUyZ1YLXyxlsrk3MwubjvyF4ODovIG0evlJoNWHgOY/qrkBL9wte44ITNRw==","bank_address_code":"111","bank_name":"11","account_number":"Z264PSiufQtPPyTNgv1XnklpZsGmHtO71aqXyILkb4a5K6Ux23wTKhxdwnS0037KvyF9oqIJNLkP7I3XlY5r0xPeR9y1tqL97sTKFjiFeu47yQrzKRYLj6pIWb4BRd8b4wIMZaUByXr0iUS/YGNn5uGZWfSU6uGNZ9nfXyMGKIpaCBJKsUUQrHZAAW8F2tL4NhDpe37zNnlULXbBMAEsgFF2MacNNpL7dh1IyNqB3RMD+z0v34xYMqOaKWf/sllOiCmd8uAK7amMnqELuOSRutnPh3nYQ9VZl4r3c6FI5Jv6Fc2/t2Uf8zracOhBK0FJj/0WNw6crh0ykqoAk0jHDg=="},"contact_info":{"contact_type":"65","contact_name":"oT4OL9caP3e+xG9IwdzEjrIjfgvTSQJM/eUTIvtA1now/ItLRqhWUAvVd7es5eEprgPR7f9xtb+8u0bg3bOfGYpvfj0M0e89DqQTWQE6h8mBhgT2AZfOa7HuJ1T/Zey3sLDxzwf82n9FT1OtSBiCFENby4bWuVzZQ8fENbYl/JdI02WtmVS9oLTsGbIbrC3ptB/wk6blRhmaWr5pLrM6jDDE4ktSxhC+OUH7hX/97EH2pf4ziZDSGk65Tp0xPHPiSI3CiVkzhCaVHgw4RbMLC+SjB/raZYDs6EUyDRRQd2+CNtW0p1wY5p4l7hTnZuZ3cwlcqFlMa8ds/AYvNu2Vlg==","contact_id_card_number":"bjko1gK86qdQGtzZnaqZynqzBB3hwLufJ1zx+S/PPksZcJURqBEe6vGHM3AQt7K7uCVDSLo6p1pIkGEzvph4r+kDT8Q8mrGDWgYljHzT7yoZKP5NQcrWD5rFDg+rEQ0PWBWcGbteOB9i3QQkwAo/+w2tPwsc3LpmoL7AzTZ39tgo32gdNa6uEot9GIMR+ev2rdxYTwqT34lLjQBZP3NwIGDPimqneDv14brneFAdGa0QNkSRzfpVTNNGSGjOIf/nFWj00cYi6uiOHFxkVUr33QoGi0szqF+xgLwz/9Ce3t2mrzTDLiEy9HLh3mqDuLnFXeqjsvBmuzvgtYM5mXYguQ==","mobile_phone":"br6t6Kl/ZxXkbVMIV3oVUeUIGRgPSj/RFZieVporENfGCMHyqd96O0AIVInvcuxq3hUZrDRzEJhPEf4oZpQSncgh/K64FyD8/ZVwLXaSwDbsCr8pP35epYhmqDI55OdNzduvEiwpbhARsSxzRfMZGroOWRma8V1qiejmbtrK6VDYlMU3PcQc0KRojwf2y7MwsiEDPvxL4+abvVbZMqkhMWu2QXrwV3BIQpqZSxyPLsImfg1v0ODqeoBOQuhy55bAlMX/uzNR7ji4yH8WCFqw785hDwT4z54Lni9tJ1voIxfpjG7eOtYTfovF1xB8p0BOGo6dAQse1Pxti4evbBpIfg==","contact_email":"b6J0iKqKG0Zr/2YuTAFFT5zlLL63GZk2dPazU2eUCOlJE0tlu3iwTCLN1zK4cDWeehLHUjP8fHamu/wlVKXdbzcZGYmp+zBgmMqO3GRAOSH3Pz2IRDEKKfnZYCaDV0MfaaeBdIRSAnkrkyYSm1I/LHi0e4pgBORPi3iM+g7OGA3BtVEI/251PLO/mJyzRAAbVgNLThbic2XOZNHPWI0D/akpEw9byyrlEIZluj2dtt/ifGWT+0ejtSh3c05g+XDP8DajBEOLh4ZgFXEocBD7M80w2oIvskIu+qCW0WJ+eRYv7HksH767bL6vJhHU8wdzRZPNEclofvkUSTTbUhYCOg=="},"sales_scene_info":{"store_name":"11","store_url":"11"},"merchant_shortname":"111"} 代码截图 [图片]
2020-11-12 - 微信支付V3图片上传,返回 400 远程服务器错误,能不能帮我解答啊?
string filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory + "/temp/", filename); var sha256 = Applyments.SHA256File(filePath); meta meta = new meta() { sha256 = sha256, filename = System.IO.Path.GetFileName(filePath) }; var json = JsonConvert.SerializeObject(meta); string mchid = site.WechatMchid; string serialNo = site.WechatSerialNo; var timestamp = DateTimeOffset.Now.ToUnixTimeSeconds(); string nonce = Guid.NewGuid().ToString("n"); string method = "POST"; string uri = "/v3/merchant/media/upload"; string body = json; string message = $"{method}\n{uri}\n{timestamp}\n{nonce}\n{body}\n"; string signature = Applyments.Sign(message, mchid); string auth = $"mchid=\"{mchid}\",nonce_str=\"{nonce}\",timestamp=\"{timestamp}\",serial_no=\"{serialNo}\",signature=\"{signature}\""; string value = $"WECHATPAY2-SHA256-RSA2048 {auth}"; // 定义数据分隔线 string boundary = string.Format("{0}", DateTime.Now.Ticks.ToString("x")); string Url = "https://api.mch.weixin.qq.com/v3/merchant/media/upload"; HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Url); request.Method = "POST"; request.Headers.Add(HttpRequestHeader.Authorization, value); //request.Accept = "application/json"; request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.183 Safari/537.36"; request.ContentType = "multipart/form-data;boundary=" + boundary; // 换行符 string LINE_END = "\r\n"; string PREFIX = "--"; //拼装请求内容第一部分 StringBuilder strSb = new StringBuilder(); StringBuilder strSb1 = new StringBuilder(); strSb1.Append(PREFIX).Append(boundary); strSb.Append(PREFIX).Append(boundary).Append(LINE_END) .Append("Content-Disposition: form-data; name=\"meta\";" + LINE_END) .Append("Content-Type: application/json; " + LINE_END) .Append(LINE_END)// 空行 .Append("{\"filename\":\"" + meta.filename + "\",\"sha256\":\"" + meta.sha256 + "\"}") .Append(LINE_END); //拼装请求内容第二部分 strSb.Append(PREFIX).Append(boundary).Append(LINE_END) .Append("Content-Disposition: form-data; name=\"file\"; filename=\"" + filename + "\";" + LINE_END) .Append("Content-Type: image/jpeg" + LINE_END) .Append(LINE_END);// 空行 //拼接图片文件流 FileStream fs = new FileStream(filePath, FileMode.Open);//可以是其他重载方法 byte[] byData = new byte[fs.Length]; fs.Read(byData, 0, byData.Length); fs.Close(); string stringFiles = Convert.ToBase64String(byData); strSb.Append(stringFiles).Append(LINE_END); //结尾 strSb.Append(PREFIX).Append(boundary).Append(PREFIX) .Append(LINE_END); byte[] data = Encoding.UTF8.GetBytes(strSb.ToString()); MemoryStream memoryStream = new MemoryStream(); memoryStream.Write(data, 0, data.Length); // 获取二进制数据 byte[] postBytes = memoryStream.ToArray(); request.ContentLength = postBytes.Length; using(Stream reqStream = request.GetRequestStream()) { reqStream.Write(postBytes, 0, postBytes.Length); reqStream.Close(); } HttpWebResponse resp = (HttpWebResponse)request.GetResponse(); //获取响应内容 StreamReader reader = new StreamReader(resp.GetResponseStream(), Encoding.UTF8); string content = reader.ReadToEnd(); reader.Close();
2020-11-11 - 微信支付v3图片上传,根据私钥签名的时候直接过了,也没有错误信息,求解?
[图片]
2020-11-10 - 微信支付V3图片上传问题,接口都没返回,调试走不下去啊,求求大佬啊?
[图片] string private_key = site.WechatPrivateKey; string mchid = site.WechatMchid; string serialNo = site.WechatSerialNo; string filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory + "/temp/", filename); try { string boundary = string.Format("--{0}", DateTime.Now.Ticks.ToString("x")); var sha256 = Applyments.SHA256File(filePath); meta meta = new meta() { sha256 = sha256, filename = System.IO.Path.GetFileName(filePath) }; var json = JsonConvert.SerializeObject(meta); var httpHandler = new HttpHandler(mchid, serialNo, private_key, json); System.Net.Http.HttpClient client = new System.Net.Http.HttpClient(httpHandler); using(var requestContent = new MultipartFormDataContent(boundary)) { requestContent.Headers.ContentType = MediaTypeHeaderValue.Parse("multipart/form-data"); //这里必须添加 requestContent.Add(new StringContent(json, Encoding.UTF8, "application/json"), "\"meta\""); //这里主要必须要双引号 var fileInfo = new FileInfo(filePath); using(var fileStream = fileInfo.OpenRead()) { var content = new byte[fileStream.Length]; fileStream.Read(content, 0, content.Length); var byteArrayContent = new ByteArrayContent(content); byteArrayContent.Headers.ContentType = new MediaTypeHeaderValue("image/jpg"); requestContent.Add(byteArrayContent, "\"file\"", "\"" + meta.filename + "\""); //这里主要必须要双引号 using(var response = client.PostAsync("https://api.mch.weixin.qq.com/v3/merchant/media/upload", requestContent)) //上传 using(var responseContent = response.Result.Content) { string responseBody = responseContent.ReadAsStringAsync().ToString(); //这里就可以拿到图片id了 PicUploadResponse picUploadResponse = JsonConvert.DeserializeObject<PicUploadResponse>(responseBody); return new { success = true, PicPath = ioname, MediaId = picUploadResponse.media_id }; } } } } catch(Exception ex) { return new { success = false, msg = ex.Message }; } } using System; using System.IO; using System.Net.Http; using System.Net.Http.Headers; using System.Security.Authentication; using System.Security.Cryptography; using System.Security.Cryptography.X509Certificates; using System.Text; using System.Threading; using System.Threading.Tasks; namespace Himall.AdminAppApi { /// <summary> /// 头文件 /// </summary> public class HttpHandler : DelegatingHandler { private readonly string merchantId; private readonly string serialNo; private readonly string privateKey; private readonly string json; /// <summary> /// 构造方法 /// </summary> /// <param name="merchantId">商户号</param> /// <param name="merchantSerialNo">证书序列号</param> /// <param name="privateKey"> 私钥不包括私钥文件起始的-----BEGIN PRIVATE KEY----- 亦不包括结尾的-----END PRIVATE KEY-----</param> /// <param name="json">签名json数据,默认不需要传入,获取body内容,如传入签名传入参数上传图片时需传入</param> public HttpHandler(string merchantId, string merchantSerialNo, string privateKey, string json = "") { HttpClientHandler handler = new HttpClientHandler(); //handler.ClientCertificateOptions = ClientCertificateOption.Manual; //handler.SslProtocols = SslProtocols.Tls12; //try //{ // string certPath = System.IO.Path.Combine(Environment.CurrentDirectory, @"Cert\apiclient_cert.p12"); // handler.ClientCertificates.Add(new X509Certificate2(certPath, "1487076932", // X509KeyStorageFlags.PersistKeySet | X509KeyStorageFlags.MachineKeySet)); //} //catch(Exception e) //{ // throw new Exception("ca err(证书错误)"); //} //handler.SslProtocols = SslProtocols.Tls12 | SslProtocols.Tls11 | SslProtocols.Tls; //handler.ServerCertificateCustomValidationCallback = (message, cert, chain, errors) => true; InnerHandler = handler; this.merchantId = merchantId; this.serialNo = merchantSerialNo; this.privateKey = privateKey; this.json = json; } protected async override Task<HttpResponseMessage> SendAsync( HttpRequestMessage request, CancellationToken cancellationToken) { var auth = await BuildAuthAsync(request); string value = $"WECHATPAY2-SHA256-RSA2048 {auth}"; request.Headers.Add("Authorization", value); request.Headers.Add("user-agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.143 Safari/537.36"); MediaTypeWithQualityHeaderValue mediaTypeWithQualityHeader = new MediaTypeWithQualityHeaderValue("application/json"); request.Headers.Accept.Add(mediaTypeWithQualityHeader); request.Headers.AcceptCharset.Add(new StringWithQualityHeaderValue("utf-8")); return await base.SendAsync(request, cancellationToken); } protected async Task<string> BuildAuthAsync(HttpRequestMessage request) { string method = request.Method.ToString(); string body = ""; if(method == "POST" || method == "PUT" || method == "PATCH") { if(!string.IsNullOrEmpty(json)) body = json; else { var content = request.Content; body = await content.ReadAsStringAsync(); } } string uri = request.RequestUri.PathAndQuery; var timestamp = DateTimeOffset.Now.ToUnixTimeSeconds(); string nonce = Guid.NewGuid().ToString("n"); string message = $"{method}\n{uri}\n{timestamp}\n{nonce}\n{body}\n"; string signature = Sign(message); return $"mchid=\"{merchantId}\",nonce_str=\"{nonce}\",timestamp=\"{timestamp}\",serial_no=\"{serialNo}\",signature=\"{signature}\""; } protected string Sign(string message) { byte[] keyData = Convert.FromBase64String(privateKey); using(CngKey cngKey = CngKey.Import(keyData, CngKeyBlobFormat.Pkcs8PrivateBlob)) using(RSACng rsa = new RSACng(cngKey)) { byte[] data = System.Text.Encoding.UTF8.GetBytes(message); return Convert.ToBase64String(rsa.SignData(data, HashAlgorithmName.SHA256, RSASignaturePadding.Pkcs1)); } } } }
2020-11-10 - 查询电商平台账户实时余额,只需要传用户类型?怎么知道是哪个电商平台账户?
[图片]
2020-10-29 - 合单支付后,分账只能子订单一个个的进行分账吗?接口里面需要 【微信支付订单号】
[图片][图片][图片]
2020-10-26 - 请求分账接口里面的 微信订单号 怎么填写?合单下单会生成多个子订单号,填写哪个?
[图片]
2020-10-26 - 微信合单支付退款的二级商户号怎么传?比如有3个子订单【不同的供应】的合单支付,就会对应3个二级商户号
[图片]
2020-10-23