# 查询订单详情
接口应在服务器端调用,不可在前端(小程序、网页、APP等)直接调用,具体可参考接口调用指南。
接口英文名:getOrder
服务商采购商品后,可通过本接口查询购买的订单详情。
# 1. 调用方式
# HTTPS 调用
GET https://api.weixin.qq.com/wxa/charge/service-provider/order/get?access_token=ACCESS_TOKEN&orderId=ORDERID
# 云调用
- 本接口不支持云调用。
# 第三方调用
- 本接口不支持第三方平台调用。
# 2. 请求参数
# 查询参数 Query String Parameters
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
| access_token | string | 是 | 接口调用凭证,可使用 access_token |
| orderId | string | 是 | 服务商订单ID,如"DD2981741311549200000" |
# 请求体 Request Payload
无
# 3. 返回参数
# 返回体 Response Payload
| 参数名 | 类型 | 说明 |
|---|---|---|
| errcode | number | 错误码 |
| errmsg | string | 错误信息 |
| order | object | 订单数据 |
# Res.order Object Payload
订单数据
| 参数名 | 类型 | 说明 | 枚举 |
|---|---|---|---|
| orderId | string | 订单ID | - |
| status | number | 订单状态 | 枚举值 |
| createTime | number | 订单创建时间戳(单位:毫秒) | - |
| updateTime | number | 订单更新时间戳(单位:毫秒) | - |
| orderPrice | string | 订单价格(单位:分,64位数字) | - |
| payInfo | object | 支付相关数据 | - |
| orderProductInfo | object | 订单购买的商品信息,定义见OrderProductInfo | - |
| invoiceInfo | object | 发票相关数据,未申请发票不返回该字段 | - |
| usage | object | 订单购买资源包的用量情况,未支付成功不返回该字段 | - |
# Res.order.payInfo Object Payload
支付相关数据
| 参数名 | 类型 | 说明 |
|---|---|---|
| applyPayTime | number | 支付下单时间戳(单位:秒) |
| finishPayTime | number | 支付完成时间戳(单位:秒),未支付成功不返回该字段 |
# Res.order.orderProductInfo Object Payload
订单购买的商品信息,定义见OrderProductInfo
| 参数名 | 类型 | 说明 |
|---|---|---|
| spSpuId | string | 服务商采购的批发商品SPU ID |
| spSkuId | string | 服务商采购的批发商品SKU ID |
| spBizId | number | 服务商采购的批发商品业务ID |
| spuName | string | 商品SPU名称 |
| skuName | string | 商品SKU名称 |
| skuCnt | number | 购买SKU个数 |
| validityBeginTime | number | 资源包有效期开始时间戳(单位:秒) |
| validityEndTime | number | 资源包有效期截止时间戳(单位:秒) |
# Res.order.invoiceInfo Object Payload
发票相关数据,未申请发票不返回该字段
| 参数名 | 类型 | 说明 | 枚举 |
|---|---|---|---|
| invoiceApplyTime | number | 发票申请时间戳(单位:秒) | - |
| invoiceStatus | number | 发票申请状态 | 枚举值 |
# Res.order.usage Object Payload
订单购买资源包的用量情况,未支付成功不返回该字段
| 参数名 | 类型 | 说明 |
|---|---|---|
| used | string | 已使用(64位数字) |
| all | string | 总量(64位数字) |
# 4. 枚举信息
# Res.order.status Enum
订单状态
| 枚举值 | 描述 |
|---|---|
| 1 | 待支付 |
| 2 | 支付成功 |
| 3 | 订单超时 |
| 5 | 退款中 |
| 6 | 退款成功 |
| 7 | 退款失败 |
| 9 | 订单取消 |
# Res.order.invoiceInfo.invoiceStatus Enum
发票申请状态
| 枚举值 | 描述 |
|---|---|
| 1 | 开票中 |
| 2 | 已开票 |
| 3 | 开票取消 |
| 4 | 开票失败 |
# 5. 注意事项
本接口无特殊注意事项
# 6. 代码示例
请求示例
GET https://api.weixin.qq.com/wxa/charge/service-provider/order/get?access_token=ACCESS_TOKEN&orderId=DD2981741311549200000
返回示例
{
"errcode": 0,
"order": {
"orderId": "DD2981741311549200000",
"status": 2,
"createTime": 1687265841964,
"updateTime": 1687267671475,
"orderPrice": "1",
"payInfo": {
"applyPayTime": 1687265845,
"finishPayTime": 1687265856
},
"orderProductInfo": {
"spSpuId": "10000111",
"spSkuId": "20000176",
"skuCnt": 1,
"spBizId": 100100,
"spuName": "spu name",
"skuName": "sku name",
"validityBeginTime": 1687265856,
"validityEndTime": 1718801856
},
"invoiceInfo": {
"invoiceStatus": 2,
"invoiceApplyTime": 1687265870
},
"usage": {
"used": "0",
"all": "1000"
}
}
}
# 7. 错误码
以下是本接口的错误码列表,其他错误码可参考 通用错误码;调用接口遇到报错,可使用官方提供的 API 诊断工具 辅助定位和分析问题。
| 错误码 | 错误描述 | 解决方案 |
|---|---|---|
| 10120002 | 参数错误 | 检查参数 |
| 10120405 | 方法不可用 | 对照文档使用正确的方法请求 |
# 8. 适用范围
本接口支持「小程序」账号类型调用。其他账号类型如无特殊说明,均不可调用。