# 订单回调通知

1. 该接口用于通知订单，当订单状态变更时，FaTPay 对合作伙伴服务端发起异步通知
2. on-ramp订单仅一种情况会触发通知（订单状态变更为已完结，即链上交易已确认时）\
   nft订单已支付、已结算状态会触发通知
3. 合作伙伴需提供用于接收回调的 Webhook 地址给 FaTPay 具体可联系 <developers@fatpay.xyz>
4. FaTPay 平台目前针对回调无重试机制，如合作伙伴对订单存在疑问，可使用[订单列表查询接口](/zh/reference/api-reference/on-ramp-apis/list-all-orders.md)获取订单信息

## 订单状态变更为已完结时，FaTPay 对合作伙伴服务端发起异步通知

<mark style="color:green;">`POST`</mark> `合作伙伴域名/Webhook_URI`

#### Headers

| Name                                              | Type    | Description                                                                                                                                                                                                                                                                                                                                                                                                      |
| ------------------------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| X-Fp-Partner-Id<mark style="color:red;">\*</mark> | String  | <p>申请高级合作伙伴时，由 FaTPay 分配的 partner ID<br>e.g. 2yQrS9A0xmM8xpfa</p>                                                                                                                                                                                                                                                                                                                                                |
| X-Fp-Timestamp<mark style="color:red;">\*</mark>  | Integer | <p>Unixtime 时间戳，秒<br>e.g. 1661346861</p>                                                                                                                                                                                                                                                                                                                                                                         |
| X-Fp-Nonce<mark style="color:red;">\*</mark>      | Integer | <p>6位随机正整数<br>e.g. 868964</p>                                                                                                                                                                                                                                                                                                                                                                                    |
| X-Fp-Signature<mark style="color:red;">\*</mark>  | String  | <p>由 <code>FaTPayPrivateKey</code> 生成的签名<br>e.g.<br>zbBQ+1nv/5up9riH1wbTSSMmkb26LQj3g1cNWsutOordOrtpk8agcA5D5bdYaGeVlHK0qZ2MlUV+ZfOK9cXMuficeIm5fnEjMEm7s1IZtSivMt5te7EFqe52dtVFafE4hUgwqH6QBZB0yZ1FSqHs2dOCI0e8RKJQBDitxtHkibStl1Jt5wulzzq96qWbbVnwoBqGDT52OtwwEcDqMI4SIAzUAdBhAuLqUig1U4Ne9ufT8B1aAohEk5fvn/Sbom21bEjLdgbt5PwH2wmmuBx4tq31IgcP4V+qEBILY2eMAFzkvxNXaX3PsLbj9NpgyIc3HQl0FtRq3gdN7FsSvyvcWA==</p> |

#### Request Body

| Name                                                      | Type    | Description                                                                                                  |
| --------------------------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------ |
| orderId<mark style="color:red;">\*</mark>                 | String  | 订单id，如 jIdvChO85Bw.                                                                                          |
| orderStatus<mark style="color:red;">\*</mark>             | Integer | <p>订单状态，固定值 3<br>本接口不会返回其他状态</p>                                                                             |
| userId<mark style="color:red;">\*</mark>                  | String  | FaTPay 用户id，如 test-4Q4-zf4mDKh7h3FNXPFNaA..                                                                  |
| payTime<mark style="color:red;">\*</mark>                 | String  | <p>订单完成支付时间<br>Unixtime 时间戳，秒<br>e.g. 1661346861</p>                                                         |
| deliverTime<mark style="color:red;">\*</mark>             | Stringe | <p>订单上链时间<br>Unixtime 时间戳，秒<br>e.g. 1661346861</p>                                                           |
| finishTime<mark style="color:red;">\*</mark>              | String  | <p>链上交易完成时间<br>Unixtime 时间戳，秒<br>e.g. 1661346861</p>                                                         |
| fiatCurrency<mark style="color:red;">\*</mark>            | String  | 法币ISO代码：USD、THB                                                                                              |
| currencyAmount<mark style="color:red;">\*</mark>          | Long    | 加密货币数量，最多 2 位小数，如 182                                                                                        |
| cryptoCurrency<mark style="color:red;">\*</mark>          | String  | 加密货币名称，如 USDT                                                                                                |
| cryptoCurrencyCode<mark style="color:red;">\*</mark>      | String  | 加密货币标识码，如 USDT\_ERC20                                                                                        |
| cryptoCurrencyAmount<mark style="color:red;">\*</mark>    | Decimal | 法币金额，最多 2 位小数，如 199                                                                                          |
| cryptoCurrencyUnitPrice<mark style="color:red;">\*</mark> | Decimal | 加密货币单价，最多 2 位小数，如 1.03                                                                                       |
| walletAddress<mark style="color:red;">\*</mark>           | String  | 钱包地址，如 0xbe188d6641e8b680743a4815dfa0f6208038960f                                                            |
| gasFee<mark style="color:red;">\*</mark>                  | Decimal | 网络手续费，最多 2 位小数，如 1.32                                                                                        |
| platformFee<mark style="color:red;">\*</mark>             | Decimal | 平台支付手续费，最多 2 位小数，如 11.94                                                                                     |
| totalFee<mark style="color:red;">\*</mark>                | Decimal | <p>总计支付手续费<br>2022-10-18后的订单，totalFee=platformFee</p>                                                        |
| payment<mark style="color:red;">\*</mark>                 | String  | 法币付款方式，见 [法定货币及支付方式查询接口](/zh/reference/api-reference/on-ramp-apis/list-all-fiat-currencies.md#paymentoption) |
| txHash<mark style="color:red;">\*</mark>                  | String  | 链上交易号，如 0x93da31ee10015ecf3c0dee4a5fa1c74a7a2e02f88ec71f60317c2055f80f3d3c                                   |
| network<mark style="color:red;">\*</mark>                 | String  | 加密货币所在公链，如ethereum\_mainnet                                                                                  |
| blockchainExplorer<mark style="color:red;">\*</mark>      | String  | 链上交易查询地址，如 <https://mumbai.polygonscan.com/tx/>                                                              |
| gasFeeUnit<mark style="color:red;">\*</mark>              | String  | <p>网络手续费计价单位，如BTC</p><p>2022-10-18后的订单均按照所购加密货币单位来计价，如购买BTC，则gasFee按照BTC单位来收取</p>                            |
| platformFeeUnit<mark style="color:red;">\*</mark>         | String  | 平台手续费计价单位，如USD                                                                                               |
| totalFeeUnit<mark style="color:red;">\*</mark>            | String  | 总计手续费计价单位，如USD                                                                                               |
| ext<mark style="color:red;">\*</mark>                     | String  | URL入参提交的ext内容，如ext                                                                                           |
| walletAddressTag<mark style="color:red;">\*</mark>        | String  | 钱包地址附带的Tag/Memo，如888888                                                                                      |

{% hint style="warning" %}
合作伙伴收到 FaTPay  回调后，务必对收到的回调进行[签名校验](/zh/reference/api-reference/verification.md#webhook-hui-tiao-yan-qian)，通过后才可进行后续相应处理。
{% endhint %}

## 请求参数

请见 [订单列表查询接口](/zh/reference/api-reference/on-ramp-apis/list-all-orders.md#order)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://dev.fatpay.org/zh/reference/api-reference/webhooks/webhook-for-order-events.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
