curl --location --request POST 'https://api.stateset.com/v1/subscriptions/sub_0901f083-aa1c-43c5-af5c-0a9d2fc64e30/cancel' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--data-raw '{
"cancel_at_period_end": true,
"reason": "too_expensive",
"feedback": "The pricing increased beyond our budget"
}'
const subscription = await stateset.subscriptions.cancel(
'sub_0901f083-aa1c-43c5-af5c-0a9d2fc64e30',
{
cancel_at_period_end: true,
reason: "too_expensive",
feedback: "The pricing increased beyond our budget"
}
);
subscription = stateset.subscriptions.cancel(
'sub_0901f083-aa1c-43c5-af5c-0a9d2fc64e30',
cancel_at_period_end=True,
reason="too_expensive",
feedback="The pricing increased beyond our budget"
)
{
"id": "sub_0901f083-aa1c-43c5-af5c-0a9d2fc64e30",
"object": "subscription",
"status": "active",
"cancel_at_period_end": true,
"cancel_at": "2024-03-01T00:00:00Z",
"cancelled_at": "2024-01-20T15:00:00Z",
"cancellation_details": {
"reason": "too_expensive",
"feedback": "The pricing increased beyond our budget",
"cancelled_by": "user_123"
},
"current_period_end": "2024-03-01",
"ended_at": null,
"customer_id": "cust_abc123",
"plan": {
"id": "plan_monthly_pro",
"name": "Professional Monthly"
},
"metadata": {
"cancellation_flow": "customer_portal",
"retention_offered": true,
"retention_accepted": false
}
}
Cancel Subscription
Cancel an active subscription
POST
/
v1
/
subscriptions
/
:id
/
cancel
curl --location --request POST 'https://api.stateset.com/v1/subscriptions/sub_0901f083-aa1c-43c5-af5c-0a9d2fc64e30/cancel' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--data-raw '{
"cancel_at_period_end": true,
"reason": "too_expensive",
"feedback": "The pricing increased beyond our budget"
}'
const subscription = await stateset.subscriptions.cancel(
'sub_0901f083-aa1c-43c5-af5c-0a9d2fc64e30',
{
cancel_at_period_end: true,
reason: "too_expensive",
feedback: "The pricing increased beyond our budget"
}
);
subscription = stateset.subscriptions.cancel(
'sub_0901f083-aa1c-43c5-af5c-0a9d2fc64e30',
cancel_at_period_end=True,
reason="too_expensive",
feedback="The pricing increased beyond our budget"
)
{
"id": "sub_0901f083-aa1c-43c5-af5c-0a9d2fc64e30",
"object": "subscription",
"status": "active",
"cancel_at_period_end": true,
"cancel_at": "2024-03-01T00:00:00Z",
"cancelled_at": "2024-01-20T15:00:00Z",
"cancellation_details": {
"reason": "too_expensive",
"feedback": "The pricing increased beyond our budget",
"cancelled_by": "user_123"
},
"current_period_end": "2024-03-01",
"ended_at": null,
"customer_id": "cust_abc123",
"plan": {
"id": "plan_monthly_pro",
"name": "Professional Monthly"
},
"metadata": {
"cancellation_flow": "customer_portal",
"retention_offered": true,
"retention_accepted": false
}
}
This endpoint cancels a subscription. You can choose to cancel immediately or at the end of the current billing period.
Authentication
This endpoint requires a valid API key withsubscriptions:write permissions.
Authorization: Bearer YOUR_API_KEY
Path Parameters
string
required
The unique identifier of the subscription to cancel
Request Body
boolean
If true, cancel at end of current period. If false, cancel immediately (default: true)
string
Cancellation reason: “too_expensive”, “missing_features”, “not_using”, “switching_provider”, “other”
string
Additional feedback about cancellation
boolean
Override to cancel immediately regardless of period
Response
Returns the cancelled subscription object.curl --location --request POST 'https://api.stateset.com/v1/subscriptions/sub_0901f083-aa1c-43c5-af5c-0a9d2fc64e30/cancel' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--data-raw '{
"cancel_at_period_end": true,
"reason": "too_expensive",
"feedback": "The pricing increased beyond our budget"
}'
const subscription = await stateset.subscriptions.cancel(
'sub_0901f083-aa1c-43c5-af5c-0a9d2fc64e30',
{
cancel_at_period_end: true,
reason: "too_expensive",
feedback: "The pricing increased beyond our budget"
}
);
subscription = stateset.subscriptions.cancel(
'sub_0901f083-aa1c-43c5-af5c-0a9d2fc64e30',
cancel_at_period_end=True,
reason="too_expensive",
feedback="The pricing increased beyond our budget"
)
{
"id": "sub_0901f083-aa1c-43c5-af5c-0a9d2fc64e30",
"object": "subscription",
"status": "active",
"cancel_at_period_end": true,
"cancel_at": "2024-03-01T00:00:00Z",
"cancelled_at": "2024-01-20T15:00:00Z",
"cancellation_details": {
"reason": "too_expensive",
"feedback": "The pricing increased beyond our budget",
"cancelled_by": "user_123"
},
"current_period_end": "2024-03-01",
"ended_at": null,
"customer_id": "cust_abc123",
"plan": {
"id": "plan_monthly_pro",
"name": "Professional Monthly"
},
"metadata": {
"cancellation_flow": "customer_portal",
"retention_offered": true,
"retention_accepted": false
}
}
⌘I