包信息
| 属性 | 值 |
|---|---|
| NuGet 包 | Bitzsoft.Integrations.Express.Zto |
| Provider ID | zto |
| 鉴权 | AppKey + AppSecret |
| 能力 | 全功能(轨迹、下单、面单) |
配置字段(ZtoOptions)
| 字段 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
AppKey | string | 是 | — | 应用 Key |
AppSecret | string | 是 | — | 应用密钥 |
BaseUrl | string | 否 | https://jwzto.zto.com | 中通开放平台 API 基地址 |
HttpClientName | string | 否 | ZtoExpress | 命名 HttpClient |
配置示例
{ "Express": { "Zto": { "AppKey": "your-app-key", "AppSecret": "your-app-secret" } }}DI 注册
builder.Services.AddBitzsoftZtoExpress(builder.Configuration.GetSection("Express:Zto"));使用示例
public class ZtoService(IExpressProvider express){ public async Task<ExpressWaybillResult> GenerateWaybillAsync(string orderId) { return await express.GenerateWaybillAsync(orderId); }
public async Task<IReadOnlyList<ExpressQuoteResult>> GetQuoteAsync(string from, string to, double weight) { return await express.GetQuoteAsync(from, to, weight); }}已知限制
- 中通开放平台 API 的
BaseUrl按合作模式可能不同(jwzto.zto.com为标准入口)。