EasySeries.Pay
3.4.2
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package EasySeries.Pay --version 3.4.2
NuGet\Install-Package EasySeries.Pay -Version 3.4.2
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="EasySeries.Pay" Version="3.4.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add EasySeries.Pay --version 3.4.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: EasySeries.Pay, 3.4.2"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install EasySeries.Pay as a Cake Addin #addin nuget:?package=EasySeries.Pay&version=3.4.2 // Install EasySeries.Pay as a Cake Tool #tool nuget:?package=EasySeries.Pay&version=3.4.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
EasySeries.Pay
Easy支付,Easy系列的首个应用,用于微信支付,阿里支付。
使用说明:
配置模式-支付配置Appsettings
//appsettings.json
"AliPaySecurityOptions": {
"AppId": "xxx", //支付宝WAP 应用id(现只支持wap).
"PrivateKeyPath": "xx/xx.txt", //私钥文件路径(安全类型为KEY时必要).
"AliPublicKeyPath": "xx/xx.txt", //阿里公钥文件路径(安全类型为KEY时必要).
"PayNotifyUrl": "https://xx/api/xxx" //支付回调通知url(必要).
"IsVerifySign": false, //回调通知是否验签(false不安全)
"SecurityType": "CERT", //安全类型:KEY-密钥 或者 CERT-证书
"AliAppPublicCertPath": "xxx.crt", //应用公钥证书文件路径(安全类型为CERT时必要).
"AliRootCertPath": "xxx.crt", //阿里根证书文件路径(安全类型为CERT时必要).
"AliPublicCertPath": "xxx.crt" //阿里公钥证书文件路径(安全类型为CERT时必要).
},
"WechatPaySecurityOptions": {
"AppId": "xxx", //微信小程序Id.
"MobileAppId": "xxx", //移动应用Id.
"CommonAppId": "xxx", //微信公众号Id.
"MchId": "xxxxx", //商户id.
"Key": "xxxxxx", //v3 key.
"CertSerialno": "xxx",//公钥证书序列号
"IsVerifySign": false, //回调通知是否验签(暂无平台证书公钥的可不验签-不安全).
"PlatCertPath": "xx/xx.pem", //平台证书公钥文件路径.
"PrivateKeyPath": "xx/xx.pem", //私钥文件路径.
"PayNotifyUrl": "https://xxx.xx", //支付回调通知url(必要).
"RefundNotifyUrl": "https://xxx.xx" //退款回调通知url(必要).
}
//注册
builder.Services.AddEasyPayService();
//使用
public YourController(IEasyPayWechat easyPayWechat, IEasyPayAli easyPayAli)
{
_easyPayWechat = easyPayWechat;
_easyPayAli = easyPayAli;
}
[HttpGet("wechat")]
public async Task<PayQueryResponse> QueryAsync(string outTradeNo)
{
return await _easyPayWechat.WechatQueryPayAsync(outTradeNo, "");
}
[HttpGet("ali")]
public AlipayTradeQueryResponse QueryAli(string outTradeNo)
{
return _easyPayAli.AlipayQuery(outTradeNo);
}
即时模式-支付配置-可从数据库读取
//注册
builder.Services.AddEasyPayService();
//使用
public YourController(IEasyPayWechat easyPayWechat, IEasyPayAli easyPayAli)
{
_easyPayWechat = easyPayWechat;
_easyPayAli = easyPayAli;
}
[HttpGet("wechat")]
public async Task<PayQueryResponse> QueryAsync(string outTradeNo)
{
var options = new WechatPaySecurityOptions
{
AppId = "your appid",
MchId = "your MchId",
Key = "v3 key",
CertSerialno = "",
PlatCertPath = "file path .pem",
PrivateKeyPath = "file path .pem",
PayNotifyUrl = "your api url"
};
return await _easyPayWechat.WechatQueryPayAsync(outTradeNo, "", options);
}
[HttpGet("ali")]
public AlipayTradeQueryResponse QueryAli(string outTradeNo)
{
var options = new AliPaySecurityOptions
{
AppId = "your appid",
PrivateKeyPath = "file path .txt",
AliPublicKeyPath = "file path .txt",
PayNotifyUrl = "your api url"
};
return _easyPayAli.AlipayQuery(outTradeNo, options);
}
API列表
/// <summary>
/// 微信支付Interface.
/// </summary>
public interface IEasyPayWechat
{
/// <summary>
/// 生成预付订单(JSAPI).
/// </summary>
/// <param name="payModel">支付信息model.</param>
/// <param name="securityOptions">支付安全(即时模式用).</param>
/// <returns>预付订单号.</returns>
Task<string> WechatPrepayAsync(JSAPIPayModel payModel, WechatPaySecurityOptions? securityOptions = null);
/// <summary>
/// 生成预付订单(APP).
/// </summary>
/// <param name="payModel">支付信息model.</param>
/// <param name="securityOptions">支付安全(即时模式用).</param>
/// <returns>预付订单号.</returns>
Task<string> WechatPrepayAsync(AppPayModel payModel, WechatPaySecurityOptions? securityOptions = null);
/// <summary>
/// 支付查询.
/// </summary>
/// <param name="outTradeNo">商户单号(2选1).</param>
/// <param name="tradeNo">微信支付单号(2选1).</param>
/// <param name="securityOptions">支付安全(即时模式用).</param>
/// <returns>支付查询结果.</returns>
/// <exception cref="ArgumentNullException">单号为空.</exception>
Task<PayQueryResponse> WechatQueryPayAsync(string outTradeNo, string tradeNo, WechatPaySecurityOptions? securityOptions = null);
/// <summary>
/// 退款.
/// </summary>
/// <param name="refundModel">退款信息.</param>
/// <param name="securityOptions">支付安全(即时模式用).</param>
/// <returns>结果信息.</returns>
Task<RefundResponse> WechatRefundAsync(RefundModel refundModel, WechatPaySecurityOptions? securityOptions = null);
/// <summary>
/// 查询退款.
/// </summary>
/// <param name="refundNo">退款单号.</param>
/// <param name="securityOptions">支付安全(即时模式用).</param>
/// <returns>查询结果.</returns>
Task<RefundQueryResponse> WechatQueryRefundAsync(string refundNo, WechatPaySecurityOptions? securityOptions = null);
/// <summary>
/// 回调通知处理.
/// </summary>
/// <param name="request">回调通知请求.</param>
/// <param name="securityOptions">支付安全(即时模式用).</param>
/// <returns>支付查询结果.</returns>
/// <exception cref="Exception">处理异常.</exception>
Task<PayQueryResponse> WechatNotifyHandleAsync(HttpRequest request, WechatPaySecurityOptions? securityOptions = null);
/// <summary>
/// 退款回调通知处理.
/// </summary>
/// <param name="request">回调通知请求.</param>
/// <param name="securityOptions">支付安全(即时模式用).</param>
/// <returns>支付查询结果.</returns>
/// <exception cref="Exception">处理异常.</exception>
Task<RefundNotify> WechatRefundNotifyHandleAsync(HttpRequest request, WechatPaySecurityOptions? securityOptions = null);
/// <summary>
/// JSAPI签名.
/// </summary>
/// <param name="prepayid">预付订单id.</param>
/// <param name="appIdType">appId类型.</param>
/// <param name="securityOptions">支付安全(即时模式用).</param>
/// <returns>JSAPI签名信息.</returns>
JSAPISignInfo JSAPISign(string prepayid, JSAPIAppIdTypes appIdType, WechatPaySecurityOptions? securityOptions = null);
/// <summary>
/// APP支付签名.
/// </summary>
/// <param name="prepayid">预付订单id.</param>
/// <param name="securityOptions">支付安全(即时模式用).</param>
/// <returns>APP支付签名包.</returns>
AppSignInfo AppSign(string prepayid, WechatPaySecurityOptions? securityOptions = null);
/// <summary>
/// 获取支付平台证书(验签用).
/// </summary>
/// <param name="securityOptions">支付安全(即时模式用).</param>
/// <returns>支付平台证书.</returns>
Task<List<PlatCert>> WechatGetCertificatesAsync(WechatPaySecurityOptions? securityOptions = null);
}
/// <summary>
/// 阿里支付Interface.
/// </summary>
public interface IEasyPayAli
{
/// <summary>
/// 关闭订单.
/// </summary>
/// <param name="outTradeNO">商户单号.</param>
/// <param name="securityOptions">支付安全(即时模式用).</param>
/// <returns>关闭退款响应结果.</returns>
AlipayTradeCloseResponse AlipayClose(string outTradeNO, AliPaySecurityOptions? securityOptions = null);
/// <summary>
/// 回调通知处理.
/// </summary>
/// <param name="request">回调通知请求.</param>
/// <param name="securityOptions">支付安全(即时模式用).</param>
/// <returns>通知内容.</returns>
/// <exception cref="Exception">请求异常.</exception>
NofityModel AlipayNotifyHandle(HttpRequest request, AliPaySecurityOptions? securityOptions = null);
/// <summary>
/// 账单查询.
/// </summary>
/// <param name="outTradeNo">商户单号.</param>
/// <param name="securityOptions">支付安全(即时模式用).</param>
/// <returns>查询响应结果.</returns>
AlipayTradeQueryResponse AlipayQuery(string outTradeNo, AliPaySecurityOptions? securityOptions = null);
/// <summary>
/// 退款.
/// </summary>
/// <param name="refundModel">退款模型.</param>
/// <param name="securityOptions">支付安全(即时模式用).</param>
/// <returns>退款响应结果.</returns>
AlipayTradeRefundResponse AlipayRefund(AliPayRefundModel refundModel, AliPaySecurityOptions? securityOptions = null);
/// <summary>
/// 支付(手机网页).
/// </summary>
/// <param name="payModel">支付model.</param>
/// <param name="securityOptions">支付安全(即时模式用).</param>
/// <returns>支付响应结果.</returns>
AlipayTradeWapPayResponse AlipayWap(AliPayModel payModel, AliPaySecurityOptions? securityOptions = null);
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net6.0
- AlipaySDKNet.Standard (>= 4.7.238)
- Microsoft.AspNetCore.Http.Abstractions (>= 2.2.0)
- Microsoft.Extensions.DependencyInjection (>= 7.0.0)
- Microsoft.Extensions.Options (>= 7.0.1)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 7.0.0)
- RestSharp (>= 110.2.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
4.2.0 | 116 | 8/8/2024 |
4.1.2 | 67 | 7/26/2024 |
4.1.1 | 77 | 7/26/2024 |
4.1.0 | 72 | 7/26/2024 |
4.0.1 | 97 | 7/9/2024 |
3.4.3 | 95 | 5/15/2024 |
3.4.2 | 126 | 4/22/2024 |
3.4.1 | 121 | 4/21/2024 |
3.4.0 | 144 | 4/17/2024 |
3.3.3 | 117 | 4/16/2024 |
3.3.2 | 116 | 4/16/2024 |
3.3.1 | 127 | 4/15/2024 |
3.3.0 | 119 | 4/12/2024 |
3.2.5 | 144 | 9/19/2023 |
3.2.1 | 181 | 8/27/2023 |
3.2.0 | 158 | 6/22/2023 |