> ## Documentation Index
> Fetch the complete documentation index at: https://developers.uqpay.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Update Bank Account

> 更新现有银行账户。



## OpenAPI

````yaml /zh/global-acquiring/v1.6/payment.yaml post /v2/payment/bankaccount/{id}
openapi: 3.0.2
info:
  title: Payment API
  version: 0.0.1
  x-source-en-commit: 821171b
  x-source-en-path: global-acquiring/v1.6/payment.yaml
  description: >
    UQPAY Payment API 让你接受付款、管理交易，并处理退款与出款。


    ## 功能概览

    - 使用卡、数字钱包和本地支付方式创建并确认 PaymentIntent

    - 处理全额和部分退款

    - 管理客户与已保存的支付方式

    - 创建出款与银行账户记录

    - 查询 PaymentAttempt、余额与交易历史


    ## 身份认证

    所有请求都需要携带有效的鉴权 Token，Token 通过 [Access
    Token](/zh/account-center/v1.6/api-reference/access-token) 接口获取。请在
    `x-auth-token` 请求头中携带该 Token。


    ## 幂等性

    POST 请求支持 `x-idempotency-key` 请求头，可在不重复创建资源的前提下安全重试。
  contact:
    name: UQPAY Support Team
    url: https://www.uqpay.com/support
    email: support@uqpay.com
  license:
    name: Proprietary
    url: https://www.uqpay.com/legal/api-terms
  termsOfService: https://www.uqpay.com/legal/terms
servers:
  - url: https://api-sandbox.uqpaytech.com/api
    description: 沙盒环境基础 URL。
  - url: https://api.uqpay.com/api
    description: 生产环境基础 URL。
security:
  - XAuthToken: []
tags:
  - name: Customers
    description: 创建和管理客户档案。客户对象保存支付方式和账单信息，可在多笔支付中复用。
  - name: Payment Intents
    description: >-
      PaymentIntent 引导你完成向客户收款的整个流程。建议你的系统中每个订单或客户会话只创建一个 PaymentIntent。之后可以引用该
      PaymentIntent，查看某次会话的 PaymentAttempt 历史。
  - name: Payment Attempts
    description: >-
      每当客户使用所选 PaymentMethod 付款时，都会创建一个 PaymentAttempt 对象。通过该 API
      可以了解客户是如何为订单付款的。
  - name: Payment Refunds
    description: >
      你可以创建多笔部分退款，直至累计达到原交易金额。每笔退款都会生成唯一记录，并自动校验可用余额。

      PaymentIntent 引导你完成向客户收款的整个流程。建议你的系统中每个订单或客户会话只创建一个 PaymentIntent。之后可以引用该
      PaymentIntent，查看某次会话的 PaymentAttempt 历史。
  - name: Payment Balances
    description: |
      支付余额管理让你查询不同币种的账户余额。你可以查询单个币种的余额，也可以分页查询所有币种的余额。
  - name: Payment Payouts
    description: |
      出款管理让你创建和管理用于资金划转的出款单。你可以创建出款、查询单笔出款，也可以分页并按条件筛选列出所有出款。
  - name: Terminal Management
    description: 用于 POS 设备注册和密钥管理的终端管理 API。
  - name: Bank Accounts
    description: |
      用于结算账户的银行账户管理 API。可创建、更新、查询和列出用于接收结算款项的银行账户。
paths:
  /v2/payment/bankaccount/{id}:
    post:
      tags:
        - Bank Accounts
      summary: Update Bank Account
      description: 更新现有银行账户。
      operationId: update-bank-account
      parameters:
        - $ref: '#/components/parameters/XOnBehalfOf'
        - $ref: '#/components/parameters/XIdempotencyKey'
        - $ref: '#/components/parameters/BankAccountId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BankAccountUpdateRequest'
      responses:
        '200':
          description: 成功更新银行账户
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BankAccountResponse'
components:
  parameters:
    XOnBehalfOf:
      in: header
      name: x-on-behalf-of
      schema:
        type: string
      required: false
      description: >
        指定代表哪个子账户发起该请求。应设置为 `account_id`，可通过 [List Connected
        Accounts](/zh/account-center/v1.6/api-reference/list-connected-accounts)
        获取。若省略或为空，则使用主账户执行请求。

        更多信息见 [Connected
        Accounts](/zh/account-center/v1.6/guide/connected-accounts)。
      example: 18523f72-f4de-4f9c-bb8e-ec7d1c4f32be
    XIdempotencyKey:
      in: header
      name: x-idempotency-key
      schema:
        type: string
        format: uuid
      required: true
      description: 用于保持操作幂等性的唯一标识符（UUID），确保同一操作重复执行不会产生意外影响或重复结果。它有助于在网络错误、重试或故障时保持数据一致性。
      example: 2adesf8e-9d63-44bc-b975-9b6ae3440dde
    BankAccountId:
      name: id
      in: path
      required: true
      description: 银行账户的唯一标识符（UUID）。
      schema:
        type: string
        format: uuid
        example: a7b92a19-bfc3-4c8b-8a4f-cfcf74cab345
  schemas:
    BankAccountUpdateRequest:
      type: object
      required:
        - account_number
        - bank_name
        - swift_code
        - bank_country_code
        - bank_address
      allOf:
        - $ref: '#/components/schemas/BankAccountBase'
    BankAccountResponse:
      type: object
      allOf:
        - $ref: '#/components/schemas/BankAccountBase'
        - type: object
          properties:
            id:
              type: string
              description: 银行账户的唯一标识符（UUID）。
              example: a7b92a19-bfc3-4c8b-8a4f-cfcf74cab345
            account_name:
              type: string
              description: 账户持有人姓名。
              example: UQPAY PTE. LTD.
            currency:
              $ref: '#/components/schemas/Currency'
              description: 结算账户的币种。
              example: SGD
            account_status:
              $ref: '#/components/schemas/BankAccountStatus'
    BankAccountBase:
      type: object
      description: 请求与响应之间共享的通用银行账户属性。
      properties:
        account_number:
          type: string
          description: 银行账号（例如 IBAN）。
          example: GB71950018692652646598
          maxLength: 60
          minLength: 5
        bank_name:
          type: string
          description: 银行名称。
          example: DBS Bank
        swift_code:
          type: string
          description: 银行的 SWIFT/BIC 代码。
          example: DBSSSGSG
          maxLength: 11
          minLength: 8
        bank_country_code:
          type: string
          description: 银行所在国家的两字母代码（ISO 3166-1 alpha-2）。
          minLength: 2
          maxLength: 2
          example: SG
          format: iso-3166-1-alpha-2
        bank_address:
          type: string
          description: 银行的实际地址。
          example: 12 Marina Boulevard, Singapore 018982
        bank_code_type:
          $ref: '#/components/schemas/BankCodeType'
        bank_code_value:
          type: string
          description: |
            银行标识值。所需格式取决于所选的
            `bank_code_type`。

            各 `bank_code_type` 接受的格式：
              - `aba`：恰好 9 位数字。
              - `bank_code`：恰好 3 位数字。
              - `sort_code`：恰好 6 位数字。
              - `bsb_code`：恰好 6 位数字。
              - `ifsc`：恰好 11 个字符，格式为：
                  - 前 4 个字符：字母（A–Z）
                  - 第 5 个字符：数字 0
                  - 后 6 个字符：字母（A–Z）或数字（0–9）
              - `cnaps_number`：恰好 12 位数字。
          example: '021000021'
        bank_branch_code:
          type: string
          description: 银行分行代码。当 currency = "CAD" 时必填。
          example: '00001'
    Currency:
      type: string
      description: 三位币种代码
    BankAccountStatus:
      type: string
      description: |
        银行账户的状态。

        - `Valid`：银行账户有效，可用于结算。
        - `Invalid`：银行账户无效，不可用于结算。
      enum:
        - Valid
        - Invalid
      example: Valid
    BankCodeType:
      type: string
      description: |
        银行路由代码的类型。根据币种和国家要求填写：
        - `aba` - 当 currency = "USD" 且 bank_country_code = "US" 时必填
        - `bank_code` - 当 currency = "CAD" 或 currency = "HKD" 时必填
        - `sort_code` - 当 currency = "GBP" 时必填
        - `bsb_code` - 当 currency = "AUD" 时必填
        - `ifsc` - 当 currency = "INR" 时必填
        - `cnaps_number` - 当 currency = "CNH" 且 bank_country_code = "CN" 时必填
      enum:
        - aba
        - bank_code
        - sort_code
        - bsb_code
        - ifsc
        - cnaps_number
      example: aba
  securitySchemes:
    XAuthToken:
      type: apiKey
      in: header
      name: x-auth-token
      description: UQPay 提供的登录 API Token。

````