KevinWG / OSS.Clients.Pay

开源支付SDK(标准库),主要打造微信支付,支付宝支付,标准库项目,同时支持.net framework和.net core
http://www.osscore.com
Apache License 2.0
331 stars 122 forks source link

微信支付退款ret:-1 #24

Open LGinC opened 5 years ago

LGinC commented 5 years ago

image msg:当前请求出错,错误码: ZADYYQW ZADYYQW是随机的,下次请求会变

LGinC commented 5 years ago

预支付调用成功。 证书密码和证书路径已配,out_trade_no 传入正确

KevinWG commented 5 years ago

这个错误码是内部的,看下项目目录下有个log文件夹,里面有具体错误

LGinC commented 5 years ago

2018-11-22 21:22:03 Code:GAEVYQW Key:RestCommon Detail:基类请求出错,错误信息:系统找不到指定的文件。

2018-11-22 21:23:40 Code:ZADYYQW Key:RestCommon Detail:基类请求出错,错误信息:系统找不到指定的文件。

所以是找不到哪个文件啊.........

KevinWG commented 5 years ago

用到的文件只有证书文件,如果是windows服务器,请检查证书是否已经在系统注册,然后在检查证书路径是否正确

KevinWG commented 5 years ago

退款时需要双向证书支持,windows的证书要安装一下的

LGinC commented 5 years ago

@KevinWG 证书路径是填证书文件所在的绝对路径还是直接填写证书名,如"SN=xxx,CN=xxx,OU=MMPay,O=Tencent,L=Shenzhen,S=Guangdong,C=CN" 这种

KevinWG commented 5 years ago
    /// <summary>
    /// 证书路径,  请填写绝对路径,为了安全,请不要将证书放在网站目录下
    /// </summary>
    public string CertPath { get; set; }

物理地址路径(D:\xx\xx.cert 这种),不是这个

LGinC commented 5 years ago

winserver, 路径填的E:\xx\xx.p12 改为E:/xx/xx.p12 和E:/xx/xx.pem都不行 改为xx.pem 后报错信息变为 2018-12-04 17:24:30 Code:NQ22GPX Key:RestCommon Detail:基类请求出错,错误信息:An error occurred while sending the request.

KevinWG commented 5 years ago

这个你需要注意证书密码是否正确,.net 使用的应该是 .p12 的 如果还是不行,你可以在系统启动的时候直接注册底层的方法: WxPayConfigProvider.HttpClientProvider=(config,isneedCert)=>{
处理HttpClient; 返回HttpClient; }

LGinC commented 5 years ago

证书密码默认就是商户号Id,没改的 在startup里配置了HttpClient后还需要在config里添加证书路径吗? 现在添加HttpClient配置后预支付请求失败 日志: 2018-12-05 11:40:06 Code:G17RERX Key:RestCommon Detail:基类请求出错,错误信息:Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index

对了,环境是.net core 2.1