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 with subscriptions:write
permissions.
Authorization: Bearer YOUR_API_KEY
Path Parameters
The unique identifier of the subscription to cancel
Request Body
If true, cancel at end of current period. If false, cancel immediately (default: true)
Cancellation reason: “too_expensive”, “missing_features”, “not_using”, “switching_provider”, “other”
Additional feedback about cancellation
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"
}'
{
"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
}
}