> ## 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.

# 获取 BIN 信息

验证银行识别号码（BIN），以检查银行卡的有效性并获取发卡机构、卡品牌、卡类型和国家等关键信息。使用此校验可避免因银行卡信息无效而导致支付失败。

> **请注意**
>
> 响应中的 `countryCode `采用 ISO-3166-1 Alpha-2 格式。在将该值提交给我们系统中的其他 endpoint 之前，请务必将其转换为 ISO-3166-1 Alpha-3 标准。


## OpenAPI

````yaml openapi/zh/localpayment.json GET /api/resources/bin-validation
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/resources/bin-validation:
    get:
      summary: 获取 BIN 信息
      operationId: get-bin-info
      parameters:
        - name: Authorization
          in: header
          description: >-
            用于身份验证的 Bearer
            访问令牌。该令牌可从[获取访问令牌](/zh/reference/get-token)或[刷新访问令牌](/zh/reference/refresh-token)endpoint
            获取。
          required: true
          schema:
            type: string
        - name: bin
          in: query
          description: 银行识别号码。
          required: true
          schema:
            type: string
            examples:
              - '400000'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  bin:
                    type: string
                    description: 银行识别号码。
                  bank:
                    type: string
                    description: 银行卡的发卡银行。
                  card:
                    type: string
                    description: 卡支付网络。
                  type:
                    type: string
                    enum:
                      - CREDIT
                      - DEBIT
                    description: 卡片类型。
                  level:
                    type: string
                    description: 卡片等级。
                  country:
                    type: string
                    description: 国家/地区名称。
                  CountryCode:
                    type: string
                    title: CountryCode
                    description: 国家/地区代码。ISO 3166-1 alpha-2。
                  website:
                    type: string
                    description: 发卡方的网站。
                  phone:
                    type: string
                    description: 发卡方的电话号码。
                  valid:
                    type: boolean
                    description: 指示所提供的 BIN 是否有效。
                required:
                  - bin
                  - bank
                  - card
                  - type
                  - level
                  - country
                  - CountryCode
                  - website
                  - phone
                  - valid
                x-examples:
                  Example 1:
                    bin: '424242'
                    bank: ''
                    card: VISA
                    type: CREDIT
                    level: ''
                    country: United Kingdom of Great Britain and Northern Ireland
                    countryCode: GB
                    website: ''
                    phone: ''
                    valid: true
              examples:
                200 - BIN info.:
                  value:
                    bin: '40000000'
                    bank: INTL HDQTRS-CENTER OWNED
                    card: VISA
                    type: CREDIT
                    level: TRADITIONAL
                    country: United States of America
                    countryCode: US
                    website: ''
                    phone: ''
                    valid: true
        '400':
          description: 错误的请求。
          content:
            application/json:
              schema:
                type: object
                properties:
                  bin:
                    type: string
                    description: 银行识别号码。
                  valid:
                    type: boolean
                    description: 指示所提供的 BIN 是否有效。
                  error:
                    type: string
                    description: 错误消息。
                  message:
                    type: string
                    description: 其他错误信息。
                required:
                  - bin
                  - valid
                  - error
                  - message
                x-examples:
                  Example 1:
                    bin: '40000'
                    valid: false
                    error: bincheck.io error
                    message: The BIN number is less than 6 digits.
              examples:
                400 - BIN length error.:
                  value:
                    bin: '40000'
                    valid: false
                    error: bincheck.io error
                    message: The BIN number is less than 6 digits.
                1011 - Invalid BIN:
                  value:
                    bin: 40000-3
                    valid: false
                    error: '1011'
                    message: Invalid BIN
        '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
      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.