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

# Resume Subscription

> Undo a scheduled cancellation (cancel_at_period_end=true) with the secret key, so the subscription keeps renewing. Only cancellations scheduled on the merchant side (cancel_requested_by api, manager or null) can be resumed; 403 when the customer (payer) or Payviox (admin, system) scheduled it. Returns the Subscription. Errors: 403, 409 already canceled, 502 Stripe refused, 503 Stripe unreachable

## Overview

Undoes a cancellation scheduled at the end of the period by **your side** — your backend (`cancel_requested_by: "api"`), your dashboard (`"manager"`) or your Stripe dashboard (`null`). The subscription keeps renewing as before.

<Warning>
  **You can't undo the customer's cancellation.** If the customer scheduled it from their management link (`cancel_requested_by: "payer"`), only they can resume it, from that same link; if Payviox did (`"admin"` or `"system"`), contact support. Both return `403`.

  The customer's cancellation is their withdrawal of consent to be charged: renewing anyway would be a charge they didn't authorize, the typical cause of "canceled recurring payment" disputes. For the same reason, if you resume a customer's cancellation directly in your Stripe dashboard, Payviox re-applies the cancellation.
</Warning>

<Note>
  Only a **scheduled** cancellation can be undone. Once a subscription is `canceled` (it reached `current_period_end`, or it was canceled immediately), it can't be resumed: have the customer subscribe again with a new session.
</Note>

## Authentication

This endpoint requires your **Secret API Key** (server-side only). See [Authentication](/api/authentication) for details.

```bash theme={null}
Authorization: Bearer sk_live_xxxxxxxxxxxx
```

## Path Parameters

<ParamField path="subscription_id" type="string" required>
  The Payviox subscription ID (`psub_...`).
</ParamField>

## Response

The updated [Subscription object](/api/endpoints/get-subscription#the-subscription-object), with `cancel_at_period_end: false` and `cancellation_reason: null`. If no cancellation was scheduled, it returns `200` without changing anything.

## Example Requests

<CodeGroup>
  ```bash cURL theme={null}
  curl https://api.payviox.com/subscriptions/psub_8fKx2LmQp4ZrT7vW1nYc3aBd/resume \
    -H "Authorization: Bearer sk_live_xxxxxxxxxxxx" \
    -X POST
  ```

  ```javascript Node.js theme={null}
  const response = await fetch(
    'https://api.payviox.com/subscriptions/psub_8fKx2LmQp4ZrT7vW1nYc3aBd/resume',
    {
      method: 'POST',
      headers: { Authorization: `Bearer ${process.env.PAYVIOX_SECRET_KEY}` },
    }
  );

  const subscription = await response.json();
  console.log(subscription.cancel_at_period_end); // false
  ```

  ```python Python theme={null}
  import os
  import requests

  response = requests.post(
      'https://api.payviox.com/subscriptions/psub_8fKx2LmQp4ZrT7vW1nYc3aBd/resume',
      headers={'Authorization': f"Bearer {os.environ['PAYVIOX_SECRET_KEY']}"}
  )

  print(response.json()['cancel_at_period_end'])  # False
  ```
</CodeGroup>

## Example Response

<ResponseExample>
  ```json Resumed (200) theme={null}
  {
    "id": "psub_8fKx2LmQp4ZrT7vW1nYc3aBd",
    "status": "active",
    "amount": 999,
    "unit_amount": 1029,
    "currency": "USD",
    "interval": "month",
    "interval_count": 1,
    "interval_label": "every month",
    "customer": "customer_abc123",
    "customer_email": "john@example.com",
    "order_id": "order_12345",
    "items": [
      { "name": "Pro plan", "quantity": 1, "price": 999 }
    ],
    "metadata": { "user_id": "usr_123" },
    "payment_method": "credit",
    "provider": "stripe",
    "provider_subscription_id": "sub_1QxYz2AbCdEfGhIj",
    "cycles_count": 2,
    "current_period_end": "2026-12-13T10:30:00+00:00",
    "cancel_at_period_end": false,
    "canceled_at": null,
    "canceled_by": null,
    "cancel_requested_by": null,
    "cancellation_reason": null,
    "initial_session_id": "a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6",
    "management_url": "https://secure.payviox.com/subscription/k3Jd9QwL2xVb7NmP4tRz8YcF1sHg6UaE5oWi0qXn3BvM7ZpD",
    "created_at": "2026-10-13T10:30:00+00:00"
  }
  ```

  ```json Canceled By The Customer (403) theme={null}
  {
    "error": "subscription_update_failed",
    "message": "Your customer canceled this subscription. Only they can resume it, from their management link."
  }
  ```

  ```json Canceled By Payviox (403) theme={null}
  {
    "error": "subscription_update_failed",
    "message": "This subscription was canceled by Payviox. Contact Payviox support."
  }
  ```

  ```json Already Canceled (409) theme={null}
  {
    "error": "subscription_update_failed",
    "message": "A canceled subscription cannot be resumed."
  }
  ```

  ```json Provider Unreachable (503) theme={null}
  {
    "error": "subscription_update_failed",
    "message": "The payment provider is unreachable. Try again in a moment."
  }
  ```
</ResponseExample>

## Error Responses

<AccordionGroup>
  <Accordion title="401 -- Unauthorized">
    The API key is missing or invalid. This endpoint only accepts your **Secret API Key**.
  </Accordion>

  <Accordion title="403 -- Cancellation scheduled by the customer or Payviox">
    `cancel_requested_by` is `payer` (only the customer can resume, from their management link) or `admin`/`system` (contact support).
  </Accordion>

  <Accordion title="404 -- Subscription not found">
    No subscription with this ID belongs to your business (`subscription_not_found`).
  </Accordion>

  <Accordion title="409 -- Already canceled">
    The subscription has already ended and can't be resumed. A `409` with `The subscription changed meanwhile. Try again.` means it was modified during your request: retry.
  </Accordion>

  <Accordion title="502 -- Provider refused">
    Stripe refused the change. Nothing was changed on Payviox's side: contact [support@payviox.com](mailto:support@payviox.com).
  </Accordion>

  <Accordion title="503 -- Provider unreachable">
    Stripe couldn't be reached, or Stripe isn't configured on your account anymore. Nothing was changed: retry later.
  </Accordion>
</AccordionGroup>


## OpenAPI

````yaml POST /subscriptions/{subscription_id}/resume
openapi: 3.0.3
info:
  title: Payviox API
  description: Payment processing API
  version: 1.0.0
servers:
  - url: https://api.payviox.com
security:
  - bearerAuth: []
paths:
  /subscriptions/{subscription_id}/resume:
    post:
      tags:
        - Subscriptions
      summary: Resume Subscription
      description: >-
        Undo a scheduled cancellation (`cancel_at_period_end: true`) so the
        subscription keeps renewing. Only a cancellation scheduled on your side
        (`cancel_requested_by` `api`, `manager` or `null`) can be resumed; one
        scheduled by the customer or by Payviox returns 403. Requires your
        Secret API Key.
      operationId: resumeSubscription
      parameters:
        - name: subscription_id
          in: path
          required: true
          schema:
            type: string
          description: Payviox subscription ID (`psub_...`)
      responses:
        '200':
          description: >-
            Subscription resumed (or no cancellation was scheduled); returns the
            subscription
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Subscription'
        '401':
          description: Unauthorized (missing or invalid Secret API Key)
        '403':
          description: >-
            The cancellation was scheduled by the customer (`payer`) or by
            Payviox (`admin`, `system`): only they can resume it
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error: subscription_update_failed
                message: >-
                  Your customer canceled this subscription. Only they can resume
                  it, from their management link.
        '404':
          description: No subscription with this ID on your account
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '409':
          description: >-
            A canceled subscription can't be resumed, or it changed during the
            request (retry)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error: subscription_update_failed
                message: A canceled subscription cannot be resumed.
        '502':
          description: Stripe refused the change — contact support
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '503':
          description: Stripe unreachable or not configured — retry later
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    Subscription:
      type: object
      required:
        - id
        - status
        - amount
        - unit_amount
        - currency
        - interval
        - interval_count
        - interval_label
        - order_id
        - cycles_count
        - cancel_at_period_end
        - initial_session_id
        - created_at
      properties:
        id:
          type: string
          description: Payviox subscription ID (`psub_` prefix)
        status:
          type: string
          enum:
            - active
            - past_due
            - canceled
          description: >-
            `active`: paid up, renews automatically (also while a cancellation
            is scheduled, see `cancel_at_period_end`). `past_due`: the last
            renewal charge failed and Stripe is retrying it. `canceled`: ended,
            no further charges.
        amount:
          type: integer
          description: Your price per period in cents — the `amount` of the signup session
        unit_amount:
          type: integer
          description: >-
            Amount charged to the customer at each renewal, in cents. Includes
            the fees added for the customer at checkout, but not one-time add-on
            fees (such as fraud screening) charged on the first payment only, so
            it can be lower than the first charge.
        currency:
          type: string
          description: Always `USD`
        interval:
          type: string
          enum:
            - day
            - week
            - month
            - year
        interval_count:
          type: integer
        interval_label:
          type: string
          description: Human-readable period, e.g. `every month`, `every 3 months`
        customer:
          type: string
          nullable: true
          description: Customer identifier from the signup session
        customer_email:
          type: string
          nullable: true
          description: Customer email, from the signup session or entered at checkout
        order_id:
          type: string
          description: '`order_id` of the signup session. Renewals use `{order_id}-{cycle}`'
        items:
          type: array
          items:
            type: object
            additionalProperties: true
          description: Items of the signup session (one period)
        metadata:
          type: object
          additionalProperties: true
          description: Metadata of the signup session
        payment_method:
          type: string
          enum:
            - credit
            - apple_pay
            - google_pay
          description: Method the customer subscribed with (read with `provider`)
        provider:
          type: string
          description: Provider that charges the renewals (`stripe`)
        provider_subscription_id:
          type: string
          nullable: true
          description: >-
            ID of the subscription on your Stripe account (`sub_...`). `null`
            until Payviox has created it, usually within a minute of the first
            payment.
        cycles_count:
          type: integer
          description: >-
            Billing cycles started so far, signup included (1 = signup only). A
            renewal whose charge failed counts too.
        current_period_end:
          type: string
          format: date-time
          nullable: true
          description: >-
            End of the current billing period: date of the next renewal charge,
            or the date a scheduled cancellation takes effect
        cancel_at_period_end:
          type: boolean
          description: >-
            `true` when the subscription is scheduled to end at
            `current_period_end`
        canceled_at:
          type: string
          format: date-time
          nullable: true
          description: When the subscription ended (`null` while not canceled)
        canceled_by:
          type: string
          nullable: true
          enum:
            - api
            - manager
            - admin
            - payer
            - provider
            - system
            - null
          description: >-
            Who ended it: `api` (your backend), `manager` (your dashboard),
            `admin` (Payviox support), `payer` (the customer, from the
            management link), `provider` (on Stripe, e.g. after failed retries
            or a cancellation in the Stripe dashboard), `system` (Payviox, e.g.
            signup payment refunded or `setup_failed`). `null` until the
            subscription is canceled.
        cancel_requested_by:
          type: string
          nullable: true
          enum:
            - payer
            - api
            - manager
            - admin
            - system
            - null
          description: >-
            Who scheduled the end-of-period cancellation: `payer` (the
            customer), `api`, `manager` (your dashboard), `admin` (Payviox
            support) or `system`. `null` when no cancellation is scheduled, or
            when it was scheduled from your Stripe dashboard. Only the same side
            can resume it: you (`api`, `manager`, `null`), the customer
            (`payer`) or Payviox (`admin`, `system`).
        cancellation_reason:
          type: string
          nullable: true
          description: >-
            Set as soon as a cancellation is requested or scheduled:
            `requested_by_merchant`, `requested_by_customer`,
            `initial_payment_refunded`, `admin` (canceled by Payviox support),
            `setup_failed:<code>`, or a Stripe reason such as `payment_failed`,
            `cancellation_requested`, `provider` or `provider_deleted`. Treat
            unknown values as informational.
        initial_session_id:
          type: string
          description: Session ID of the signup payment
        management_url:
          type: string
          nullable: true
          description: >-
            Customer self-service page (view, cancel at period end, undo). Share
            it with your customer, e.g. in your confirmation email.
        created_at:
          type: string
          format: date-time
      example:
        id: psub_8fKx2LmQp4ZrT7vW1nYc3aBd
        status: active
        amount: 999
        unit_amount: 1029
        currency: USD
        interval: month
        interval_count: 1
        interval_label: every month
        customer: customer_abc123
        customer_email: john@example.com
        order_id: order_12345
        items:
          - name: Pro plan
            quantity: 1
            price: 999
        metadata:
          user_id: usr_123
        payment_method: credit
        provider: stripe
        provider_subscription_id: sub_1QxYz2AbCdEfGhIj
        cycles_count: 2
        current_period_end: '2026-12-13T10:30:00+00:00'
        cancel_at_period_end: false
        canceled_at: null
        canceled_by: null
        cancel_requested_by: null
        cancellation_reason: null
        initial_session_id: a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6
        management_url: >-
          https://secure.payviox.com/subscription/k3Jd9QwL2xVb7NmP4tRz8YcF1sHg6UaE5oWi0qXn3BvM7ZpD
        created_at: '2026-10-13T10:30:00+00:00'
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
          description: Machine-readable error code
        message:
          type: string
          description: Human-readable explanation of what to fix
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````

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