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 } }
Cancel an active subscription
subscriptions:write
Authorization: Bearer YOUR_API_KEY