# 付款回调

> 接收 V3 付款状态通知，校验签名，并分别处理付款失败和退回。

```yaml
openapi: 3.1.0
x-onerway-docs-version: original
x-onerway-spec-key: transfer/webhooks/v3-transfer-result
info:
  title: 付款回调
  version: original
  description: 接收 V3 付款状态通知，校验签名，并分别处理付款失败和退回。
webhooks:
  v3.transfer.result:
    post:
      summary: 付款回调
      description: 接收 V3 付款状态通知，校验签名，并分别处理付款失败和退回。
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                requestId:
                  type: string
                  description: 本次通知的编号，与 data.requestId 中的商户付款业务流水号不同。
                eventType:
                  type: string
                  description: 事件类型，固定为 transfer.transaction.status.change。
                createdAt:
                  type: string
                  description: 通知生成时间，使用 ISO 本地日期时间格式。时区：北京时间（UTC+8）。
                version:
                  type: string
                  description: 通知消息的当前版本号。
                data:
                  type: object
                  properties:
                    merchantNo:
                      type: string
                      description: 请求发起方的商户号。
                    onBehalfOf:
                      type: string
                      description: 代其他商户请求时返回实际业务商户号；为自身请求时省略。
                    requestId:
                      type: string
                      description: 商户生成的付款业务流水号。
                    transferId:
                      type: string
                      description: Onerway 付款编号。
                    status:
                      type: string
                      description: 本次通知的付款状态；退回交易使用
                        RETURNED，取值见[枚举说明](/zh/transfer/api-reference/v3-enums#transactionstatus-付款状态)。
                      enum:
                        - A
                        - P
                        - S
                        - F
                        - RETURNED
                      x-enum-descriptions:
                        A: 已创建
                        P: 处理中
                        S: 成功
                        F: 付款失败
                        RETURNED: 退回
                    payoutStatusReason:
                      type: string
                      description: "付款状态的补充说明。付款失败原因沿用商户可见的原因说明；RETURNED 的原因以 Returned- fail reason:
                        开头。"
                    transactionInfo:
                      type: object
                      properties:
                        sourceCurrency:
                          type: string
                          description: 源币种，参见[币种枚举](/zh/transfer/api-reference/v3-enums#币种枚举)。
                        sourceAmount:
                          type: number
                          description: 商户总扣款金额（含平台手续费），币种为 sourceCurrency。
                        targetCurrency:
                          type: string
                          description: 目标币种，参见[币种枚举](/zh/transfer/api-reference/v3-enums#币种枚举)。
                        targetAmount:
                          type: number
                          description: 付款金额，币种为 targetCurrency；付款结果以 status 为准。
                        exchangeRate:
                          type: number
                          description: 本笔付款记录的汇率。
                        destinationCountry:
                          type: string
                          description: 收款账户所在国家或地区，参见[国家/地区枚举](/zh/transfer/api-reference/v3-enums#国家地区枚举)。
                        paymentMethod:
                          type: string
                          description: 付款方式，参见[枚举说明](/zh/transfer/api-reference/v3-enums#paymentmethod-付款方式)。
                          enum:
                            - BANK_TRANSFER
                            - SWIFT
                            - E_WALLET
                            - CASH_PICKUP
                          x-enum-descriptions:
                            BANK_TRANSFER: 银行转账
                            SWIFT: SWIFT 汇款
                            E_WALLET: 电子钱包
                            CASH_PICKUP: 现金支取
                        transactionPurpose:
                          type: string
                          description: 交易用途，参见[枚举说明](/zh/transfer/api-reference/v3-enums#transactionpurpose-交易用途)。
                          enum:
                            - TRANSFER_TO_OWN_ACCOUNT
                            - LOAN_OR_CREDIT_REPAYMENT
                            - FREIGHT_CHARGES
                            - PROFESSIONAL_OR_BUSINESS_SERVICES
                            - OTHER
                          x-enum-descriptions:
                            TRANSFER_TO_OWN_ACCOUNT: 转至本人账户
                            LOAN_OR_CREDIT_REPAYMENT: 贷款或信贷偿还
                            FREIGHT_CHARGES: 运费
                            PROFESSIONAL_OR_BUSINESS_SERVICES: 专业服务或商业服务
                            OTHER: 其他
                        reference:
                          type: string
                          description: 付款交易附言或备注。
                        serviceFeeAmount:
                          type: number
                          description: 平台手续费，币种为 serviceFeeCurrency。负数表示手续费扣款，保留原始负号。
                        serviceFeeCurrency:
                          type: string
                          description: 平台手续费币种，与 sourceCurrency 一致。
                        chargeBearer:
                          type: string
                          description: 平台手续费承担方，取值见[枚举说明](/zh/transfer/api-reference/v3-enums#chargebearer-平台手续费承担方)。
                          enum:
                            - DEBT
                            - CRED
                          x-enum-descriptions:
                            DEBT: 付款人承担平台手续费
                            CRED: 收款人承担平台手续费
                        swiftFeeType:
                          type: string
                          description: SWIFT
                            费用承担方式，与平台手续费承担方分别设置，取值见[枚举说明](/zh/transfer/api-reference/v3-enums#swiftfeetype-swift-费用承担方式)。
                          enum:
                            - OUR
                            - SHA
                          x-enum-descriptions:
                            OUR: 付款人承担 SWIFT 费用
                            SHA: 双方分担 SWIFT 费用
                      description: 本笔付款的交易信息。
                    beneficiary:
                      type: object
                      properties:
                        beneficiaryId:
                          type: string
                          description: 本笔付款使用的 Onerway 收款人 ID；未取得时省略。
                        entityType:
                          type: string
                          description: 收款人的主体类型，取值见[枚举说明](/zh/transfer/api-reference/v3-enums#entitytype-主体类型)。
                          enum:
                            - INDIVIDUAL
                            - BUSINESS
                          x-enum-descriptions:
                            INDIVIDUAL: 个人
                            BUSINESS: 企业
                        individual:
                          type: object
                          properties:
                            name:
                              type: object
                              properties:
                                firstName:
                                  type: string
                                  description: 收款人的名。
                                lastName:
                                  type: string
                                  description: 收款人的姓。
                              description: 个人姓名
                            identity:
                              type: object
                              properties:
                                idType:
                                  type: string
                                  description: 证件类型
                                idNumber:
                                  type: string
                                  description: 证件号码
                                issuingCountry:
                                  type: string
                                  description: 证件签发国家或地区代码，参见[国家/地区枚举](/zh/transfer/api-reference/v3-enums#国家地区枚举)。
                                expiryDate:
                                  type: string
                                  description: 证件到期日期，格式为 yyyy-MM-dd。
                                issueDate:
                                  type: string
                                  description: 证件签发日期，格式为 yyyy-MM-dd。
                              description: 证件信息
                            dateOfBirth:
                              type: string
                              description: 出生日期，格式为 yyyy-MM-dd。
                          description: 个人主体信息，仅适用于 entityType=INDIVIDUAL。
                        business:
                          type: object
                          properties:
                            companyName:
                              type: string
                              description: 收款人的公司名称。
                            tin:
                              type: string
                              description: 税务识别号
                            registrationNumber:
                              type: string
                              description: 企业注册号
                            registrationDate:
                              type: string
                              description: 企业注册日期，格式为 yyyy-MM-dd。
                          description: 企业主体信息，仅适用于 entityType=BUSINESS。
                        contact:
                          type: object
                          properties:
                            email:
                              type: string
                              description: 收款人的邮箱。
                            mobile:
                              type: object
                              properties:
                                areaCode:
                                  type: string
                                  description: 国际电话区号，包含 +
                                number:
                                  type: string
                                  description: 电话号码，不包含区号
                              description: 手机联系方式
                          description: 联系方式
                        address:
                          type: object
                          properties:
                            countryCode:
                              type: string
                              description: 国家或地区代码，参见[国家/地区枚举](/zh/transfer/api-reference/v3-enums#国家地区枚举)。
                            state:
                              type: string
                              description: 收款人地址所在的省或州。具体规则请参考[收款人字段规则查询](/zh/transfer/api-reference/endpoints/v3-beneficiaries-schema)返回的校验规则。
                            city:
                              type: string
                              description: 收款人地址所在的城市。具体规则请参考[收款人字段规则查询](/zh/transfer/api-reference/endpoints/v3-beneficiaries-schema)返回的校验规则。
                            addressLine1:
                              type: string
                              description: 主要街道地址，通常包含门牌号和街道名称。
                            addressLine2:
                              type: string
                              description: 楼栋、楼层、房间或单元等补充信息。
                            addressLine3:
                              type: string
                              description: 其他必要的地址补充信息。
                            postalCode:
                              type: string
                              description: 收款人地址的邮政编码。
                          description: 收款人的地址信息。
                        account:
                          type: object
                          properties:
                            countryCode:
                              type: string
                              description: 国家或地区代码，参见[国家/地区枚举](/zh/transfer/api-reference/v3-enums#国家地区枚举)。
                            currency:
                              type: string
                              description: 账户币种，参见[币种枚举](/zh/transfer/api-reference/v3-enums#币种枚举)。
                            bankAccount:
                              type: object
                              properties:
                                accountHolderName:
                                  type: string
                                  description: 银行账户持有人名称
                                bankName:
                                  type: string
                                  description: 收款银行名称。
                                accountType:
                                  type: string
                                  description: 银行账户类型，参见[枚举说明](/zh/transfer/api-reference/v3-enums#accounttype-银行账户类型)。
                                  enum:
                                    - CHECKING
                                    - SAVING
                                    - ORDINARY
                                  x-enum-descriptions:
                                    CHECKING: 支票账户
                                    SAVING: 储蓄账户
                                    ORDINARY: 普通账户
                                accountIdentifier:
                                  type: object
                                  properties:
                                    type:
                                      type: string
                                      description: 银行账号标识类型，取值见[枚举说明](/zh/transfer/api-reference/v3-enums#type-银行账号标识类型)。
                                      enum:
                                        - IBAN
                                        - LOCAL_ACCOUNT
                                      x-enum-descriptions:
                                        IBAN: 国际银行账户号码
                                        LOCAL_ACCOUNT: 本地银行账号
                                    value:
                                      type: string
                                      description: IBAN 或本地银行账号，与 type 一致
                                  description: 银行账号及其类型
                                swiftCode:
                                  type: string
                                  description: 收款银行的 SWIFT 代码。
                                routingNumber:
                                  type: string
                                  description: 银行代码或本地清算路由代码，用于识别收款银行或其在当地清算网络中的路由。具体代码类型取决于收款国家：英国使用 Sort
                                    Code，美国使用 ABA Routing Number。
                                branchNumber:
                                  type: string
                                  description: 收款账户所属银行分支机构的代码。
                              description: 银行账户信息
                            walletAccount:
                              type: object
                              properties:
                                walletProvider:
                                  type: string
                                  description: 钱包服务商，参见[钱包服务商](/zh/transfer/api-reference/v3-enums#walletprovider-walletformat-钱包服务商与账号格式)。
                                walletFormat:
                                  type: string
                                  description: 所选 walletProvider
                                    对应的钱包账号格式，参见[钱包账号格式](/zh/transfer/api-reference/v3-enums#walletprovider-walletformat-钱包服务商与账号格式)。
                                walletIdentifier:
                                  type: string
                                  description: 收款人的钱包账号，账号格式取决于 walletProvider 和 walletFormat。
                              description: 电子钱包账户信息
                            cashPickupAccount:
                              type: object
                              properties:
                                pickupBankName:
                                  type: string
                                  description: 现金支取机构名称
                                pickupBranchId:
                                  type: string
                                  description: 领取网点编号
                                pickupBranchName:
                                  type: string
                                  description: 领取网点名称
                                pickupBranchAddress:
                                  type: string
                                  description: 领取网点地址
                              description: 现金支取网点信息
                          description: 收款账户信息
                      description: 本笔付款的收款人信息。
                    createTime:
                      type: string
                      description: 交易创建时间，格式 yyyy-MM-dd HH:mm:ss，北京时间（UTC+8）。
                    updateTime:
                      type: string
                      description: 本次通知状态事件的时间，格式 yyyy-MM-dd HH:mm:ss，北京时间（UTC+8）。
                  description: 付款详情，与 V3 单笔付款查询结果采用相同业务字段结构；状态和 updateTime 对应本次通知事件。
            examples:
              success:
                summary: 付款成功
                value:
                  requestId: "10000001"
                  eventType: transfer.transaction.status.change
                  createdAt: 2026-10-22T10:00:00
                  version: V3
                  data:
                    merchantNo: "800699"
                    requestId: demo_transfer_001
                    transferId: "1000001"
                    status: S
                    payoutStatusReason: ""
                    transactionInfo:
                      sourceCurrency: USD
                      sourceAmount: 100
                      targetCurrency: USD
                      targetAmount: 99
                      exchangeRate: 1
                      destinationCountry: US
                      paymentMethod: BANK_TRANSFER
                      transactionPurpose: TRANSFER_TO_OWN_ACCOUNT
                      reference: demo payment
                      serviceFeeAmount: -1
                      serviceFeeCurrency: USD
                      chargeBearer: DEBT
                    beneficiary:
                      beneficiaryId: "10001"
                      entityType: INDIVIDUAL
                      individual:
                        name:
                          firstName: Example
                          lastName: Recipient
                      contact:
                        email: recipient@example.com
                      address:
                        countryCode: US
                        city: Example City
                        addressLine1: 123 Example Street
                      account:
                        countryCode: US
                        currency: USD
                        bankAccount:
                          accountHolderName: Example Recipient
                          bankName: Example Bank
                          accountIdentifier:
                            type: LOCAL_ACCOUNT
                            value: demo_account_001
                    createTime: 2026-10-19 13:45:10
                    updateTime: 2026-10-22 10:00:00
                x-onerway-headers:
                  Content-Type: application/json;charset=UTF-8
                  x-timestamp: "1792634400"
                  x-signature: replace_with_signature
              failure:
                summary: 付款失败
                value:
                  requestId: "10000002"
                  eventType: transfer.transaction.status.change
                  createdAt: 2026-10-22T10:00:00
                  version: V3
                  data:
                    merchantNo: "800699"
                    requestId: demo_transfer_001
                    transferId: "1000001"
                    status: F
                    payoutStatusReason: Beneficiary account is invalid
                    transactionInfo:
                      sourceCurrency: USD
                      sourceAmount: 100
                      targetCurrency: USD
                      targetAmount: 99
                      exchangeRate: 1
                      destinationCountry: US
                      paymentMethod: BANK_TRANSFER
                      transactionPurpose: TRANSFER_TO_OWN_ACCOUNT
                      reference: demo payment
                      serviceFeeAmount: -1
                      serviceFeeCurrency: USD
                      chargeBearer: DEBT
                    beneficiary:
                      beneficiaryId: "10001"
                      entityType: INDIVIDUAL
                      individual:
                        name:
                          firstName: Example
                          lastName: Recipient
                      contact:
                        email: recipient@example.com
                      address:
                        countryCode: US
                        city: Example City
                        addressLine1: 123 Example Street
                      account:
                        countryCode: US
                        currency: USD
                        bankAccount:
                          accountHolderName: Example Recipient
                          bankName: Example Bank
                          accountIdentifier:
                            type: LOCAL_ACCOUNT
                            value: demo_account_001
                    createTime: 2026-10-19 13:45:10
                    updateTime: 2026-10-22 10:01:00
                x-onerway-headers:
                  Content-Type: application/json;charset=UTF-8
                  x-timestamp: "1792634460"
                  x-signature: replace_with_signature
              returned:
                summary: 付款失败（Returned）
                value:
                  requestId: "10000003"
                  eventType: transfer.transaction.status.change
                  createdAt: 2026-10-23T09:00:00
                  version: V3
                  data:
                    merchantNo: "800699"
                    requestId: demo_transfer_001
                    transferId: "1000001"
                    status: RETURNED
                    payoutStatusReason: Returned- fail reason:Beneficiary account closed
                    transactionInfo:
                      sourceCurrency: USD
                      sourceAmount: 100
                      targetCurrency: USD
                      targetAmount: 99
                      exchangeRate: 1
                      destinationCountry: US
                      paymentMethod: BANK_TRANSFER
                      transactionPurpose: TRANSFER_TO_OWN_ACCOUNT
                      reference: demo payment
                      serviceFeeAmount: -1
                      serviceFeeCurrency: USD
                      chargeBearer: DEBT
                    beneficiary:
                      beneficiaryId: "10001"
                      entityType: INDIVIDUAL
                      individual:
                        name:
                          firstName: Example
                          lastName: Recipient
                      contact:
                        email: recipient@example.com
                      address:
                        countryCode: US
                        city: Example City
                        addressLine1: 123 Example Street
                      account:
                        countryCode: US
                        currency: USD
                        bankAccount:
                          accountHolderName: Example Recipient
                          bankName: Example Bank
                          accountIdentifier:
                            type: LOCAL_ACCOUNT
                            value: demo_account_001
                    createTime: 2026-10-19 13:45:10
                    updateTime: 2026-10-23 09:00:00
                x-onerway-headers:
                  Content-Type: application/json;charset=UTF-8
                  x-timestamp: "1792717200"
                  x-signature: replace_with_signature
      responses:
        "200":
          description: 成功接收并处理通知后返回 HTTP 2xx，例如 HTTP 200。请求异常或非 2xx 响应会被判为通知失败。
      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/transfer/api-reference/v3-payment-notifications
      x-onerway-header-fields:
        - name: x-signature
          schema:
            type: string
            description: Webhook 签名请求头。
        - name: x-timestamp
          schema:
            type: string
            description: Webhook 验证时间戳请求头。
```
