kevinwg / oss.clients.pay Goto Github PK
View Code? Open in Web Editor NEW开源支付SDK(标准库),主要打造微信支付,支付宝支付,标准库项目,同时支持.net framework和.net core
Home Page: http://www.osscore.com
License: Apache License 2.0
开源支付SDK(标准库),主要打造微信支付,支付宝支付,标准库项目,同时支持.net framework和.net core
Home Page: http://www.osscore.com
License: Apache License 2.0
下单,支付都正常,用的jsapi。我是回调里是这样写的,下单,支付都正常。
### var notify = await new WechatNotifyReceiver(dic, body).DecrytToPayResult(WechatPayHelper.pay_config.api_v3_key);
然后dic 内容是这样的
{"Wechatpay-Signature":"hZ0Xsm9oYYzPubnydy/zv8fgtMyFcr2JZN0m8PcOAxH8SMlq096jv1aGcmTpgU13o0RdMQeqfrCS9P+Rq6MEIExSCwGjGG1A20OuUpgjLTi1c1fcv3alAf2Pu/qdoFHXfipUcYq9mWcZNTXVHiJxnnT+edhq9KhTjNThxY7NhukOxR3scVS1qJQ+JFkKEstsxDfYlP18OPwEmZqTDZpueAqRAIZoeUBYGhgpu9YKaAsEKVF0IDPkT84cV0De0FhgiOoELDU22eskk8MQAsFYML/ppjtlLgVFO0oYfGjzFuCq7G0ph+T8PYSaZoy6kK8fOzZR/XHY59zJS0uHTlErHw==","Wechatpay-Nonce":"t7W6sPtmW4UeMr2VbTJEG0nctOgmmMJr","Wechatpay-Timestamp":"1685089339","Wechatpay-Serial":"6C16391AD9023D772D36540320A4794B8697FA87"}
body内容是这样
{"id":"f5702c76-11c7-5227-881a-dddddedba03a","create_time":"2023-05-26T16:22:19+08:00","event_type":"TRANSACTION.SUCCESS","resource_type":"encrypt-resource","resource":{"algorithm":"AEAD_AES_256_GCM","ciphertext":"P3o6+nvOhrAO+t2acO5GrHTfwaOQKbBywTO+JRMfd3JoJ4bB67g2k1FpFyBcgTlH+3LALmx0uLEG3LVPKQAy4QkXxnlz/288yVkD0lCBuhnOqskOVCt1nNqdn6XHL6jM6PoKCS38ASRrOKayZ0sc3rox7wa0rthxbfoTsKYlZ9U59R4gA/lTSl1CGRrUEcrv0N4V88YEAQ/ZqJWvwa7DOz+ErSyNIhWqjAiLbYo5KQV/Z1Hxk2/i3MpegcxeXwI/uWz0xX4CfSXZ6MknMEPR1VvqYfWEAhR+4nsL9h/i/5tK9m/woTbR3oa5IcRU5KBn450O3RW3aNNlGE4x1XHmNCyqLjo8MRsHuT4bBluNYhjGEnu9F+Rl1/iUSwZqW57e341g8SItQzbFWpXZ/0E1FMHlz4rdBMuTWN69YiM2w6UciqClv0KHPdV4JU6+f8UVyBFhxL/9Zl0GbdhjM47N6dEBv53KdlzIJiodYYHBe4LRq46xbVO7OiU7vSp+HzG3FqstVs6kFUVMrwSHjhhfijfp7JfgLYRB4JAY793L6LXjoL1tEn7+0ktZL2RvBA2VOwOVGjumuF8=","associated_data":"transaction","original_type":"transaction","nonce":"vfsJl0dDHWuz","summary":null},"summary":"支付成功","code":0,"sys_code":0,"msg":null}
但是一直验证失败是什么原因呢
{"prepay_id":"","code_url":"","mweb_url":"","device_info":null,"trade_type":null,"appid":"","mch_id":"","sub_appid":"","sub_mch_id":"","nonce_str":"","sign":"","return_code":"FAIL","return_msg":"签名错误","result_code":"","err_code":"","err_code_des":"","ret":1420,"sys_ret":0,"msg":"签名错误"}
ZFB建议更改成Alipay WX建议改成WeChatPay
你好,请问vs2013 nuget安装失败,该如何操作?
失败信息:
正在安装“OSS.PaySdk.Wx 1.0.2.5”。已成功安装“OSS.PaySdk.Wx 1.0.2.5”。正在将“OSS.PaySdk.Wx 1.0.2.5”添加到 WebApplication1。正在卸载“OSS.PaySdk.Wx 1.0.2.5”。已成功卸载“OSS.PaySdk.Wx 1.0.2.5”。Install failed. Rolling back...无法安装程序包“OSS.PaySdk.Wx 1.0.2.5”。您正在尝试将此程序包安装到某个将“.NETFramework,Version=v4.6”作为目标的项目中,但此程序包不包含与该框架兼容的任何程序集引用或内容文件。有关详细信息,请与程序包作者联系
建议楼主把微信的服务商下单加进去,其实就多了两个参数
按照demo,我建了一个基于.net 4.6.2的项目,引用OSS.PayCent.WX都正常,但在尝试下单的时候,
public ActionResult About()
{
var order = new WxAddPayUniOrderReq();
order.device_info = "WEB";
order.body = "测试商品支付";
order.openid = "sdfvsfdbf345678888fhngfbsdfbsdfb";
order.out_trade_no = "2017022423560123";
order.trade_type = "JSAPI";
order.total_fee = 100;
var res = m_Api.AddUniOrderAsync(order).WaitResult(); // 代码执行到这行,就一直卡住,没有执行下一行,结果也没有返回来,页面一直转圈圈
ViewBag.Message = res.RespXml;
return View();
}
扫码调用接口后返回json:{{
"alipay_trade_precreate_response": {
"code": "10000",
"msg": "Success",
"out_trade_no": "12312344132135414",
"qr_code": "https://qr.alipay.com/bax02202xexotzjwjsu800c9"
},
"sign": "QHq5ZWN10UoJtdkQI+Q9KwEf5Ok1yEIyE8T5iQ/EURmP0NgRCfg34wINjVpZMCEpOO8frVsqXo6OU8NfDXD0L1dlmFdg+GFIGyOIKR7Q9D9d5Ff6J0FLKpbI0yCDW6drDbL30uzeEw46e8voNFoM/Wm+yxG5gXMQrPmmECyLjSaf9XcWlxAB0L1tKJV+6CBsZHI/cp5NpE1vsJ4vGLjIKk+kM/Qp9w/P0kWTZ9R4KrEYbF43MEbxzOdNXWrjHs8Frl4uC3A5yGY63Jw1uPv/gzlXRauKB7vbo102UlVNcP/1Xo8uM2wqjq53Ai+wV0RvgM9ngsdNUUJQE0+jrywcyw=="
}}
从数据看已经成功,但是接口返回的是请求签名非法
在获取js和小程序唤起的方法中,签名的算法有一些问题。主要原因是参数的大写小问题,您没有和前台的参数大小写保持一致,导致生成的签名是错误的。在WxPayTradeApi.cs中GetJsClientParaResp()方法
Code:30336909-be5a-47bd-8efd-055bc6a5dbab Key:RestCommon Detail:基类请求出错,错误信息:Method not found: 'Void System.Net.Http.HttpClientHandler.set_ServerCertificateCustomValidationCallback(System.Func`5<System.Net.Http.HttpRequestMessage,System.Security.Cryptography.X509Certificates.X509Certificate2,System.Security.Cryptography.X509Certificates.X509Chain,System.Net.Security.SslPolicyErrors,Boolean>)'.
大哥更新有点小慢
/// <summary>
/// 验证回调接口签名
/// </summary>
/// <param name="formDics">表单的字典值</param>
/// <returns></returns>
public ResultMo CheckCallBackSign(IDictionary<string, string> formDics)
{
if (!formDics.ContainsKey("sign"))
{
return new ResultMo(ResultTypes.ParaError,"未发现sign参数");
}
var sign = formDics["sign"];
//var signType = formDics["sign_type"];
formDics.Remove("sign");
formDics.Remove("sign_type");
var sortDics = new SortedDictionary<string, string>(formDics);
var checkContent = string.Join("&", sortDics.Select(d => string.Concat(d.Key, "=", d.Value.UrlDecode())));
var result = new ResultMo();
CheckSign(checkContent, sign, result);
return result;
}
支付成功后,这里返回的还是 false
当前签名非法!为什么呢?
大哥更新有点小慢 我不知道如何使用
请问什么时候实现.Net Core 2.0的支付宝和微信支付?
退款成功了,返回了code = "SUCCESS", message = "成功" 。还是一直进入退款结果的通知回调,这是什么原因?
您好,看了你的开源代码。
貌似支付宝的退款查询接口目前还没有,后期会完善吗?
更新有点慢,要什么帮助吗
private ZPayRsaAssist GenerateRsaAssist(ZPayConfig config)
{
if (ConfigMode==ConfigProviderMode.Context)
return new ZPayRsaAssist(config.AppPrivateKey, config.AppPublicKey, config.Charset);
if (_rsaAssist==null)
return _rsaAssist= new ZPayRsaAssist(config.AppPrivateKey, config.AppPublicKey, config.Charset);
return _rsaAssist;
}
定位:if (ConfigMode==ConfigProviderMode.Context)这行代码中的ConfigMode为空
order.device_info = "WEB";
order.body = "OSSPay-测试商品";
order.openid = "oNyga0udCnc9NjnodieofCkkxu64";
order.out_trade_no = Order.OrderNO;
order.trade_type = "JSAPI";
order.total_fee = 1;
var res = m_Api.AddUniOrderAsync(order).WaitResult();
ret返回 1301是什么原因?
msg 当前结果签名信息不存在! 我少做了什么吗?
您好,demo中支付宝的手机网页支付和支付宝收银台支付有一些错误,您在后台拼from表单的时候
document.forms['formId'].submit(),forms[]应该是form的name而不是Id,导致submit()方法不识别而报错。
在代码OSS.PaySdk.WX/WxPayBaseApi.cs : 114行判断返回的sign实际上微信这个API并不返回sign字段。参见文档:https://pay.weixin.qq.com/wiki/doc/api/tools/mch_pay.php?chapter=14_2
如题。代码获取当前域名,不用代码写死,这样切换部署的时候不用改代码
asp.net core 2.1
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.