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

> ## Agent Instructions
> Test in the sandbox first: base URL https://api-sandbox.y.uno (Test Mode in the Dashboard). Production is https://api.y.uno (Live Mode).
> Every API request needs the public-api-key and private-secret-key headers. Get them in the Dashboard at https://dashboard.y.uno/developers (Developers > Credentials); sandbox and production keys are different.
> Send an X-Idempotency-Key (a UUID) when creating payments, refunds and cancels, so retries do not create duplicates.
> Start with the Quickstart (https://docs.y.uno/docs/quickstart.md) and the agent guide (https://docs.y.uno/agents.md). To search these docs from a coding agent, connect the docs MCP server at https://docs.y.uno/mcp.

# 暂停订阅

> 暂停有效的订阅，之后可以恢复或取消该订阅。

调用此 endpoint 会将订阅的 `status` 更改为 PAUSED。此状态之后可以更改为 ACTIVE 或 CANCELED。

## 暂停一段设定的时间

默认情况下，暂停没有结束时间：订阅会保持 `PAUSED` 状态，直到您恢复它。发送带有时长的请求体会提前安排恢复时间，到达该时刻时订阅会自动恢复。

通过以下两种方式之一指定时长，不能同时使用两种方式：

* `pause_cycles`：1 到 3 之间的整数，从暂停时刻起按订阅自身的频率计算。
* `pause_until`：一个 RFC 3339 时间点。它必须是将来的时间，并且如果订阅设有 `availability.finish_at`，则必须早于该时间。

`billing_cycle_behavior` 为可选字段，用于决定订阅恢复时的计费日期，`KEEP`/`RESTART` 的含义与 [恢复订阅](https://docs.y.uno/zh-hans/reference/subscriptions/resume-subscription.md#keep-and-restart-compared) 中的相同：`KEEP`（默认值）保留原计费日期，`RESTART` 从恢复时刻重新锚定。发送该字段但不发送 `pause_cycles` 或 `pause_until` 也会被接受：这是一个没有结束时间的暂停，只会记录该行为，供之后恢复订阅时使用。

`reason` 是一个可选的自由格式字符串，最多 255 个字符，存储在订阅的 `reason` 字段中。之后对该订阅执行 `GET` 会返回该值，并且该值会一直保留，直到被其他操作覆盖，例如发送了自己的 `reason` 的恢复操作。

```json Pause for two cycles theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
{ "pause_cycles": 2 }
```

```json Pause until a date theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
{ "pause_until": "2026-09-22T15:47:04.964Z" }
```

```json Pause and re-anchor on resume theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
{ "pause_cycles": 1, "billing_cycle_behavior": "RESTART" }
```

```json Pause with a reason theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
{ "pause_cycles": 1, "reason": "customer requested a break" }
```

`pause_cycles` 只在暂停时刻解析一次：解析得到的时间点等于暂停时刻加上 `pause_cycles` × 订阅的频率。此后只要订阅仍处于暂停状态，每次读取时订阅都会以 `pause_until` 的形式携带该时间点，因此以周期指定的暂停和以日期指定的暂停之后无法区分。例如，对于在 `2026-09-15T15:54:18Z` 暂停的月度订阅，`{ "pause_cycles": 1 }` 会解析为 `pause_until: "2026-10-15T15:54:22.780166Z"`。

### 暂停期间以及恢复时会发生什么

暂停期间不会对任何周期收费。在时长计时期间，每次读取订阅时都会携带 `pause_until`；订阅会在该时间点后约一分钟内自动恢复到暂停前的计费状态，并且您会收到携带 `resume_reason: SCHEDULED` 的 `subscription.resume` webhook。在该时间点之前手动恢复会取消此预定恢复：您可以随时自行调用 [恢复订阅](https://docs.y.uno/zh-hans/reference/subscriptions/resume-subscription.md) 提前结束暂停。如果自动恢复在多次重试后仍无法完成，订阅将保持 `PAUSED` 状态，并改为发送 [`subscription.auto_resume_failed`](https://docs.y.uno/zh-hans/docs/webhooks/object-and-examples#subscription-auto_resume_failed) 事件。

> [!NOTE]
>
> **可用性**
>
> 按设定时间暂停以及 `reason` 字段仅适用于已启用该功能的组织；请联系 Yuno。

### 错误

| HTTP | `code` | 触发条件 |
| - | - | - |
| `400` | `BAD_REQUEST` | 同时发送了 `pause_cycles` 和 `pause_until`：`"pause_cycles cannot be combined with pause_until."` |
| `400` | `BAD_REQUEST` | `pause_until` 不是将来的时间：`"pause_until must be in the future."` |
| `400` | `BAD_REQUEST` | `pause_until` 等于或晚于 `availability.finish_at`：消息中会列出这两个时间点。 |
| `400` | `BAD_REQUEST` | 对没有周期性计费节奏的订阅发送了 `pause_cycles`。 |
| `400` | `BAD_REQUEST` | 组织未启用 `pause_cycles`/`pause_until`，但发送了其中一个：消息中会列出该字段。 |
| `400` | `BAD_REQUEST` | 发送了无法识别的字段，在 gateway 被驳回：`"Bad request"` |
| `400` | `INVALID_PARAMETERS` | `billing_cycle_behavior` 不是 `KEEP` 或 `RESTART`：`"The field 'billing_cycle_behavior' has an invalid value."` |
| `400` | `INVALID_PARAMETERS` | `pause_cycles` 超出 1 到 3 的范围：`"The field 'pause_cycles' has a value greater than allowed."` |
| `400` | `BAD_REQUEST` | 请求体是格式错误的 JSON，在 gateway 被驳回：`"The field '' wrong data type."` |
| `400` | `INVALID_STATE` | 订阅的状态不支持暂停。 |

完全不发送请求体表示没有结束时间的暂停，永远不会因上述任何原因被驳回。


## OpenAPI

````yaml openapi/zh-hans/subscriptions/pause-subscription.json POST /subscriptions/{subscription_id}/pause
openapi: 3.1.0
info:
  title: subscription
  version: 1.0.2
servers:
  - url: https://api-sandbox.y.uno/v1
    description: Sandbox
  - url: https://api.y.uno/v1
    description: Production (US)
security:
  - sec0: []
    sec1: []
paths:
  /subscriptions/{subscription_id}/pause:
    post:
      summary: 暂停订阅
      operationId: pause-subscription
      parameters:
        - name: subscription_id
          in: path
          description: 订阅的唯一标识符。
          schema:
            type: string
          required: true
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                pause_cycles:
                  type: integer
                  minimum: 1
                  maximum: 3
                  description: >-
                    暂停订阅自身的这么多个计费周期，从暂停时开始计算。在暂停时一次性解析为已存储的 `pause_until`。不能与
                    pause_until 同时使用。
                  example: 1
                pause_until:
                  type: string
                  format: date-time
                  description: >-
                    暂停到该 RFC 3339 时刻。必须在未来，并且早于 availability.finish_at。不能与
                    pause_cycles 同时使用。
                  example: '2026-09-22T15:47:04.964Z'
                billing_cycle_behavior:
                  type: string
                  enum:
                    - KEEP
                    - RESTART
                  description: >-
                    订阅恢复（手动或自动）时，计费锚点会如何处理。KEEP（默认）：原来的锚点按错过的整个周期向前推进。RESTART：锚点重新锚定到恢复的时刻。不带
                    pause_cycles 或 pause_until
                    发送也会被接受：这是一个没有结束时间的暂停，只是记录订阅之后恢复时应采用的行为。
                  example: RESTART
                reason:
                  type: string
                  maxLength: 255
                  description: 暂停的自由格式原因，存储在订阅的 reason 字段中。最多 255 个字符；空白视为未提供。
                  example: customer requested a break
            examples:
              PAUSE FOR TWO CYCLES:
                value:
                  pause_cycles: 2
              PAUSE UNTIL A DATE:
                value:
                  pause_until: '2026-09-22T15:47:04.964Z'
              PAUSE AND RE-ANCHOR ON RESUME:
                value:
                  pause_cycles: 1
                  billing_cycle_behavior: RESTART
              PAUSE WITH A REASON:
                value:
                  pause_cycles: 1
                  reason: customer requested a break
      responses:
        '200':
          description: '200'
          content:
            application/json:
              examples:
                PAUSE SUBSCRIPTION:
                  value:
                    id: 7304911d-5df9-429e-8488-ad41abea1a4c
                    name: sub_001
                    description: streaming service
                    account_id: 2404911d-5df9-429e-8488-ad41abea1a4b
                    merchant_reference: 001_marzo_23
                    status: PAUSED
                    plan_id: 1904911d-5df9-429e-8488-ad41abea1a4d
                    amount:
                      currency: USD
                      value: 12100
                    frequency:
                      type: MONTH
                      value: 1
                    billing_cycles:
                      total: 10
                      current: 2
                      next_at: '2023-02-16T20:00:00.786342Z'
                    customer_payer:
                      id: 3t04911d-5df9-429e-8488-ad41abea1a2c
                    payment_method:
                      type: CARD
                      vaulted_token: 6104911d-5df9-429e-8488-ad41abea1a4b
                      card: {}
                    availability:
                      start_at: '2024-01-16T00:00:00.786342Z'
                      finish_at: '2024-05-26T20:00:00.786342Z'
                    metadata:
                      - key: sub_ext_id
                        value: AA001
                    payments:
                      - 5104911d-5df9-229e-8468-bd41abea1a4s
                    created_at: '2023-12-16T20:46:54.786342Z'
                    updated_at: '2023-12-16T21:00:54.786342Z'
                    country: US
                    retries:
                      retry_on_decline: false
                      amount: 6
                      strategy: DEFAULT
                      schedule: null
                      stop_on_hard_decline: null
                      cancel_on_exhausted_retries: null
                    additional_data: null
                    trial_period:
                      billing_cycles: 1
                      amount:
                        value: 0
                        currency: USD
                    initial_payment_validation: false
                    reason: null
                    subscription_agreement_id: null
                    soft_descriptor: ACME SUBSCRIPTION
                    renewal_notification_days: null
                    cancellation_time: null
                    cancellation_source: null
                    ending_time: null
                    pending_plan_change: null
                    current_period_start: '2026-10-23T00:00:00Z'
                    current_period_end: '2026-11-23T00:00:00Z'
                PAUSED FOR A SET TIME:
                  value:
                    id: 7304911d-5df9-429e-8488-ad41abea1a4c
                    name: SUB-112 passthrough subject
                    account_id: 2404911d-5df9-429e-8488-ad41abea1a4b
                    country: CO
                    description: null
                    merchant_reference: pa-sub112pt-1789487657670-794215
                    status: PAUSED
                    amount:
                      currency: COP
                      value: 45000
                    frequency:
                      type: MONTH
                      value: 1
                    billing_cycles:
                      total: null
                      current: 2
                      paid: 1
                      next_at: '2026-10-15T15:54:18.312843Z'
                    customer_payer:
                      id: 3t04911d-5df9-429e-8488-ad41abea1a2c
                    payment_method:
                      type: CARD
                      vaulted_token: 6104911d-5df9-429e-8488-ad41abea1a4b
                      card:
                        installments: null
                        network_transaction_id: '615803391389209'
                        usage: USED
                    availability:
                      start_at: '2026-09-15T15:54:18.312843Z'
                      finish_at: null
                    retries:
                      retry_on_decline: false
                      amount: 6
                      strategy: SMART
                      schedule: null
                      stop_on_hard_decline: null
                      cancel_on_exhausted_retries: null
                    metadata: null
                    additional_data: null
                    trial_period:
                      billing_cycles: 1
                      amount:
                        value: 0
                        currency: ''
                    initial_payment_validation: false
                    reason: null
                    subscription_agreement_id: null
                    soft_descriptor: null
                    renewal_notification_days: null
                    cancellation_time: null
                    cancellation_source: null
                    ending_time: null
                    created_at: '2026-09-15T15:54:18.312843Z'
                    updated_at: '2026-09-15T15:54:22.783678Z'
                    pending_plan_change: null
                    current_period_start: '2026-09-15T15:54:18.312843Z'
                    current_period_end: '2026-10-15T15:54:18.312843Z'
                    pause_until: '2026-10-15T15:54:22.780166Z'
              schema:
                type: object
                properties:
                  id:
                    type: string
                    example: 7304911d-5df9-429e-8488-ad41abea1a4c
                  name:
                    type: string
                    example: sub_001
                  description:
                    type: string
                    example: streaming service
                    nullable: true
                  account_id:
                    type: string
                    example: 2404911d-5df9-429e-8488-ad41abea1a4b
                  merchant_reference:
                    type: string
                    example: 001_marzo_23
                  status:
                    type: string
                    example: PAUSED
                  subscription_plan_id:
                    type: string
                    example: 1904911d-5df9-429e-8488-ad41abea1a4d
                  amount:
                    type: object
                    properties:
                      currency:
                        type: string
                        example: USD
                      value:
                        type: number
                        example: 12100
                        default: 0
                  frequency:
                    type: object
                    properties:
                      type:
                        type: string
                        example: MONTH
                      value:
                        type: integer
                        example: 1
                        default: 0
                      monthly_billing_day:
                        type: integer
                        nullable: true
                        description: >-
                          在 MONTH 频率的订阅上，计费所锚定的每月日期。由
                          RESTART（在更新、计划变更、恢复或重新激活时）设置，或通过发送更新订阅自己的
                          frequency.monthly_billing_day
                          设置。只有在写入之后才会出现；在此之前以及在所有其他频率类型上，该字段不存在（而不是 null）。
                        example: 15
                  billing_cycles:
                    type: object
                    properties:
                      total:
                        type: integer
                        example: 10
                        default: 0
                        nullable: true
                      current:
                        type: integer
                        example: 2
                        default: 0
                      next_at:
                        type: string
                        example: '2023-02-16T20:00:00.786342Z'
                      scheduling_date:
                        type: string
                        description: >-
                          扣款指令交给 Pix 通道的时间，即 `next_at` 减去四天。仅出现在由 Yuno 执行的
                          `PIX_AUTOMATIC` 订阅上，并且仅在该组织启用了四天预约提前期时出现；否则该字段不存在（而不是
                          `null`）。只读。请参阅 [Pix
                          Automático](/zh-hans/docs/payment-features/subscriptions/pix-automatico#the-scheduling-date)。
                        example: '2026-11-27T00:00:00Z'
                      paid:
                        type: integer
                        description: 到目前为止已支付的周期数。与 `current` 不同，`current` 是正在计费的周期。
                  customer_payer:
                    type: object
                    properties:
                      id:
                        type: string
                        example: 3t04911d-5df9-429e-8488-ad41abea1a2c
                  payment_method:
                    type: object
                    properties:
                      type:
                        type: string
                        example: CARD
                      token:
                        type: string
                        example: 9104911d-5df9-429e-8488-ad41abea1a4b
                      vaulted_token:
                        type: string
                        example: 6104911d-5df9-429e-8488-ad41abea1a4b
                      card:
                        type: object
                        properties:
                          verify:
                            type: boolean
                            example: false
                            default: true
                          card_data:
                            type: object
                            properties:
                              number:
                                type: string
                                example: '4507990000000010'
                              expiration_month:
                                type: integer
                                example: 10
                                default: 0
                              expiration_year:
                                type: integer
                                example: 2025
                                default: 0
                              security_code:
                                type: integer
                                example: 123
                                default: 0
                              holder_name:
                                type: string
                                example: JOHN DOE
                          installments:
                            type: integer
                            nullable: true
                          network_transaction_id:
                            type: string
                            nullable: true
                          usage:
                            type: string
                            example: FIRST
                        nullable: true
                    description: 订阅扣款所使用的支付方式。是单个对象，而不是列表。
                  availability:
                    type: object
                    properties:
                      start_at:
                        type: string
                        example: '2024-01-16T00:00:00.786342Z'
                      finish_at:
                        type: string
                        example: '2024-05-26T20:00:00.786342Z'
                        nullable: true
                  metadata:
                    type: array
                    items:
                      type: object
                      properties:
                        key:
                          type: string
                          example: sub_ext_id
                        value:
                          type: string
                          example: AA001
                    nullable: true
                  payments:
                    type: array
                    items:
                      type: string
                      example: 5104911d-5df9-229e-8468-bd41abea1a4s
                    description: 由该订阅创建的支付 ID 列表。当订阅没有支付时，响应中会省略该字段。
                  created_at:
                    type: string
                    example: '2023-12-16T20:46:54.786342Z'
                  updated_at:
                    type: string
                    example: '2023-12-16T21:00:54.786342Z'
                  country:
                    type: string
                    description: 订阅所在国家/地区（ISO 3166-1 alpha-2）。
                    example: US
                  soft_descriptor:
                    type: string
                    description: 账单描述符。
                    example: ACME SUBSCRIPTION
                    nullable: true
                  current_period_start:
                    type: string
                    nullable: true
                    description: >-
                      订阅当前所处计费周期的开始时间，比 `current_period_end`
                      早一个计费间隔。在试用期或任何其他计划阶段内，它遵循该阶段的计费间隔。处于终态的订阅（`CANCELED` 或
                      `COMPLETED`）保留其最后的时间窗口，而不会变为 null。仅对没有周期性计费间隔的订阅为 Null。始终与
                      current_period_end 一起返回。
                    example: '2023-01-16T20:00:00.912480Z'
                  current_period_end:
                    type: string
                    nullable: true
                    description: >-
                      订阅当前所处计费周期的结束时间。等于 billing_cycles.next_at。始终与
                      current_period_start 一起返回。
                    example: '2023-02-16T20:00:00.786342Z'
                  billing_date:
                    type: object
                    nullable: true
                    description: 仅出现在按固定日期（而不是按频率）计费的订阅上；与 `frequency` 互斥。
                    properties:
                      type:
                        type: string
                        example: DAY
                      day:
                        type: integer
                        example: 2
                  retries:
                    type: object
                    nullable: true
                    description: >-
                      定期扣款被拒绝时所采用的重试策略。请参阅[重试](/zh-hans/docs/payment-features/subscriptions/retries)。
                    properties:
                      retry_on_decline:
                        type: boolean
                        description: 被拒绝的扣款是否会重试。
                        example: true
                      amount:
                        type: integer
                        description: 一个计费周期可以重试的次数。上限为您所在环境的重试计划长度（生产环境为 6）。
                        example: 4
                      strategy:
                        type: string
                        description: >-
                          每次重试的时间如何确定：`DEFAULT`、`SMART` 或
                          `CUSTOM_SCHEDULE`。请将其视为开放式字段，并妥善处理无法识别的值。
                        example: DEFAULT
                      schedule:
                        type: array
                        nullable: true
                        description: >-
                          每次尝试的计划，仅当 `strategy` 为 `CUSTOM_SCHEDULE` 时设置；否则为
                          `null`。
                        items:
                          type: object
                      stop_on_hard_decline:
                        type: boolean
                        nullable: true
                        description: 为 true 时，硬拒绝会停止当前计费周期的重试。
                      cancel_on_exhausted_retries:
                        type: boolean
                        nullable: true
                        description: >-
                          为 true 时，一个周期的重试结束后仍没有支付成功，订阅就会被取消，同时
                          `cancellation_source` 设置为 `RETRIES_EXHAUSTED`。
                      profile:
                        type: string
                        description: >-
                          订阅遵循的固定重试阶梯，用来替代可配置的计划。始终为
                          `PIX_AUTOMATIC`。该字段和下面三个字段仅出现在由 Yuno 执行的
                          `PIX_AUTOMATIC` 订阅上；在所有其他支付方式上，它们不存在（而不是 `null`）。请参阅
                          [Pix
                          Automático](/zh-hans/docs/payment-features/subscriptions/pix-automatico#the-retry-ladder)。
                        example: PIX_AUTOMATIC
                      max_attempts:
                        type: integer
                        description: Pix 阶梯执行的重试次数。始终为 3，与这些订阅所报告的 `amount` 一致。
                        example: 3
                      min_gap_hours:
                        type: integer
                        description: >-
                          始终为
                          24，即阶梯各扣款日期（`D`、`D+1`、`D+2`、`D+3`）之间的间隔，而不是各发出尝试之间的间隔。
                        example: 24
                      until:
                        type: string
                        description: >-
                          阶梯停止的时间，即 `billing_cycles.next_at` 加 7 天。每次续订时随
                          `next_at` 一起变动。
                      stopped:
                        type: boolean
                        description: 仅当订阅处于 PAST_DUE 状态或有待处理的 cancel_scheduled 时出现。
                      attempts_made:
                        type: integer
                        description: 仅当订阅处于 PAST_DUE 状态或有待处理的 cancel_scheduled 时出现。
                      outcome:
                        type: string
                        description: >-
                          RECOVERED、EXHAUSTED 或 ABANDONED。仅当订阅处于 PAST_DUE
                          状态或有待处理的 cancel_scheduled 时出现。
                      next_retry_at:
                        type: string
                        description: 仅当订阅处于 PAST_DUE 状态或有待处理的 cancel_scheduled 时出现。
                  trial_period:
                    type: object
                    description: 试用期。
                    properties:
                      billing_cycles:
                        type: integer
                        example: 1
                        default: 0
                      amount:
                        type: object
                        properties:
                          value:
                            type: number
                            example: 0
                            default: 0
                          currency:
                            type: string
                            example: USD
                  additional_data:
                    type: object
                    nullable: true
                    description: >-
                      创建时发送的可选订单补充数据，原样回显。完整结构请参阅[订阅对象](/zh-hans/reference/subscriptions/the-subscription-object)。
                  initial_payment_validation:
                    type: boolean
                    description: 订阅是否等待首次支付成功后才激活。默认为 `false`。
                    example: false
                  reason:
                    type: string
                    nullable: true
                    description: 订阅当前状态的自由格式原因（如果有记录）；否则为 `null`。
                    example: merchant request
                  renewal_notification_days:
                    type: integer
                    nullable: true
                    description: >-
                      在下一个计费日期之前多少天发送 `subscription.close_to_renewal`
                      webhook。`null` 表示不发送续订通知。
                    example: 3
                  subscription_agreement_id:
                    type: string
                    description: 订阅协议 ID。
                    example: sa_6af2dfcd-44c0-4f16-a331-8bed3ed9c9fa
                    nullable: true
                  cancellation_time:
                    type: string
                    nullable: true
                    description: 订阅被取消的时间。仅在订阅达到 `CANCELED` 后设置；否则为 `null`。
                    example: '2023-12-16T20:46:54.786342Z'
                  cancellation_source:
                    type: string
                    nullable: true
                    description: >-
                      触发取消的原因：`MERCHANT`、`SYSTEM`、`PLAN_CHANGE` 或
                      `RETRIES_EXHAUSTED`。仅在订阅达到 `CANCELED` 后设置；否则为
                      `null`。请将其视为开放式字段，并妥善处理无法识别的值。
                    example: MERCHANT
                  ending_time:
                    type: string
                    nullable: true
                    description: 订阅完成或过期的时间。仅在订阅达到 `COMPLETED` 后设置；否则为 `null`。
                    example: '2024-12-16T20:46:54.786342Z'
                  plan_id:
                    type: string
                    description: 仅当订阅关联了计划时出现。
                    example: 00000000-0000-4000-8000-000000000001
                  plan_assigned_at:
                    type: string
                    description: 仅出现在关联了计划的订阅上。计划被附加的时间，即从计划创建订阅时、迁移到计划时或计划变更时。
                    example: '2023-12-16T20:46:54.786342Z'
                  previous_subscription_id:
                    type: string
                    description: 仅当该订阅由计划变更（将现有订阅切换到另一个计划）创建时出现。
                    nullable: true
                  phases:
                    type: array
                    description: >-
                      所关联计划的阶段定义，与计划声明的一致，包括终止的 `REGULAR`
                      阶段。仅出现在其计划包含阶段的、关联了计划的订阅上。这是计划自己的阶梯，而不是该订阅者的快照：要查看创建时为该订阅固定下来的内容，请使用
                      `billing_phases`。
                    items:
                      type: object
                      properties:
                        order:
                          type: integer
                        name:
                          type: string
                        type:
                          type: string
                          description: '`TRIAL` 或 `REGULAR`。'
                        duration:
                          type: object
                          nullable: true
                          description: 阶段持续多长时间。在终止的 `REGULAR` 阶段上为 `null`，该阶段一直持续到订阅结束。
                          properties:
                            type:
                              type: string
                            value:
                              type: integer
                        frequency:
                          type: object
                          nullable: true
                          description: 阶段的计费频率。在终止的 `REGULAR` 阶段上为 `null`，该阶段按计划自身的频率计费。
                          properties:
                            type:
                              type: string
                            value:
                              type: integer
                        amount:
                          type: object
                          nullable: true
                          description: 阶段价格。在终止的 `REGULAR` 阶段上为 `null`，其价格在每次计费时由计划确定。
                          properties:
                            currency:
                              type: string
                            value:
                              type: number
                        total_payments:
                          type: integer
                          nullable: true
                        country_prices:
                          type: array
                          description: 按国家/地区覆盖的阶段价格，阶段没有覆盖时为空。
                          items:
                            type: object
                            properties:
                              country:
                                type: string
                              amount:
                                type: object
                                properties:
                                  currency:
                                    type: string
                                  value:
                                    type: number
                  current_phase:
                    type: string
                    description: 仅出现在关联了计划的订阅上。
                    example: REGULAR
                  current_phase_end:
                    type: string
                    nullable: true
                    description: >-
                      由 `current_phase`
                      指定的阶段移交给下一个阶段的时间，对于处于试用期的订阅，即切换到常规价格的时间。它是该阶段所涵盖的最后一个计费周期的结束时间，因此在试用期的最后一个周期，它等于
                      `current_period_end`。对于没有计划的订阅以及已离开阶段阶梯的订阅，为 Null。
                    example: '2023-03-16T20:00:00.786342Z'
                  billing_phases:
                    type: array
                    description: >-
                      仅出现在其计划包含阶段的、关联了计划的订阅上。只包含前面的 TRIAL 阶段，在创建时生成快照；终止的
                      REGULAR 阶段从不包含在内，因为它的价格没有被固定，而是在每次计费时由计划确定。`current_phase:
                      "REGULAR"` 表示阶梯已经用完。
                    items:
                      type: object
                      properties:
                        order:
                          type: integer
                        type:
                          type: string
                          description: 始终为 TRIAL，终止的 REGULAR 阶段从不出现在该数组中。
                        name:
                          type: string
                        amount:
                          type: object
                          properties:
                            currency:
                              type: string
                            value:
                              type: number
                        frequency:
                          type: object
                          properties:
                            type:
                              type: string
                            value:
                              type: integer
                        start_cycle:
                          type: integer
                        end_cycle:
                          type: integer
                  pending_plan_change:
                    type: object
                    nullable: true
                    description: >-
                      计划在下一个计费周期生效的变更，没有待处理的变更时为 null。使用更新订阅上的 `plan_change`
                      块可以预定一个变更。
                    properties:
                      plan_id:
                        type: string
                        description: 目标计划的标识符。
                        example: 1904911d-5df9-429e-8488-ad41abea1a4d
                      plan_name:
                        type: string
                        description: 目标计划的名称。
                        example: Pro
                      direction:
                        type: string
                        enum:
                          - UPGRADE
                          - DOWNGRADE
                        description: 目标计划是升级还是降级。仅供参考。
                        example: UPGRADE
                      effective:
                        type: string
                        enum:
                          - NEXT_BILLING_CYCLE
                        description: 变更生效的时间。
                        example: NEXT_BILLING_CYCLE
                      phases_behavior:
                        type: string
                        enum:
                          - START_FROM_REGULAR
                          - HONOR_PHASES
                        description: 目标计划包含阶段时会发生什么。
                        example: START_FROM_REGULAR
                      applies_at:
                        type: string
                        description: 变更将在其上生效的计费事件，即订阅的下一个计费日期。
                        example: '2023-02-16T20:00:00.786342Z'
                      requested_at:
                        type: string
                        description: 变更被预定的时间。
                        example: '2023-01-20T10:12:31.786342Z'
                  refund_rule:
                    type: object
                    description: >-
                      已存储的退款规则，当取消请求没有自带 refund_amount 时，用它来确定 CUSTOM
                      取消的退款。仅在配置了规则时出现；否则该字段被省略（而不是 null）。适用于已启用该功能的组织；请联系 Yuno。
                    properties:
                      type:
                        type: string
                        enum:
                          - PERCENT
                          - FIXED
                        description: PERCENT 将退款确定为已扣款金额的百分比；FIXED 将其确定为固定金额。
                        example: FIXED
                      percent:
                        type: number
                        description: 当 type 为 PERCENT 时必填，且仅在此时允许（0-100）。
                        example: 50
                      amount:
                        type: object
                        description: 当 type 为 FIXED 时必填，且仅在此时允许。
                        properties:
                          value:
                            type: number
                            example: 10000
                          currency:
                            type: string
                            description: 必须与订阅自身的币种一致。
                            example: COP
                  pause_until:
                    type: string
                    description: >-
                      订阅预定自动恢复的时间。仅出现在当前带有时长（暂停时发送了 pause_cycles 或
                      pause_until）而处于暂停状态的订阅上；在所有其他读取中，该字段不存在（而不是 null）。
                    example: '2026-10-15T15:54:22.780166Z'
                  cancel_scheduled:
                    type:
                      - object
                      - 'null'
                    description: 没有待处理的取消时为 null。
                    properties:
                      mode:
                        type: string
                        example: AFTER_CYCLES
                      after_cycles:
                        type: integer
                        example: 3
                      at:
                        type: string
                      requested_at:
                        type: string
                      past_due_behavior:
                        type: string
                        example: EXHAUST_RETRIES
                  refund:
                    type:
                      - object
                      - 'null'
                    description: 当 refund 为 NONE 或被省略时为 null。出现在取消响应中，计算完成后的每次后续读取中也会出现。
                    properties:
                      mode:
                        type: string
                        example: PRORATED
                      amount:
                        type: object
                        properties:
                          currency:
                            type: string
                            example: USD
                          value:
                            type: number
                            example: 20
                      unused_days:
                        type: integer
                        example: 20
                      period_days:
                        type: integer
                        example: 30
                      basis:
                        type: object
                        properties:
                          billing_cycle:
                            type: integer
                            example: 4
                          charged_amount:
                            type: object
                            properties:
                              currency:
                                type: string
                                example: USD
                              value:
                                type: number
                                example: 30
                          payment_id:
                            type: string
                            description: 对于没有已捕获支付的 $0 阶段报价，为 null。
                          charged_at:
                            type: string
                            description: 对于没有已捕获支付的 $0 阶段报价，为 null。
                      execution:
                        type: string
                        example: MERCHANT
                      quoted_at:
                        type: string
                  unpaid_cycle:
                    type: object
                    description: 仅当当前计费周期处于 PAST_DUE 状态且尚未结清时出现。
                    properties:
                      cycle_number:
                        type: integer
                      amount:
                        type: object
                        properties:
                          currency:
                            type: string
                          value:
                            type: number
                      attempts:
                        type: integer
                      last_failure_code:
                        type: string
        '400':
          description: '400'
          content:
            application/json:
              examples:
                Result:
                  value:
                    code: INVALID_STATE
                    messages:
                      - >-
                        The subscription state does not support the action
                        requested.
                SUBSCRIPTION NOT FOUND:
                  value:
                    code: SUBSCRIPTION_NOT_FOUND
                    messages:
                      - Subscription not found.
                  summary: >-
                    No subscription resolves for the subscription_id on this
                    account. Returned as 400, not 404.
                PAUSE_CYCLES COMBINED WITH PAUSE_UNTIL:
                  value:
                    code: BAD_REQUEST
                    messages:
                      - pause_cycles cannot be combined with pause_until.
                PAUSE_UNTIL NOT IN THE FUTURE:
                  value:
                    code: BAD_REQUEST
                    messages:
                      - pause_until must be in the future.
                UNKNOWN FIELD (GATEWAY):
                  value:
                    code: BAD_REQUEST
                    messages:
                      - Bad request
                INVALID BILLING CYCLE BEHAVIOR (GATEWAY):
                  value:
                    code: INVALID_PARAMETERS
                    messages:
                      - The field 'billing_cycle_behavior' has an invalid value.
                PAUSE_CYCLES OUT OF RANGE (GATEWAY):
                  value:
                    code: INVALID_PARAMETERS
                    messages:
                      - >-
                        The field 'pause_cycles' has a value greater than
                        allowed.
                MALFORMED JSON (GATEWAY):
                  value:
                    code: BAD_REQUEST
                    messages:
                      - The field '' wrong data type.
      deprecated: false
components:
  securitySchemes:
    sec0:
      type: apiKey
      in: header
      name: public-api-key
      x-default: <Your public-api-key>
    sec1:
      type: apiKey
      in: header
      name: private-secret-key
      x-default: <Your private-secret-key>

````

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