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

# 验证银行账户

通过根据特定国家/地区的规则验证银行账户格式，防止交易失败。此接口可在发起转账前确保准确性。


## OpenAPI

````yaml openapi/zh/localpayment.json POST /api/validation/bank
openapi: 3.1.0
info:
  version: '1.0'
  title: Localpayment
  contact:
    name: Support
    url: mailto:support@localpayment.com
servers:
  - url: https://api.stage.localpayment.com
    description: Stage
security:
  - token: []
paths:
  /api/validation/bank:
    post:
      summary: 验证银行账户
      operationId: validate-bank-account
      parameters:
        - name: Authorization
          in: header
          description: >-
            用于身份验证的 Bearer
            访问令牌。该令牌可从[获取访问令牌](/zh/reference/get-token)或[刷新访问令牌](/zh/reference/refresh-token)endpoint
            获取。
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                country:
                  type: string
                  enum:
                    - ARG
                    - BOL
                    - BRA
                    - CHL
                    - COL
                    - CRI
                    - DOM
                    - GTM
                    - HND
                    - MEX
                    - PAN
                    - PRY
                    - PER
                  description: '[文件国家](/zh/docs/global-coverage)。ISO 3166-1 alpha-3。'
                bank:
                  type: object
                  description: 银行信息。
                  properties:
                    code:
                      type: string
                      description: '[银行代码](/zh/reference/get-bank-codes)。'
                      examples:
                        - '000'
                    account:
                      type: object
                      description: 需要验证的银行账户信息。
                      properties:
                        number:
                          type: string
                          description: 银行账号。
                        type:
                          type: string
                          enum:
                            - C
                            - S
                            - M
                            - V
                            - R
                            - D
                            - P
                          description: |-
                            [银行账户类型](/zh/reference/validate-bank-account)。

                            * `C`：支票账户
                            * `S`：储蓄账户
                            * `M`：主账户
                            * `V`：VISA 账户
                            * `R`：RUT
                            * `D`：借记
                            * `P`：手机
                      required:
                        - number
                        - type
                    branch:
                      type: object
                      description: 仅适用于巴西银行账户。
                      properties:
                        code:
                          type: string
                          description: 分行代码的格式[因银行而异](/zh/reference/get-bank-codes)。
                  required:
                    - code
                    - account
              required:
                - country
                - bank
              x-examples:
                Example 1:
                  country: ARG
                  bank:
                    code: '426'
                    account:
                      number: '4260004000100091408081'
                      type: s
            examples:
              200 - Valid bank code and account number.:
                value:
                  country: ARG
                  bank:
                    code: '191'
                    account:
                      number: '1910119655111901676653'
                      type: S
              200 - Brazil bank account validation:
                value:
                  country: BRA
                  bank:
                    code: '341'
                    branch:
                      code: '6393'
                    account:
                      number: '217309'
                      type: S
              501 - Country not found.:
                value:
                  country: AR
                  bank:
                    code: '191'
                    account:
                      number: '1910119655111901676653'
                      type: s
              400 - Invalid bank account number.:
                value:
                  country: ARG
                  bank:
                    code: '191'
                    account:
                      number: '9910119655111901676653'
                      type: S
              701 - Bank code not found.:
                value:
                  country: ARG
                  bank:
                    code: '19'
                    account:
                      number: '1910119655111901676653'
                      type: S
              701 - InvalidAccountNumber does not exist.:
                value:
                  country: ARG
                  bank:
                    code: '191'
                    account:
                      type: S
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    description: 状态码。
                  description:
                    type: string
                    description: 更多回复详情。
              examples:
                200 - Valid bank code and account number.:
                  value:
                    code: '200'
                    description: Valid bank code and account number
        '400':
          description: 错误的请求。
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    description: 状态码。
                  description:
                    type: string
                    description: 更多回复详情。
              examples:
                701 - Invalid bank branch code:
                  value:
                    code: '701'
                    description: Invalid bank branch code
        '401':
          description: 未经授权。
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    description: 回复的补充信息。
                  code:
                    type: string
                    description: 状态码。
                  messages:
                    type: array
                    description: 消息列表。
                    items:
                      type: object
                      properties:
                        token_class:
                          type: string
                          description: Token 类。
                        token_type:
                          type: string
                          description: 令牌类型。
                        message:
                          type: string
                          description: 包含补充信息的消息。
                x-examples:
                  Example 1:
                    detail: Given token not valid for any token type
                    code: token_not_valid
                    messages:
                      - token_class: AccessToken
                        token_type: access
                        message: Token is invalid or expired
              examples:
                401 - Token is invalid or expired:
                  value:
                    detail: Given token not valid for any token type
                    code: token_not_valid
                    messages:
                      - token_class: AccessToken
                        token_type: access
                        message: Token is invalid or expired
        '501':
          description: 未实施
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    description: 状态码。
                  description:
                    type: string
                    description: 更多回复详情。
              examples:
                501 - Country not found.:
                  value:
                    code: '501'
                    description: Country not found
      security:
        - token: []
      servers:
        - url: https://api.stage.localpayment.com
          description: Stage
components:
  securitySchemes:
    token:
      type: http
      scheme: bearer

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.