# Webhook 异步通知

在 `控制台` 设置好 `webhook URL` 后，面包多会在以下情况下向该 `URL` 发送请求：

* 订单支付成功
* 有订单被投诉

接收 Webhook 通知的 URL 必须可直接访问，不能携带参数，或其他验证，否则可能会导致请求无法正常完成

> 请注意  ：webhook 的请求方式为 Post Json，不是 form 形式

**请求参数**

|      |        |                                                 |
| ---- | ------ | ----------------------------------------------- |
| 参数名  | 类型     | 说明                                              |
| type | string | 通知类型，支付成功为 `charge_succeeded`，订单投诉为 `complaint` |
| data | object | 数据包                                             |

当 `type` 为 `charge_succeeded` 时，`data` 结构如下：

|                |        |                        |
| -------------- | ------ | ---------------------- |
| 参数名            | 类型     | 说明                     |
| description    | string | 商品描述                   |
| out\_trade\_no | string | 订单号                    |
| amount         | int    | 金额，单位为分                |
| openid         | string | 支付者 openid (仅微信支付)     |
| charge\_id     | string | 支付渠道流水号                |
| payway         | int    | 支付渠道，微信支付为 1 ，支付宝支付为 2 |

当 `type` 为 `complaint` 时，`data` 结构如下：

|                   |        |           |
| ----------------- | ------ | --------- |
| 参数名               | 类型     | 说明        |
| out\_trade\_no    | string | 订单号       |
| complaint\_detail | string | 投诉详情      |
| amount            | int    | 订单金额，单位为分 |
| payer\_phone      | string | 投诉者电话     |

⚠️ 注意

* 异步通知以 `post json` 方式发送
* 为保障推送到达率，系统可能多次进行通知推送，请做好去重逻辑


---

# 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://doc.mbd.pub/api/webhook-yi-bu-tong-zhi.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.
