Bitzsoft.Integrations.Express.ChinaPost
1.0.0-alpha.8
This is a prerelease version of Bitzsoft.Integrations.Express.ChinaPost.
dotnet add package Bitzsoft.Integrations.Express.ChinaPost --version 1.0.0-alpha.8
NuGet\Install-Package Bitzsoft.Integrations.Express.ChinaPost -Version 1.0.0-alpha.8
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="Bitzsoft.Integrations.Express.ChinaPost" Version="1.0.0-alpha.8" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Bitzsoft.Integrations.Express.ChinaPost" Version="1.0.0-alpha.8" />
<PackageReference Include="Bitzsoft.Integrations.Express.ChinaPost" />
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 Bitzsoft.Integrations.Express.ChinaPost --version 1.0.0-alpha.8
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Bitzsoft.Integrations.Express.ChinaPost, 1.0.0-alpha.8"
#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 Bitzsoft.Integrations.Express.ChinaPost@1.0.0-alpha.8
#: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=Bitzsoft.Integrations.Express.ChinaPost&version=1.0.0-alpha.8&prerelease
#tool nuget:?package=Bitzsoft.Integrations.Express.ChinaPost&version=1.0.0-alpha.8&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Bitzsoft.Integrations.Express.ChinaPost
中国邮政/EMS 物流服务实现,基于《中小电商企业接口规范 V2.7》的公共请求信封对接。
功能特性
- EMS 三要素认证:
apiCode+senderNo+authorization - 支持运单轨迹查询、白名单订阅、订单接入、订单取消、预估邮费、面单查询
- 支持 EMS 常见单号规则的本地承运商识别
安装
dotnet add package Bitzsoft.Integrations.Express.ChinaPost
<PackageReference Include="Bitzsoft.Integrations.Express.ChinaPost" Version="*" />
配置
{
"Express": {
"ChinaPost": {
"SenderNo": "协议客户号",
"Authorization": "测试或生产授权码",
"BaseUrl": "https://api.ems.com.cn",
"UserCode": "可选用户编码",
"Version": "V1.0.0",
"HttpClientName": "ChinaPostExpress"
}
}
}
| 参数 | 必填 | 默认值 | 说明 |
|---|---|---|---|
SenderNo |
是 | - | EMS 协议客户号 |
Authorization |
是 | - | 授权码,区分测试和生产 |
BaseUrl |
否 | https://api.ems.com.cn |
API 基地址 |
UserCode |
否 | - | 用户编码 |
Version |
否 | V1.0.0 |
EMS API 版本 |
HttpClientName |
否 | ChinaPostExpress |
命名 HttpClient 名称 |
注册服务
services.AddBitzsoftChinaPostExpress(configuration, "Express:ChinaPost");
第三方请求日志
内置 Bitzsoft.Integrations.RequestLogging 出站请求记录管道,默认 NullRequestLogStore 不持久化。
// ① 默认:启用记录管道但不持久化(日志丢弃)
services.AddBitzsoftChinaPostExpress(options => { /* ... */ });
// ② 持久化:宿主注册 IRequestLogStore 实现后,所有出站请求自动落库
services.AddRequestLogging<MyRequestLogStore>(opts =>
{
opts.MaxBodyLength = 8192;
opts.SensitiveFields.Add("mySecret");
});
services.AddBitzsoftChinaPostExpress(options => { /* ... */ });
实现状态
| 方法 | EMS 接口 | apiCode | 状态 |
|---|---|---|---|
TrackAsync |
运单轨迹信息获取 | 040001 |
已实现 |
BatchTrackAsync |
无批量接口 | - | 并发调用 TrackAsync |
SubscribeAsync |
白名单订阅 | 020005 |
已实现 |
CreateShipmentAsync |
订单接入 | 020003 |
已实现 |
CancelShipmentAsync |
订单取消 | 020006 |
已实现 |
GetQuoteAsync |
预估邮费 | 050005 |
已实现 |
GenerateWaybillAsync |
面单查询 | 010004 |
已实现 |
DetectCarrierAsync |
无官方识别接口 | - | 本地规则识别 |
EMS 扩展参数
ExpressShipmentOrder.Extra 可传 EMS 特有字段:
| Key | 说明 |
|---|---|
logisticsOrderNo |
客户内部物流订单号;不传则自动生成 |
waybillNo |
预分配运单号;不传则由订单接入接口分配 |
ecommerceUserId |
电商客户标识;不传则自动生成 |
bizProductNo |
业务产品分类,默认 1(特快专递) |
contentsAttribute |
内件性质,默认 3(物品) |
waybillTemplateType |
面单模板类型,默认 129 |
getWaybillUrl |
设置为 true 时请求面单下载 URL |
取消订单时 EMS 需要同时传 logisticsOrderNo 和 waybillNo。统一接口只有 orderId 参数,因此可传:
logisticsOrderNo|waybillNo|cancelReason
或 JSON:
{"logisticsOrderNo":"O202203281508328002352578560","waybillNo":"1295838760599","cancelReason":"客户取消"}
注意事项
- EMS 要求地址使用国标全称,例如
浙江省、杭州市。 - 统一模型中的重量单位为千克,Provider 会转换为 EMS 的克。
GetQuoteAsync使用 EMS 国内特快物品默认产品代码112104302300991。GenerateWaybillAsync如果未在Extra["waybillNo"]中传单号,会先调用订单接入接口创建订单,再查询面单。
相关包
| 包名 | 说明 |
|---|---|
| Bitzsoft.Integrations.Express | 抽象层 |
| Bitzsoft.Integrations.Express.All | 聚合包 |
| Bitzsoft.Integrations.Compatibility | 基础工具库 |
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 is compatible. net5.0-windows was computed. net6.0 was computed. 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 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 was computed. 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- Bitzsoft.Integrations.Compatibility (>= 1.0.0-alpha.8)
- Bitzsoft.Integrations.Express (>= 1.0.0-alpha.8)
- Bitzsoft.Integrations.RequestLogging (>= 1.0.0-alpha.8)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.9)
- Microsoft.Extensions.Http (>= 10.0.9)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 10.0.9)
-
net5.0
- Bitzsoft.Integrations.Compatibility (>= 1.0.0-alpha.8)
- Bitzsoft.Integrations.Express (>= 1.0.0-alpha.8)
- Bitzsoft.Integrations.RequestLogging (>= 1.0.0-alpha.8)
- Microsoft.Extensions.Configuration.Abstractions (>= 5.0.0)
- Microsoft.Extensions.Http (>= 5.0.0)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 5.0.0)
-
net8.0
- Bitzsoft.Integrations.Compatibility (>= 1.0.0-alpha.8)
- Bitzsoft.Integrations.Express (>= 1.0.0-alpha.8)
- Bitzsoft.Integrations.RequestLogging (>= 1.0.0-alpha.8)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.9)
- Microsoft.Extensions.Http (>= 10.0.9)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 10.0.9)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Bitzsoft.Integrations.Express.ChinaPost:
| Package | Downloads |
|---|---|
|
Bitzsoft.Integrations.Express.All
快递物流服务聚合包 — 包含所有供应商实现 |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0-alpha.8 | 51 | 7/1/2026 |
| 1.0.0-alpha.7 | 66 | 6/16/2026 |
| 1.0.0-alpha.6 | 69 | 6/16/2026 |
| 1.0.0-alpha.5 | 57 | 6/14/2026 |
| 1.0.0-alpha.3 | 60 | 6/7/2026 |