> ## 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.

# 修改自动恢复时间

> Set or replace the automatic resume time of a paused subscription. Send {"resumeAt": null}, an empty object, or no body to clear the schedule and keep the subscription paused until manually resumed.

对 `paused` 订阅传入未来的 Unix 毫秒时间戳 `resumeAt`，即可设置或替换自动恢复时间。例如，JavaScript 表达式 `{ resumeAt: Date.now() + 24 * 60 * 60 * 1000 }` 表示 24 小时后恢复。

传入以下 JSON 可改为手动恢复。订阅会继续保持暂停。

```json theme={null}
{ "resumeAt": null }
```

不传请求体或传 `{}` 效果相同。设置、修改或清空自动恢复时间都会触发 `subscription.updated.pause_schedule_set`。实际恢复时才会触发 `subscription.resumed`。

订阅未暂停时返回 `90100259`。时间超出允许的预约范围时返回 `90100258`，错误消息中会给出本次可选的 UTC 时间范围。


## OpenAPI

````yaml POST /subscription/{id}/resume/schedule
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}/resume/schedule:
    post:
      tags:
        - Subscription API
      summary: Update Automatic Resume Time
      description: >-
        Set or replace the automatic resume time of a paused subscription. Send
        {"resumeAt": null}, an empty object, or no body to clear the schedule
        and keep the subscription paused until manually resumed.
      operationId: updateResumeSchedule
      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/UpdateResumeScheduleRequest'
            examples:
              clearSchedule:
                summary: Clear the automatic resume time
                value:
                  resumeAt: null
              scheduleResume:
                summary: Set the automatic resume time
                description: >-
                  Resume on January 8, 2027 at 00:00 UTC. Choose a future
                  timestamp for your request.
                value:
                  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: Automatic resume time cleared
                  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:
    UpdateResumeScheduleRequest:
      type: object
      properties:
        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.
    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.