> ## Documentation Index
> Fetch the complete documentation index at: https://developers.uqpay.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 通过 Webhook 跟踪订单

> 把订单通知接入订单查询与持仓核对流程。

[Stablecoin Account API Publisher Disclaimer](/zh/stablecoin-account/v1.6/guide/stablecoin-account-api-publisher-disclaimer)

通过[Webhook 设置](/zh/account-center/v1.6/guide/webhooks-setting)配置接收地址。验签及通用投递处理见公共的 [Webhooks 概览](/zh/account-center/v1.6/guide/webhooks-overview)。

## 将通知关联到订单

[创建订单](/zh/stocks/api-reference/create-order)时保存 `order_id`。Stocks 通知的 `source_id` 和 `data.order.order_id` 均标识该订单，`data.order` 是事件发生时的订单快照。

| 事件类型                      | 下一步调用                                                                                                                                                                    |
| ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `stocks.order.processing` | 用 `source_id` 调用 [Retrieve order](/zh/stocks/api-reference/retrieve-order)，继续跟踪订单。                                                                                       |
| `stocks.order.completed`  | 读取成交结果，再用 `asset_id` 调用 [List positions](/zh/stocks/api-reference/list-positions)，用 `order_id` 调用 [List position events](/zh/stocks/api-reference/list-position-events)。 |
| `stocks.order.failed`     | 读取 `failure_code` 和 `failure_message`；需要当前状态时调用 [Retrieve order](/zh/stocks/api-reference/retrieve-order)。                                                               |

完整字段和通知样例见 [Stocks 订单 Webhook](/zh/stocks/webhooks/order)。

## 处理重复或缺失的通知

使用 `event_id` 识别投递记录，使用 `data.business_event_id` 在账户内识别业务事件。不要重复计入持仓变动，也不要用迟到的处理中通知覆盖终态结果。

未收到终态通知时，使用已保存的 `order_id` 调用 [Retrieve order](/zh/stocks/api-reference/retrieve-order)。若没有收到订单标识，则使用 `client_reference` 调用 [List orders](/zh/stocks/api-reference/list-orders)找回订单。不要仅因通知缺失就创建第二笔订单。
