Skip to main content
POST
/
api
/
v1
/
subscriptions
/
{id}
/
cancel
JavaScript
import Stigg from '@stigg/typescript';

const client = new Stigg({
  apiKey: process.env['STIGG_API_KEY'], // This is the default and can be omitted
});

const subscription = await client.v1.subscriptions.cancel('x');

console.log(subscription.data);
{
  "data": {
    "id": "<string>",
    "customerId": "<string>",
    "billingId": "<string>",
    "createdAt": "2023-11-07T05:31:56Z",
    "startDate": "2023-11-07T05:31:56Z",
    "status": "PAYMENT_PENDING",
    "pricingType": "FREE",
    "paymentCollection": "NOT_REQUIRED",
    "planId": "<string>",
    "payingCustomerId": "<string>",
    "resourceId": "<string>",
    "endDate": "2023-11-07T05:31:56Z",
    "effectiveEndDate": "2023-11-07T05:31:56Z",
    "cancellationDate": "2023-11-07T05:31:56Z",
    "trialEndDate": "2023-11-07T05:31:56Z",
    "cancelReason": "UPGRADE_OR_DOWNGRADE",
    "metadata": {},
    "currentBillingPeriodStart": "2023-11-07T05:31:56Z",
    "currentBillingPeriodEnd": "2023-11-07T05:31:56Z",
    "paymentCollectionMethod": "CHARGE",
    "prices": []
  }
}

Authorizations

X-API-KEY
string
header
required

Server API Key

Headers

X-API-KEY
string
required

API Key

Path Parameters

id
string
required

The unique identifier of the entity

Required string length: 1 - 255

Body

application/json

Cancel a subscription with configurable timing and action. Supports immediate cancellation, end-of-period cancellation, or cancellation on a specific date with optional prorated refunds.

endDate
string<date-time>

Subscription end date

cancellationAction
enum<string>

Action on cancellation (downgrade or revoke)

Available options:
DEFAULT,
REVOKE_ENTITLEMENTS
cancellationTime
enum<string>

When to cancel (immediate, period end, or date)

Available options:
END_OF_BILLING_PERIOD,
IMMEDIATE,
SPECIFIC_DATE
prorate
boolean

If set, enables or disables prorating of credits on subscription cancellation.

Response

OK

Response object

data
Subscription · object
required

Customer subscription to a plan