# 查询已保存 token

> 查询商户客户名下已保存的卡 token 或订阅 token。

```yaml
openapi: 3.1.0
x-onerway-docs-version: v2
x-onerway-spec-key: payments/versions/v2/tokenization/list-saved-tokens
info:
  title: 查询已保存 token
  version: v2
  description: 查询商户客户名下已保存的卡 token 或订阅 token。
servers:
  - url: https://sandbox-payment-api.onerway.com
    description: sandbox
  - url: https://payment-api.onerway.com
    description: production
paths:
  /v1/txn/queryTokenList:
    post:
      summary: 查询已保存 token
      description: 查询商户客户名下已保存的卡 token 或订阅 token。
      parameters:
        - name: ApiKey
          in: header
          required: true
          description: 商户账户的 API Key，通过 `ApiKey`
            请求头传入。详见[请求认证](/zh/payments/versions/v2/get-started/authentication)。
          schema:
            type: string
            description: 商户账户的 API Key，通过 `ApiKey`
              请求头传入。详见[请求认证](/zh/payments/versions/v2/get-started/authentication)。
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                merchantNo:
                  type: string
                  description: Onerway 创建商户账户时分配的商户号。
                appId:
                  type: string
                  description: 商户应用 ID；不传时查询该商户号下所有已保存 token，传入时仅查询指定 `appId` 下的已保存 token。
                merchantCustId:
                  type: string
                  description: 客户在商户系统中的唯一标识，用于限定要查询的客户 token。
                subProductType:
                  type: string
                  description: 要查询的 token 类型；不传时按已保存卡 token 查询，查询订阅 token 时传 `SUBSCRIBE`。
                  enum:
                    - TOKEN
                    - SUBSCRIBE
                  x-enum-descriptions:
                    TOKEN: 已保存卡 token 查询。
                    SUBSCRIBE: 订阅 token 查询。
              required:
                - merchantNo
                - merchantCustId
            examples:
              list-saved-card-tokens:
                summary: 查询已保存卡 token
                value:
                  merchantCustId: cust_demo_token_202606150001
                  merchantNo: replace_with_merchant_no
                  subProductType: TOKEN
      responses:
        "200":
          description: Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  respCode:
                    type: string
                    description: 响应码；`20000` 表示查询请求处理成功，不代表一定查到 token
                      明细；其余为错误码。完整码表见[响应码](/zh/payments/versions/v2/api-reference/response-codes)。
                  respMsg:
                    type: string
                    description: 响应码对应的可读说明。
                  data:
                    type: object
                    properties:
                      merchantNo:
                        type: string
                        description: Onerway 分配的商户号，对应本次查询结果所属商户。
                      tokenInfos:
                        type: array
                        description: token 明细列表，承载符合查询条件的已保存卡 token 或订阅 token。Onerway 为每份订阅合约分别生成订阅
                          token，即使这些合约使用同一张卡。
                        items:
                          type: object
                          properties:
                            id:
                              type: string
                              description: 绑定信息 ID；调用[删除卡
                                token](/zh/payments/versions/v2/api-reference/endpoints/delete-card-token)时作为
                                `id` 提交。
                            tokenId:
                              type: string
                              description: token 令牌 ID，用于后续 token 支付或订阅相关操作的关联；该值不同于绑定记录 `id`。
                            appId:
                              type: string
                              description: token 所属商户应用 ID。
                            cardNumber:
                              type: string
                              description: 脱敏卡号，仅保留前 6 位和后 4 位，中间位掩码。
                            paymentMethod:
                              type: string
                              description: 具体支付方式，涵盖卡品牌或本地支付方式类型。
                            cardBinCountry:
                              type: string
                              description: 卡 BIN 所属国家或地区代码。
                            year:
                              type: string
                              description: 卡片有效期年份。
                            month:
                              type: string
                              description: 卡片有效期月份。
                        x-onerway-value:
                          empty: true
                          when:
                            en: Returns an empty array `[]` when no token matches the query conditions. The
                              field is not `null` and is not omitted.
                            zh: 没有符合条件的 token 时返回空数组 `[]`，不是 `null`，也不是省略字段。
                    description: 业务数据对象，承载商户号与 token 明细列表。
      security:
        - apiKeyAuth:
            []
components:
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: ApiKey
```
