Galosys.Foundation.Alipay
26.7.31.1
dotnet add package Galosys.Foundation.Alipay --version 26.7.31.1
NuGet\Install-Package Galosys.Foundation.Alipay -Version 26.7.31.1
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="Galosys.Foundation.Alipay" Version="26.7.31.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Galosys.Foundation.Alipay" Version="26.7.31.1" />
<PackageReference Include="Galosys.Foundation.Alipay" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Galosys.Foundation.Alipay --version 26.7.31.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Galosys.Foundation.Alipay, 26.7.31.1"
#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.
#:package Galosys.Foundation.Alipay@26.7.31.1
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Galosys.Foundation.Alipay&version=26.7.31.1
#tool nuget:?package=Galosys.Foundation.Alipay&version=26.7.31.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Galosys.Foundation.Alipay
成熟度: 🟡 可用 — 支付宝支付通道适配器,支持 EasySDK V2 / 官方 V3 双策略
支付宝支付通道模块,实现 IPaymentChannel 和 IBillNormalizer,内部支持双策略:EasySDK V2(默认)和官方 V3 SDK(通过配置切换)。
功能特性
- 支付能力 — 当面付、网页支付、H5、APP、JSAPI 五种支付方式
- 订单操作 — 创建/查询/退款/关闭/回调验签
- 账单拉取 —
PullBillFileAsync拉取支付宝交易账单(zip/GB2312 CSV) - 账单标准化 —
AlipayBillNormalizer将原始 CSV 转换为统一NormalizedBillDto
安装
<PackageReference Include="Galosys.Foundation.Alipay" Version="x.x.x" />
快速开始
1. 注册服务
// 模块自动发现(推荐)—— AlipayModule 自动注册
services.AddAlipay(); // 注册 EasySDK 配置服务
services.AddAlipayPayment(); // 注册 IPaymentChannel + IBillNormalizer
配置 appsettings.json:
{
"Alipay": {
"SdkMode": "easy", // "easy"(默认)| "v3"
"AppId": "your_app_id",
"PrivateKey": "your_private_key",
"AlipayPublicKey": "alipay_public_key"
}
}
切换 V3 模式:
{
"Alipay": {
"SdkMode": "v3",
"AppId": "your_app_id",
"PrivateKey": "your_private_key",
"AlipayPublicKey": "alipay_public_key",
"AppCertPath": "path/to/appCert.crt",
"RootCertPath": "path/to/rootCert.crt"
}
}
2. 创建支付
using Galosys.Foundation.Integration.Payment.Abstractions;
// 通过 IPaymentDispatcher 路由到 Alipay
var result = await dispatcher.PayAsync(new PaymentCreateRequest
{
Channel = "alipay",
OutTradeNo = "ORD001",
Amount = 99.9m,
Subject = "测试订单",
PaymentType = PaymentType.PagePay,
});
3. 拉取账单
var channel = new AlipayPaymentChannel(); // 实际通过 DI 获取 IPaymentChannel
var raw = await channel.PullBillFileAsync(new BillPullRequest(
BillDate: "2024-01-20",
Type: BillType.Trade));
// 或通过 IBillNormalizer 标准化
var normalizer = new AlipayBillNormalizer();
var bills = await normalizer.NormalizeAsync(raw);
依赖
Galosys.Foundation.Integration.Payment.Abstractions— IPaymentChannel、IBillNormalizerGalosys.Foundation.Core— PluginRegistry、IModuleAlipay.EasySDK— 支付宝 Easy SDK V2
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- alipayeasysdk (>= 2.1.3)
- AlipaySDKNet (>= 4.9.1234)
- Galosys.Foundation.Core (>= 26.7.31.1)
- Galosys.Foundation.Integration.Payment.Abstractions (>= 26.7.31.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.