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

# 查询支付方式

> 根据支付方式 ID 查询支付方式详情。



## OpenAPI

````yaml /zh/api/openapi.json get /api/v1/payment_method/{payment_method_id}
openapi: 3.1.0
info:
  title: StablePay 支付 API
  version: '2026-03-31'
  summary: 支付会话和支付方式查询 API。
  description: >-
    StablePay 支付 API 的 OpenAPI 规范。


    说明：

    - 基础 URL：https://api.stablepay.co

    - 认证方式：Bearer API Key + `X-StablePay-Timestamp` + `X-StablePay-Nonce` +
    `X-StablePay-Signature`

    - 签名字符串：`{timestamp}.{nonce}.{requestBody}`

    - 签名算法：HMAC-SHA256，小写 hex

    - GET 请求的 `requestBody` 为空字符串。
servers:
  - url: https://api.stablepay.co
    description: 生产环境
security:
  - bearerAuth: []
    stablepayTimestamp: []
    stablepayNonce: []
    stablepaySignature: []
tags:
  - name: 支付会话
    description: 创建、查询和取消支付会话。
  - name: 支付方式
    description: 查询支付方式。
paths:
  /api/v1/payment_method/{payment_method_id}:
    get:
      tags:
        - 支付方式
      summary: 查询支付方式
      description: 根据支付方式 ID 查询支付方式详情。
      operationId: getPaymentMethod
      parameters:
        - $ref: '#/components/parameters/PaymentMethodId'
        - $ref: '#/components/parameters/XStablePayTimestamp'
        - $ref: '#/components/parameters/XStablePayNonce'
        - $ref: '#/components/parameters/XStablePaySignature'
      responses:
        '200':
          description: 查询成功。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaymentMethod'
        '400':
          description: 请求参数错误。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: 认证失败。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: 支付方式不存在。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: 服务器错误。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  parameters:
    PaymentMethodId:
      name: payment_method_id
      in: path
      required: true
      description: 支付方式 ID。
      schema:
        type: string
    XStablePayTimestamp:
      name: X-StablePay-Timestamp
      in: header
      required: true
      description: Unix 时间戳（秒）。必须与服务端时间相差不超过 5 分钟。
      schema:
        type: string
      example: '1735689600'
    XStablePayNonce:
      name: X-StablePay-Nonce
      in: header
      required: true
      description: 防重放随机字符串，长度 16-64 个字符，建议每次请求使用新的 UUID。
      schema:
        type: string
        minLength: 16
        maxLength: 64
      example: 550e8400-e29b-41d4-a716-446655440000
    XStablePaySignature:
      name: X-StablePay-Signature
      in: header
      required: true
      description: >-
        使用商户 API Secret 对 `{timestamp}.{nonce}.{requestBody}` 计算
        HMAC-SHA256，结果为小写 hex。GET 请求的 `requestBody` 为空字符串。
      schema:
        type: string
      example: a1b2c3d4e5f6...
  schemas:
    PaymentMethod:
      type: object
      required:
        - id
        - customer_id
        - merchant_id
        - type
        - address
        - status
        - created_at
        - updated_at
      properties:
        id:
          type: string
          description: 支付方式 ID。
        customer_id:
          type: string
          description: 客户 ID。
        merchant_id:
          type: string
          description: 商户 ID。
        type:
          type: string
          description: 支付方式类型，当前通常为 `crypto`。
        address:
          type: string
          description: 付款地址。当前实现返回空字符串。
        status:
          type: string
          enum:
            - active
            - inactive
            - revoked
            - unknown
          description: 支付方式状态。
        metadata:
          type: object
          additionalProperties: true
          description: 支付方式元数据。
        created_at:
          type: integer
          format: int64
          description: 创建时间，Unix 秒。
        updated_at:
          type: integer
          format: int64
          description: 更新时间，Unix 秒。
    ErrorResponse:
      type: object
      description: 错误响应。
      properties:
        error:
          type: object
          properties:
            type:
              type: string
              description: 错误类型。
            code:
              type: string
              description: 错误代码。
            message:
              type: string
              description: 错误信息。
            param:
              type: string
              description: 相关参数。
            doc_url:
              type: string
              description: 错误文档链接。
            decline_code:
              type: string
              description: 拒绝代码。
            request_log_url:
              type: string
              description: 请求日志链接。
            charge:
              type: string
              description: 相关支付 ID。
        request_id:
          type: string
          description: 请求 ID。
        timestamp:
          type: integer
          format: int64
          description: 错误发生时间，Unix 秒。
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: Bearer API Key，例如 `Bearer sk_live_xxx`。
    stablepayTimestamp:
      type: apiKey
      in: header
      name: X-StablePay-Timestamp
      description: Unix 时间戳（秒）。必须与服务端时间相差不超过 5 分钟。
    stablepayNonce:
      type: apiKey
      in: header
      name: X-StablePay-Nonce
      description: 防重放随机字符串，长度 16-64 个字符，建议每次请求使用新的 UUID。
    stablepaySignature:
      type: apiKey
      in: header
      name: X-StablePay-Signature
      description: >-
        使用商户 API Secret 对 `{timestamp}.{nonce}.{requestBody}` 计算
        HMAC-SHA256，结果为小写 hex。GET 请求的 `requestBody` 为空字符串。

````