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

# 暂停订阅

> Pause an eligible active subscription now or replace its pending pause schedule. A future pauseAt keeps the subscription active until the pause takes effect. UPI, PIX and subscriptions set to cancel at period end are ineligible.

所有商户都可以暂停由 Clink 管理且符合条件的 `active` 订阅。不传请求体或传 `{}` 会立即暂停。要预约暂停，请传未来的 Unix 毫秒时间戳 `pauseAt`。如果传入的时间等于或早于当前时间，暂停会立即生效。再次提交会替换待执行的暂停计划，包括原计划的原因和自动恢复时间。

以下示例生成“明天暂停、一周后恢复”的请求体。

```javascript theme={null}
const day = 24 * 60 * 60 * 1000;
const pauseAt = Date.now() + day;
const body = { pauseAt, resumeAt: pauseAt + 7 * day, reason: "客户申请暂停" };
```

省略 `resumeAt` 表示手动恢复。预约成功时，响应中的 `status` 仍为 `active`，并返回 `pause.pauseAt`。暂停生效后，状态变为 `paused`，响应中会带上实际暂停时间 `pause.pausedAt` 和剩余服务秒数 `pause.remainingSeconds`。

| 业务错误码 | 说明及处理方式 |
| - | - |
| `90100252` | 暂停操作当前不可用。如果持续出现，请联系支持。 |
| `90100253` | 确认订阅处于 `active` 且由 Clink 管理。镜像订阅不支持暂停。 |
| `90100254` | 续费正在处理，等续费完成后再暂停。 |
| `90100255` | 有待完成的立即套餐变更，等变更完成后再暂停。 |
| `90100256` | 订阅已设置到期取消，无法暂停。 |
| `90100257` | UPI 和 PIX 订阅不支持暂停。 |
| `90100258` | 按错误消息中的 UTC 范围调整时间。自动恢复时间须晚于当前时间和暂停时间。 |


## OpenAPI

````yaml POST /subscription/{id}/pause
openapi: 3.1.0
info:
  title: Clink API
  description: >-
    Official API documentation for Clink's payment processing platform. This API
    enables merchants to create and manage payment sessions, handle
    subscriptions, and process transactions.
  version: 1.0.0
servers:
  - url: https://uat-api.clinkbill.com/api/
security:
  - ApiKeyAuth: []
paths:
  /subscription/{id}/pause:
    post:
      tags:
        - Subscription API
      summary: Pause Subscription
      description: >-
        Pause an eligible active subscription now or replace its pending pause
        schedule. A future pauseAt keeps the subscription active until the pause
        takes effect. UPI, PIX and subscriptions set to cancel at period end are
        ineligible.
      operationId: pauseSubscription
      parameters:
        - $ref: '#/components/parameters/TimestampHeader'
        - name: id
          in: path
          description: Unique identifier of the subscription
          required: true
          schema:
            type: string
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PauseSubscriptionRequest'
            examples:
              pauseNow:
                summary: Pause immediately
                value:
                  reason: Customer requested a break
              schedulePause:
                summary: Schedule a pause and automatic resumption
                description: >-
                  Pause on January 1, 2027 at 00:00 UTC and resume one week
                  later. Choose future timestamps for your request.
                value:
                  pauseAt: 1798761600000
                  resumeAt: 1799366400000
      responses:
        '200':
          description: >-
            Updated subscription on success. Check the business code in the
            response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubscriptionApiResponse'
              examples:
                success:
                  summary: Paused immediately
                  value:
                    code: 200
                    msg: success
                    data:
                      subscriptionId: sub_xxxxx
                      customerId: cus_xxxxx
                      productId: prd_xxxxx
                      priceId: price_xxxxx
                      priceSnapshotId: pricesns_xxxxx
                      createTime: 1793491200000
                      quantity: 1
                      paymentMethodType: card
                      paymentInstrumentId: pi_xxxxx
                      status: paused
                      billing: charge_automatically
                      currency: USD
                      currentPeriodStart: 1793491200000
                      currentPeriodEnd: 1796083200000
                      recurringInvoiceItem:
                        invoiceItemId: ii_xxxxx
                        amount: '20.00'
                        currency: USD
                        periodStart: 1793491200000
                        periodEnd: 1796083200000
                        discountAmount: '2.00'
                        paymentAmount: '18.00'
                        description: Monthly membership
                        price:
                          productId: prd_xxxxx
                          productName: Monthly Membership
                          productUrl: https://merchant.example.com/membership
                          priceId: price_xxxxx
                          priceSnapshotId: pricesns_xxxxx
                          unitAmount: '20.00'
                          quantity: 1
                          recurring:
                            interval: month
                            intervalCount: 1
                            pricingModel: flat_rate
                      pause:
                        pausedAt: 1795737600000
                        remainingSeconds: 345600
                        reason: Customer requested a break
        '401':
          description: Unauthorized
          content:
            '*/*':
              schema:
                type: string
components:
  parameters:
    TimestampHeader:
      name: X-Timestamp
      in: header
      required: true
      description: >-
        Current timestamp in milliseconds since Unix epoch (required for request
        signing)
      schema:
        type: string
        example: '1783513683000'
  schemas:
    PauseSubscriptionRequest:
      type: object
      properties:
        pauseAt:
          type:
            - integer
            - 'null'
          format: int64
          example: 1798761600000
          description: >-
            Time to pause in Unix milliseconds. A future time schedules the
            pause. Omit, send null, or supply a time at or before now to pause
            immediately.
        resumeAt:
          type:
            - integer
            - 'null'
          format: int64
          example: 1799366400000
          description: >-
            Automatic resume time in Unix milliseconds, later than both now and
            the pause time and within the allowed scheduling window. Omit or
            send null for manual resumption.
        reason:
          type:
            - string
            - 'null'
          maxLength: 255
          description: Optional reason for pausing.
    SubscriptionApiResponse:
      type: object
      properties:
        code:
          type: integer
          format: int32
          description: Clink business result code. A value of 200 indicates success.
        msg:
          type: string
          description: Human-readable result message describing the outcome of the request.
        data:
          $ref: '#/components/schemas/SubscriptionApiData'
          description: >-
            Subscription details after the operation, including the current
            status and billing period.
    SubscriptionApiData:
      required:
        - billing
        - createTime
        - customerId
        - paymentInstrumentId
        - paymentMethodType
        - priceId
        - priceSnapshotId
        - productId
        - quantity
        - recurringInvoiceItem
        - status
        - subscriptionId
      type: object
      properties:
        merchantReference:
          type: string
          description: >-
            Reference supplied by the merchant to reconcile this subscription
            with its own records.
        subscriptionId:
          type: string
          description: >-
            Unique identifier of the subscription. Use this ID in subscription
            API requests.
        sessionId:
          type: string
          description: >-
            Identifier of the checkout session associated with this
            subscription, when available.
        customerId:
          type: string
          description: Identifier of the customer who owns the subscription.
        productId:
          type: string
          description: Identifier of the product on the current subscription plan.
        priceId:
          type: string
          description: Identifier of the recurring price on the current plan.
        priceSnapshotId:
          type: string
          description: >-
            Identifier of the price snapshot that supplies the current plan’s
            pricing terms.
        createTime:
          type: integer
          format: int64
          description: Time the subscription was created, in Unix milliseconds.
        quantity:
          type: integer
          format: int32
          description: Number of units billed at the current subscription price.
        paymentMethodType:
          type: string
          description: Type of payment method used for the subscription, such as card.
        paymentInstrumentId:
          type: string
          description: >-
            Identifier of the saved payment instrument used for subscription
            charges.
        trialStart:
          type: integer
          format: int64
          description: >-
            Start of the free trial, in Unix milliseconds, if the subscription
            has a trial.
        trialEnd:
          type: integer
          format: int64
          description: >-
            End of the free trial, in Unix milliseconds, if the subscription has
            a trial.
        currentPeriodStart:
          type: integer
          format: int64
          description: >-
            Billing start recorded on the subscription, in Unix milliseconds.
            Use recurringInvoiceItem.periodStart and periodEnd for the current
            service period, including any shift after resumption.
        currentPeriodEnd:
          type: integer
          format: int64
          description: >-
            Billing period end in Unix milliseconds. While paused, this is the
            pre-pause value. Resuming shifts it to the actual resume time plus
            the remaining service time.
        cancelAt:
          type: integer
          description: >-
            Time of automatic cancellation in Unix milliseconds. When period-end
            cancellation is requested while paused, the time is determined on
            resumption.
          format: int64
        cancelAtPeriodEnd:
          type: boolean
          description: >-
            Whether cancellation is scheduled for the end of the billing period.
            For a paused subscription, cancellation takes effect after it
            resumes and the remaining service time runs out.
        canceledAt:
          type: integer
          format: int64
          description: Time cancellation was requested, in Unix milliseconds.
        cancelReason:
          type: string
          description: Reason given for cancelling the subscription, when provided.
        status:
          type: string
          enum:
            - incomplete
            - free_trial
            - active
            - incomplete_expired
            - past_due
            - cancelled
            - paused
          description: >-
            Current subscription status: 'incomplete' (waiting for a payment),
            'free_trial' (trialing), 'active', 'incomplete_expired' (timed out
            without a payment), 'past_due' (no payment received on renewal),
            'cancelled', 'paused' (renewals suspended, remaining service time
            preserved)
        billing:
          type: string
          description: >-
            How the subscription collects payment. Values are
            charge_automatically and send_invoice.
        currency:
          type: string
          enum:
            - USD
            - EUR
            - JPY
            - GBP
            - AUD
            - CAD
            - CNY
            - HKD
            - SGD
            - KRW
            - AED
            - THB
            - IDR
            - PHP
            - MYR
            - BRL
            - INR
          description: ISO currency code used to bill the subscription.
        recurringInvoiceItem:
          $ref: '#/components/schemas/InvoiceItemVo'
          description: >-
            Line item for the current service period, including its price,
            quantity, and period dates.
        upcomingInvoiceItem:
          $ref: '#/components/schemas/InvoiceItemVo'
          description: >-
            Pending line item for an upcoming activation or plan change, when
            present. A period-end change moves to the new billing boundary when
            a paused subscription resumes.
        scheduledPhases:
          type: array
          description: >-
            Remaining scheduled subscription plan changes that have not taken
            effect yet.
          items:
            $ref: '#/components/schemas/ScheduledPhase'
        elapsedCycles:
          type: integer
          description: >-
            Number of billing period boundaries already crossed. Compare this
            with scheduledPhases.effectiveCycle to determine when a remaining
            phase takes effect.
          format: int32
        metadata:
          type: object
          additionalProperties:
            type: string
          description: Merchant-defined key-value pairs attached to the subscription.
        pause:
          $ref: '#/components/schemas/SubscriptionPauseInfo'
          description: >-
            Details of a pending or active pause. Cleared when the pending pause
            is revoked or the subscription resumes.
    InvoiceItemVo:
      type: object
      properties:
        invoiceItemId:
          type: string
          description: Identifier of this invoice line item.
        amount:
          type: string
          description: >-
            Line amount before discounts, in the line item currency, returned as
            a decimal string.
          example: '20.00'
        discountAmount:
          type: string
          description: >-
            Discount applied to this line item, in the same currency, returned
            as a decimal string.
          example: '2.00'
        paymentAmount:
          type: string
          description: >-
            Line amount after subtracting the discount, returned as a decimal
            string.
          example: '18.00'
        couponTerms:
          type: string
          description: Terms of the coupon applied to this line item, when present.
        promotionCode:
          type: string
          description: >-
            Promotion code used to apply the discount to this line item, when
            present.
        currency:
          type: string
          enum:
            - USD
            - EUR
            - JPY
            - GBP
            - AUD
            - CAD
            - CNY
            - HKD
            - SGD
            - KRW
            - AED
            - THB
            - IDR
            - PHP
            - MYR
            - BRL
            - INR
          description: ISO currency code for the amounts on this line item.
        description:
          type: string
          description: Human-readable description of the invoice line item.
        periodStart:
          type: integer
          format: int64
          description: >-
            Start of the service period covered by this line item, in Unix
            milliseconds.
        periodEnd:
          type: integer
          format: int64
          description: >-
            End of the service period covered by this line item, in Unix
            milliseconds.
        proration:
          type: boolean
          description: Whether the amount was prorated for a partial billing period.
        price:
          $ref: '#/components/schemas/PriceVo'
          description: Product and price snapshot used to calculate this line item.
    ScheduledPhase:
      required:
        - sequence
        - effectiveCycle
        - priceSnapshotId
        - quantity
      type: object
      description: >-
        A scheduled subscription plan change that takes effect at a future
        billing period boundary.
      properties:
        sequence:
          minimum: 1
          type: integer
          description: >-
            Position of this phase in the schedule. Values must be strictly
            increasing.
          format: int32
        effectiveCycle:
          minimum: 1
          type: integer
          description: >-
            The renewal boundary when this phase takes effect, counted from
            subscription creation. Values must be strictly increasing.
          format: int32
        priceSnapshotId:
          type: string
          description: >-
            Target subscription price snapshot ID. The snapshot must exist, have
            priceType=SUBSCRIBE with valid recurring details, and support the
            subscription payment currency.
        quantity:
          minimum: 1
          type: integer
          description: Target quantity for the scheduled phase.
          format: int32
        metadata:
          type: object
          description: >-
            Optional metadata for this scheduled phase. Maximum 20 keys. Key
            length must be 40 characters or fewer and string value length must
            be 500 characters or fewer.
          maxProperties: 20
          propertyNames:
            maxLength: 40
          additionalProperties:
            type: string
            maxLength: 500
    SubscriptionPauseInfo:
      type:
        - object
        - 'null'
      description: >-
        Present when a pause is scheduled or in effect. Cleared when the pending
        pause is revoked or the subscription resumes.
      properties:
        pauseAt:
          type:
            - integer
            - 'null'
          format: int64
          description: >-
            Scheduled pause time. Populated only while the pause is pending.
            Unix milliseconds.
        pausedAt:
          type:
            - integer
            - 'null'
          format: int64
          description: >-
            Actual pause time. Populated once the pause takes effect. Unix
            milliseconds.
        remainingSeconds:
          type:
            - integer
            - 'null'
          format: int64
          minimum: 0
          description: >-
            Whole seconds of service remaining at the moment the pause took
            effect.
        resumeAt:
          type:
            - integer
            - 'null'
          format: int64
          description: >-
            Scheduled automatic resume time in Unix milliseconds. Empty for
            manual resumption.
        reason:
          type:
            - string
            - 'null'
          maxLength: 255
          description: Optional reason for pausing.
    PriceVo:
      type: object
      properties:
        productId:
          type: string
          description: Identifier of the product billed on this line item.
        productName:
          type: string
          description: Product name stored in the price snapshot.
        productUrl:
          type: string
          format: uri
          description: >-
            Product page URL saved with the line item. When present, the product
            name links to this page in the billing email.
        priceId:
          type: string
          description: Identifier of the product price used for this line item.
        priceSnapshotId:
          type: string
          description: >-
            Identifier of the snapshot that preserves the pricing terms for this
            line item.
        unitAmount:
          type: string
          description: >-
            Price per unit in the line item currency, returned as a decimal
            string.
          example: '20.00'
        quantity:
          type: integer
          format: int32
          description: Number of units of this product on the line item.
        recurring:
          $ref: '#/components/schemas/Recurring'
          description: >-
            Recurring pricing terms, including the billing interval and pricing
            model.
    Recurring:
      required:
        - interval
        - pricingModel
      type: object
      properties:
        interval:
          type: string
          enum:
            - week
            - month
            - year
            - day
            - quarter
            - half_year
            - custom
          description: >-
            Frequency of recurring charges. `quarter` bills every 3 months,
            `half_year` bills every 6 months, and `custom` uses interval count
            to define the cycle.
        trialPeriodDays:
          type: integer
          description: Number of days in the trial period
          format: int32
        pricingModel:
          type: string
          enum:
            - flat_rate
            - per_seat
          description: >-
            Billing model (flat_rate, per_seat, with tiered and usage_based
            models coming soon)
        tiersMode:
          type: string
          enum:
            - volume
            - graduated
          description: >-
            Coming soon. Tiered pricing mode, can be volume (quantity-based) or
            graduated (incremental tiers)
        intervalCount:
          type: integer
          description: >-
            Number of interval units per billing cycle. For custom intervals,
            this value represents the number of days.
          format: int32
      description: Recurring billing configuration information
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY
      description: >-
        Your secret API key obtained from the Clink dashboard (Developers
        section)

````

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