# Query subscription

Endpoint: GET /subscription
Version: 2.0.0
Security: Ed25519

## Security:

  - `Ed25519` (unknown)
    apiKey in header Authorization

## Query parameters:

  - `merchant_sub_id` (string, required)
    商户订阅ID

## Header parameters:

  - `X-API-Key-ID` (string, required)
    32-character Base58 credential ID returned after public-key registration.

  - `X-API-Timestamp` (string, required)
    Unix timestamp in seconds; tolerance is ±300 seconds.

  - `X-API-Nonce` (string, required)
    16 cryptographically random bytes encoded as unpadded Base64URL; fresh on every attempt.

  - `Digest` (string, required)
    SHA-256= followed by standard padded Base64 of SHA-256 of exact request body bytes. Required even for an empty body; included in the signing string.

  - `Authorization` (string, required)
    Use `Ed25519 signature="BASE64_SIGNATURE"`, where BASE64_SIGNATURE is the standard padded Base64 signature. See /docs/en/4-authorization for the exact signing string.

## Response 200 fields (application/json):

  - `subscription_id` (string)
    系统订阅ID

  - `merchant_sub_id` (string)
    商户订阅ID

  - `plan_name` (string)
    计划名称

  - `trigger_method` (string)
    触发方式

  - `status` (string)
    订阅状态

  - `cancel_reason` (string)
    取消原因

  - `canceled_at` (integer)
    取消时间 (unix timestamp)

  - `currency` (string)
    币种

  - `first_amount` (string)
    首期金额

  - `amount` (string)
    后续每期金额

  - `interval_unit` (string)
    周期单位

  - `interval_count` (integer)
    周期数量

  - `current_period_start` (integer)
    当前周期开始 (unix timestamp)

  - `current_period_end` (integer)
    当前周期结束 (unix timestamp)

  - `subscription_end_at` (integer)
    订阅终止时间 (unix timestamp)

  - `next_invoice_at` (integer)
    下次发送 Invoice 时间 (unix timestamp)

  - `payer_email` (string)
    付款人邮箱

  - `created_at` (integer)
    创建时间 (unix timestamp)

  - `updated_at` (integer)
    更新时间 (unix timestamp)

## Response 401:

  - `401` (unknown)
    Authentication failed: invalid/disabled credential, signature, timestamp, nonce or digest.

## Response 403:

  - `403` (unknown)
    Authenticated credential lacks permission or the client IP is not allowed.

