# 资金结算通知

> 接收资金结算批次及其交易明细。

```yaml
openapi: 3.1.0
x-onerway-docs-version: original
x-onerway-spec-key: embedded-finance/webhooks/settlement-result
info:
  title: 资金结算通知
  version: original
  description: 接收资金结算批次及其交易明细。
webhooks:
  settlement.result:
    post:
      summary: 资金结算通知
      description: 接收资金结算批次及其交易明细。
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                request_id:
                  type: string
                  description: 用于通知去重的唯一标识。
                  x-onerway-signature-participation: included
                event_type:
                  type: string
                  description: 事件类型标识。
                  x-onerway-constraints:
                    - kind: values
                      text: 此 Webhook 回调固定为 `EMFIN.SETTLE_RESULT`。
                  x-onerway-signature-participation: included
                created_at:
                  type: string
                  description: 通知创建时间，采用 ISO 8601 格式。
                  x-onerway-signature-participation: included
                version:
                  type: string
                  description: Webhook 消息版本。
                  x-onerway-signature-participation: included
                data:
                  type: object
                  properties:
                    batchId:
                      type: integer
                      description: 结算批次 ID。
                    merchantNo:
                      type: string
                      description: 该结算批次所属的商户号。
                    settleDate:
                      type: string
                      description: 结算日期，格式为 YYYY-MM-DD。
                    currencyCode:
                      type: string
                      description: 结算币种。
                    amount:
                      type: string
                      description: 结算总金额。
                    settleDetails:
                      type: array
                      description: 结算批次中的交易明细。
                      items:
                        type: object
                        properties:
                          userId:
                            type: integer
                            description: 该笔交易关联的用户 ID。
                          transactionId:
                            type: integer
                            description: 交易 ID，取值来源于匹配入金请求中的 `rechargeId`。
                          currencyCode:
                            type: string
                            description: 该笔交易明细的币种。
                          amount:
                            type: string
                            description: 该笔交易明细的金额。
                  description: 资金结算批次详情。
                  x-onerway-signature-participation: included
            examples:
              settlement_batch:
                summary: 资金结算回调报文
                value:
                  request_id: "0000000000000000001"
                  event_type: EMFIN.SETTLE_RESULT
                  created_at: 2026-09-11T18:24:06+08:00
                  version: v1.0
                  data:
                    batchId: 1001
                    merchantNo: 800***
                    settleDate: 2026-09-11
                    currencyCode: GBP
                    amount: "300.06"
                    settleDetails:
                      - userId: 10001
                        transactionId: 100001
                        currencyCode: GBP
                        amount: "100.01"
                      - userId: 10001
                        transactionId: 100002
                        currencyCode: GBP
                        amount: "100.02"
                      - userId: 10002
                        transactionId: 100003
                        currencyCode: GBP
                        amount: "100.03"
                x-onerway-headers:
                  Content-Type: application/json;charset=UTF-8
                  x-timestamp: "1789122246"
                  x-signature: replace_with_hmac_sha256_signature
      responses:
        "200":
          description: 成功接收并受理通知后，返回 HTTP 200 和 `respCode=20000`；响应码不是 `20000` 时 Onerway
            会重试。
          content:
            application/json:
              schema:
                type: object
                properties:
                  respCode:
                    type: string
                  respMsg:
                    type: string
                required:
                  - respCode
                  - respMsg
              examples:
                return_success:
                  summary: 成功应答正文
                  value:
                    respCode: "20000"
                    respMsg: success
      x-onerway-verification:
        scheme: header-hmac
        signature:
          header: x-signature
          encoding: hex
        timestamp:
          header: x-timestamp
          tolerance: 300
        algorithm: hmac-sha256
        rule: timestamp-dot-raw-body
        reference: /zh/embedded-finance/api-reference/webhook-description
      x-onerway-header-fields:
        - name: x-signature
          schema:
            type: string
            description: Webhook 签名请求头。
        - name: x-timestamp
          schema:
            type: string
            description: Webhook 验证时间戳请求头。
```
