MK.WeChat
8.0.5.1
dotnet add package MK.WeChat --version 8.0.5.1
NuGet\Install-Package MK.WeChat -Version 8.0.5.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="MK.WeChat" Version="8.0.5.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MK.WeChat --version 8.0.5.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: MK.WeChat, 8.0.5.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.
// Install MK.WeChat as a Cake Addin #addin nuget:?package=MK.WeChat&version=8.0.5.1 // Install MK.WeChat as a Cake Tool #tool nuget:?package=MK.WeChat&version=8.0.5.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
MK.WeChat
麦康微信工具类
包含 微信公众号、微信小程序、微信支付 V3、微信支付(不推荐),等等基础方法
微信公众号
// 注入单个公众号
builder.Services.AddMKWeChatH5(opts =>
{
opts.AppId = "<微信公众号 AppId>";
opts.Secret = "<微信公众号 Secret>";
});
// 注入多个公众号
builder.Services.AddMKWeChatH5(opts =>
{
// 设为 true 后,在调用方法时,要传入对应的 AppId、Secret
opts.IsMultiAppId = true;
});
// 使用
public class DemoController
{
private readonly MKWeChatH5Client _weChatH5;
public DemoController(MKWeChatH5Client weChatH5)
{
_weChatH5 = weChatH5;
}
// 其他业务逻辑
}
微信小程序
// 注入单个小程序
builder.Services.AddMKWeChatMP(opts =>
{
opts.AppId = "<微信小程序 AppId>";
opts.Secret = "<微信小程序 Secret>";
});
// 注入多个小程序
builder.Services.AddMKWeChatMP(opts =>
{
// 设为 true 后,在调用方法时,要传入对应的 AppId、Secret
opts.IsMultiAppId = true;
});
// 使用
public class DemoController
{
private readonly MKWeChatMPClient _weChatMP;
public DemoController(MKWeChatMPClient weChatMP)
{
_weChatMP = weChatMP;
}
// 其他业务逻辑
}
微信支付 V3
// 注入单个商户号
builder.Services.AddMKWeChatPayV3(opts =>
{
opts.MchId = "<微信支付 MchId>";
opts.ApiV3Key = "<微信支付 API V3 Key>";
opts.CertSN = "<微信支付 V3 证书 Serial No>";
opts.KeyPemCertPath = "<微信支付 V3 证书文件 绝对路径(PEM 格式)>";
});
// 注入多个商户号
builder.Services.AddMKWeChatPayV3(opts =>
{
// 设为 true 后,在调用方法时,要传入对应的 MchId、ApiV3Key、CertSN、KeyPemCertPath
opts.IsMultiMchId = true;
});
// 使用
public class DemoController
{
private readonly MKWeChatPayV3Client _weChatPayV3;
public DemoController(MKWeChatPayV3Client weChatPayV3)
{
_weChatPayV3 = weChatPayV3;
}
// 其他业务逻辑
}
微信支付(不推荐,不支持注入多个商户号)
// 注入单个商户号
builder.Services.AddMKWeChatPay(opts =>
{
opts.MchId = "<微信支付 MchId>";
opts.ApiKey = "<微信支付 API Key>";
opts.CertFilePath = "<微信支付 证书文件 绝对路径>";
opts.ClientIP = "<微信支付 客户端 IP(一般是自身服务器 IP 地址)>";
});
// 使用
public class DemoController
{
private readonly MKWeChatPayClient _weChatPay;
public DemoController(MKWeChatPayClient weChatPay)
{
_weChatPay = weChatPay;
}
// 其他业务逻辑
}
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 is compatible. 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 is compatible. 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
- Microsoft.Extensions.Caching.Memory (>= 8.0.1)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
- Microsoft.Extensions.Http (>= 8.0.1)
-
net7.0
- Microsoft.Extensions.Caching.Memory (>= 8.0.1)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
- Microsoft.Extensions.Http (>= 8.0.1)
-
net8.0
- Microsoft.Extensions.Caching.Memory (>= 8.0.1)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
- Microsoft.Extensions.Http (>= 8.0.1)
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 |
---|---|---|
8.0.5.1 | 113 | 10/18/2024 |