Cancel subscription

Cancel a subscription now, at the end of the term or on a date.

POST https://cotlet.dev/api/v1/chargebee/subscriptions/{subscription_id}/cancel

write Confirm

Cancels the subscription and returns its new status and any credit notes Chargebee raised. credit_option sets how unused time on an immediate cancellation is credited; leave it out to use your site setting. refundable_credits_handling schedule_refund sends refundable credits back at once, no_action leaves a credit note with refund due. Contract term subscriptions need contract_term_cancel_option. This cancels a customer's service and can move money, so by default you confirm each call; you can switch that off for this tool.

Parameters

Parameters: cancel_subscription
NameTypeDescription
subscription_id string required string Subscription ID from list_subscriptions.
cancel_option enum enum immediately, end_of_term, specific_date or end_of_billing_term. For subscriptions without a contract term. Default: immediately.
cancel_at datetime datetime With specific_date: when the cancellation takes effect.
credit_option_for_current_term_charges enum enum With immediately: none, prorate, full or consumption_based. Default: your site setting.
refundable_credits_handling enum enum no_action or schedule_refund. Default: your site setting.
contract_term_cancel_option enum enum Required with a contract term: terminate_immediately, end_of_contract_term, specific_date or end_of_subscription_billing_term. The last two need Chargebee Support to enable them.
cancel_reason_code string string A reason code configured in Chargebee, case-sensitive. Required if your site makes reason codes mandatory.

Request

cURL
curl -X POST https://cotlet.dev/api/v1/chargebee/subscriptions/sub_9s2kQw/cancel \
  -H "Authorization: Bearer $COTLET_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"cancel_option":"immediately","credit_option_for_current_term_charges":"prorate","refundable_credits_handling":"no_action"}'
Python
result = client.call("chargebee", "cancel_subscription", {"subscription_id":"sub_9s2kQw","cancel_option":"immediately","credit_option_for_current_term_charges":"prorate","refundable_credits_handling":"no_action"})
Node.js
const result = await cotlet.call('chargebee', 'cancel_subscription', {"subscription_id":"sub_9s2kQw","cancel_option":"immediately","credit_option_for_current_term_charges":"prorate","refundable_credits_handling":"no_action"});
CLI
cotlet call chargebee cancel_subscription --data '{"subscription_id":"sub_9s2kQw","cancel_option":"immediately","credit_option_for_current_term_charges":"prorate","refundable_credits_handling":"no_action"}'

Example response

JSON

{
  "subscription": {
    "subscription_id": "sub_9s2kQw",
    "customer_id": "cus_9s2kQw",
    "status": "cancelled",
    "cancelled_at": "2026-10-16T11:30:00Z"
  },
  "credit_notes": [
    {
      "credit_note_id": "CN-318",
      "type": "refundable",
      "status": "refund_due",
      "total": 14950,
      "reference_invoice_id": "INV-1042"
    }
  ]
}

Sign in once. Your agent does the rest.

Sign up and add the apps you need. Free 7-day trial with 2,000 credits, no card needed.