Zongsoft.Externals.Wechat
7.6.0
See the version list below for details.
dotnet add package Zongsoft.Externals.Wechat --version 7.6.0
NuGet\Install-Package Zongsoft.Externals.Wechat -Version 7.6.0
<PackageReference Include="Zongsoft.Externals.Wechat" Version="7.6.0" />
<PackageVersion Include="Zongsoft.Externals.Wechat" Version="7.6.0" />
<PackageReference Include="Zongsoft.Externals.Wechat" />
paket add Zongsoft.Externals.Wechat --version 7.6.0
#r "nuget: Zongsoft.Externals.Wechat, 7.6.0"
#:package Zongsoft.Externals.Wechat@7.6.0
#addin nuget:?package=Zongsoft.Externals.Wechat&version=7.6.0
#tool nuget:?package=Zongsoft.Externals.Wechat&version=7.6.0
Zongsoft.Externals.Wechat Extension Plugin Library
WeChat Third-Party Platform
Concepts
Third-party platform application
component_appidThird-party platform secret
component_appsecretEncryption and decryption keys
symmetric_key,AESEncodingKeyPlatform access token
component_access_token- The credential used to call third-party platform APIs. The token is valid for
2hours. Refresh it before it expires, for example at about1hour and50minutes. - Reference: https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/api/component_access_token.html
- The credential used to call third-party platform APIs. The token is valid for
Platform verify ticket
component_verify_ticket- After a third-party platform is created and approved, the WeChat server sends the verify ticket to its authorization event receiving URL by
POSTevery 10 minutes. The third-party platform only needs to return the stringsuccess. - Reference: https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/api/component_verify_ticket.html
- After a third-party platform is created and approved, the WeChat server sends the verify ticket to its authorization event receiving URL by
Authorization Flow
- Wait for the
component_verify_ticketcallback pushed by WeChat. - Get or asynchronously refresh the platform access token
component_access_token. - Use the platform access token to get the pre-authorization code
pre_auth_code. - Generate two authorization page URLs from the pre-authorization code.
- Scan page: https://mp.weixin.qq.com/cgi-bin/componentloginpage?component_appid=xxxx&pre_auth_code=xxxxx&redirect_uri=xxxx&auth_type=xxx
- WeChat share: https://mp.weixin.qq.com/safe/bindcomponent?action=bindcomponent&no_scan=1&component_appid=xxxx&pre_auth_code=xxxxx&redirect_uri=xxxx&auth_type=xxx&biz_appid=xxxx#wechat_redirect
- After the user authorizes, WeChat pushes a callback. Read the authorization binding information in that callback.
Use https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/api/authorization_info.html to obtain
authorizer_appid,authorizer_access_token, andauthorizer_refresh_token. - Periodically refresh the authorizer access credential.
References
Regular merchant documentation center
https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pages/index.shtml
Service provider documentation center
https://pay.weixin.qq.com/wiki/doc/apiv3_partner/pages/index.shtml
GitBook
API certificate
Tools
WeChat Pay API verification script for Postman
WeChat Pay signing, signature verification, encryption, and decryption tools
https://pay.weixin.qq.com/wiki/doc/apiv3/wechatpay/download/Product_5.zip
WeChat Pay certificate tool
Plugin-Based Integration
Compose this feature through the host; a package reference supplies compile-time APIs, while plugin loading also requires deployed manifests and runtime assets. See the complete plugin workflow.
The manifest exposes the Wechat components and services. Keep account, certificate and payment settings under application-owned options. API and callback gateway plugins are optional, separate host contributions.
| Runtime artifact | Source of truth |
|---|---|
Zongsoft.Externals.Wechat |
Zongsoft.Externals.Wechat.plugin |
| File copying and dependencies | Zongsoft.Externals.Wechat.deploy |
Add this fragment to an existing host .deploy (retain Main and the host’s other base manifests; do not replace the whole file):
[plugins zongsoft externals wechat]
nuget:Zongsoft.Externals.Wechat
Run dotnet deploy against a test deployment as explained in the workflow, with the host's framework, platform, architecture and, where needed, site. Pin compatible versions in real deployments; application dependencies such as databases, caches or commercial runtimes are still separate prerequisites.
Additional artifacts listed by the deployment manifest include Zongsoft.Externals.Wechat.plugin, Zongsoft.Externals.Wechat.option. Retain assemblies, dependencies and satellite resource directories as well. Restart the host after deployment, check plugin loading and service/driver registration, then verify the workflow above; copied files alone do not prove that the feature is active.
Publishing
Set NUGET_API_KEY and use the Release pack task. The --project option selects a project or solution. Publish the main package first, wait until it is available from NuGet, and then publish the API and gateway packages that reference it:
dotnet cake build.cake --target=pack --edition=Release --project=src/Zongsoft.Externals.Wechat.csproj
dotnet cake build.cake --target=pack --edition=Release --project=api/Zongsoft.Externals.Wechat.Web.csproj
dotnet cake build.cake --target=pack --edition=Release --project=gateway/Zongsoft.Externals.Wechat.Gateway.csproj
Without --project, the task builds the complete solution.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. 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. |
-
net10.0
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.0)
- Microsoft.Extensions.Http (>= 10.0.0)
- Portable.BouncyCastle (>= 1.9.0)
- Zongsoft.Core (>= 7.63.0)
-
net8.0
- Microsoft.Extensions.Configuration.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Http (>= 8.0.1)
- Portable.BouncyCastle (>= 1.9.0)
- Zongsoft.Core (>= 7.63.0)
-
net9.0
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.2)
- Microsoft.Extensions.Http (>= 9.0.2)
- Portable.BouncyCastle (>= 1.9.0)
- Zongsoft.Core (>= 7.63.0)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Zongsoft.Externals.Wechat:
| Package | Downloads |
|---|---|
|
Zongsoft.Externals.Wechat.Web
This is a web api library about Wechat. |
|
|
Zongsoft.Externals.Wechat.Gateway
This is a library about Wechat Gateway. |
GitHub repositories
This package is not used by any popular GitHub repositories.