查询关联外部订单
使用「外部订单推送 + 合并开票」模式(用户在 H5 / PC 嵌入页面勾选多笔订单合并开票)时,一张发票会关联多笔外部订单。该接口按发票的外部订单号返回其关联的全部外部订单。
GET
/invoice/{outOrderNo}/out-orders| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| outOrderNo | string | 必填 | 路径参数,发票的外部订单号 |
| appKey | string | 条件必填 | 服务密钥 Key,与 appSecret 成对使用;传了 accessToken 时可不传 |
| appSecret | string | 条件必填 | 服务密钥 Secret |
| accessToken | string | 条件必填 | 访问令牌,通过 获取访问令牌 接口获取;传了 accessToken 则无需 appKey / appSecret |
| taxNumber | string | 必填 | 企业纳税人识别号,指定本次操作的开票企业;必须是该密钥已关联的企业 |
| color | string | 选填 | blue(默认)/ red |
curl "https://fapiao-api.easyapi.com/invoice/FL1735700000000/out-orders?appKey=你的appKey&appSecret=你的appSecret&taxNumber=91320211MA1WML8X6T"
响应示例
{
"code": 1,
"message": "获取成功",
"content": [
{
"outOrderId": 30001,
"addTime": "2025-12-01 10:00:00",
"expireTime": "2026-12-01 10:00:00",
"no": "SO20251201001",
"type": "销售订单",
"orderTime": "2025-12-01 09:30:00",
"fields": "{\"contract\":\"HT2025001\"}",
"price": 500,
"state": 1,
"username": "user001",
"items": [
{
"name": "技术服务费",
"model": "",
"unit": "次",
"number": 1,
"price": 500,
"no": "3040201010000000000",
"taxRate": 0.06,
"zeroRateFlag": null,
"preferentialPolicyFlag": null,
"preferentialPolicyName": null
}
]
}
]
}
字段说明
| 字段 | 类型 | 说明 |
|---|---|---|
| outOrderId | int | 外部订单 ID |
| addTime / expireTime / orderTime | string | 推送时间 / 过期时间 / 订单生成时间 |
| no | string | 外部订单号 |
| type | string | 外部订单类型(控制台「订单类型」配置) |
| fields | string | 订单自定义字段(JSON 字符串) |
| price | decimal | 订单含税金额 |
| state | int | 0 未开票、1 已开票、2 开票中 |
| username | string | 用户标识 |
| items | array | 订单明细:名称、型号、单位、数量、含税单价、税收分类编码、税率、零税率标识、优惠政策 |
发票不存在时返回 xxx订单号不存在;没有关联订单时返回 {"code":0,"message":"暂无数据"}。