# 删除收款人

> 删除当前操作商户下的指定收款人，返回编号及 deleted 状态。

```yaml
openapi: 3.1.0
x-onerway-docs-version: original
x-onerway-spec-key: transfer/v3-beneficiaries/remove
info:
  title: 删除收款人
  version: original
  description: 删除当前操作商户下的指定收款人，返回编号及 deleted 状态。
servers:
  - url: https://sandbox-transfer-api.onerway.com
    description: sandbox
  - url: https://transfer-api.onerway.com
    description: production
paths:
  /api/v3/beneficiary/remove:
    post:
      summary: 删除收款人
      description: 删除当前操作商户下的指定收款人，返回编号及 deleted 状态。
      parameters:
        - name: ApiKey
          in: header
          required: true
          description: Onerway 分配的账户服务 API key 请求 Header；必须使用与请求域名相同环境的值。
          schema:
            type: string
            description: Onerway 分配的账户服务 API key 请求 Header；必须使用与请求域名相同环境的值。
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                beneficiaryId:
                  type: integer
                  description: Onerway 收款人 ID（64 位整数）。
                  x-onerway-constraints:
                    - kind: rule
                      text: beneficiaryId 必填，须存在、属于当前操作商户且未删除。重复删除不会承诺幂等成功。
                    - kind: rule
                      text: 有关联的 A（已创建）或 P（处理中）付款时不可删除，请先处理关联付款。
                onBehalfOf:
                  type: string
                  description: 请求实际对应的商户号，仅在代其他商户发起请求时填写。
              required:
                - beneficiaryId
            examples:
              default:
                summary: 请求结构示例（替换为当前商户数据）
                value:
                  beneficiaryId: 10001
      responses:
        "200":
          description: 成功示例
          content:
            application/json:
              schema:
                anyOf:
                  - type: object
                    properties:
                      respCode:
                        type: string
                        description: 响应码；`20000` 表示请求处理成功，其余为错误码。
                      respMsg:
                        type: string
                        description: 响应码对应的可读说明。
                      data:
                        type: object
                        properties:
                          beneficiaryId:
                            type: string
                            description: Onerway 收款人 ID。
                          status:
                            type: string
                            description: 收款人状态，参见[收款人状态](/zh/transfer/api-reference/v3-enums#beneficiarystatus-收款人状态)。
                            enum:
                              - deleted
                            x-enum-descriptions:
                              deleted: 已删除
                        description: 成功业务数据；失败不作为有效业务数据读取
                        x-onerway-constraints:
                          - kind: rule
                            text: 成功返回 status=deleted。已删除收款人的详情查询和再次编辑将无法按有效收款人读取；删除不撤销历史付款。
                      error:
                        type: object
                        properties:
                          type:
                            type: string
                            description: 错误类型。
                          code:
                            type: string
                            description: 本接口错误标识。
                          declineCode:
                            type: string
                            description: 拒绝原因码，可能为空。
                          message:
                            type: string
                            description: 错误详细说明
                          param:
                            type: string
                            description: 失败字段或条件；无法定位时可能为空
                          docUrl:
                            type: string
                            description: 错误文档链接，可能为空。
                          requestId:
                            type: string
                            description: 服务端错误跟踪标识，req_ + 32 位十六进制字符；不是商户请求编号
                          errorDetails:
                            type: array
                            description: 具体错误明细；见下列分支
                            items:
                              type: object
                              properties:
                                errorCode:
                                  type: string
                                  description: 业务或校验明细码。
                                message:
                                  type: string
                                  description: 明细说明
                        description: 结构化失败信息；并非每个失败分支都有该字段
                  - type: object
                    properties:
                      respCode:
                        type: string
                      respMsg:
                        type: string
                      error:
                        type: object
                        properties:
                          type:
                            type: string
                          code:
                            type: string
                          message:
                            type: string
                          requestId:
                            type: string
                          errorDetails:
                            type: array
                            items:
                              type: object
                              properties:
                                errorCode:
                                  type: string
                                message:
                                  type: string
                              required:
                                - errorCode
                                - message
                        required:
                          - type
                          - code
                          - message
                          - requestId
                          - errorDetails
                    required:
                      - respCode
                      - respMsg
                      - error
              examples:
                "50112":
                  summary: 编号不存在、不属于当前商户或已删除。
                  description: 编号不存在、不属于当前商户或已删除。
                  value:
                    respCode: "50112"
                    respMsg: beneficiaryId invalid
                    error:
                      type: business_error
                      code: cl1048
                      message: beneficiaryId invalid
                      requestId: req_00000000000000000000000000000001
                      errorDetails:
                        - errorCode: cl1048
                          message: beneficiaryId invalid
                success:
                  summary: 成功示例
                  value:
                    respCode: "20000"
                    respMsg: Success
                    data:
                      beneficiaryId: "10001"
                      status: deleted
                failure:
                  summary: 编号不存在、不属于当前商户或已删除。
                  value:
                    respCode: "50112"
                    respMsg: beneficiaryId invalid
                    error:
                      type: business_error
                      code: cl1048
                      message: beneficiaryId invalid
                      requestId: req_00000000000000000000000000000001
                      errorDetails:
                        - errorCode: cl1048
                          message: beneficiaryId invalid
```
