Chargebee automation · runs weekly
Cancel Chargebee subscriptions and credit the unused time
A cancellation request lands in support, and someone has to find the customer in Chargebee, open the right subscription, choose when it ends and decide what happens to the days the customer already paid for.
Cotlet does it in your own Chargebee account with find_customer, list_subscriptions and cancel_subscription, called by your AI agent, an n8n workflow or a script.
Hosted · nothing to install or maintain
Can Chargebee do this on its own?
Chargebee's REST API cancels subscriptions through cancel_for_items, with options for timing, proration, unbilled charges, past-due invoices and refundable credits (checked 14 Oct 2026). Its ready-made MCP servers cannot cancel, and the custom MCP server tool list is not published. Anyone who wants an agent to cancel has to build a server or script around the API with a site API key.
How you do it in Chargebee today
- Find the customer, then open the subscription's details page by clicking its subscription ID.
- In the Actions panel, click Cancel Subscription (Chargebee's docs also call it Cancel/Reactivate Subscription).
- Choose when the cancellation takes effect: immediately, at the end of the term, or on a specific date.
- For an immediate cancellation, check how the unused part of the term is credited. Chargebee's docs say a scheduled cancellation starts any refund on the cancellation date, not on the day you scheduled it.
- For a batch, select subscriptions on the Subscriptions page, choose More > Cancel Subscription, fill in the dialog and click Apply Changes. Chargebee's docs say only Admins can run bulk actions.
How to cancel Chargebee subscriptions and credit the unused time
Cancel the Chargebee subscription for billing@brightleaf.example now and prorate the unused time. If it has a contract term or is already cancelled, stop and tell me. - 01
Find the one subscription
Your agent looks the customer up by the email in your prompt, then reads their subscriptions. If the email matches no customer or the customer has two active subscriptions, it asks which one instead of guessing.
- 02
Skip what is already ending
A subscription in cancelled or non_renewing status needs no cancel call. The agent reports its state and the date it ends, so a double request does not raise a second set of credit notes.
- 03
Turn the wording into timing
"Now" becomes immediately, "at renewal" becomes end_of_term, a date becomes specific_date. If the subscription has a contract term, Chargebee requires a separate contract term option, and the agent asks which one you mean.
- 04
Set credit handling only when you said so
The agent sends prorate, full or none only if your prompt names one. Otherwise it leaves the field out, and Chargebee applies your site's default for unused time.
- 05
Report the credit notes
After your OK, the agent cancels and lists the credit notes Chargebee raised, with type, amount and status, so finance can see whether a refund is waiting.
What you get back
Cancelled sub_9s2kQw (Growth, monthly) for Brightleaf Analytics, effective now
Status: cancelled
Unused 15 of 30 days credited by proration
Credit note CN-318: refundable, $149.50, refund due
Refund not sent: refundable credits left for finance Other ways to ask
- Cancel the subscription for acme-ops.example at the end of the current term and tell me the date it ends.
- Every Friday, list active subscriptions whose customers wrote "cancel" in this week's support tickets and ask me before cancelling any of them.
- Cancel immediately with no credit for the unused time, and write the cancel reason code "Churn: price" on it.
What Chargebee allows, and what to know first
- For subscriptions without a contract term, Chargebee accepts cancel_option values immediately, end_of_term, specific_date and end_of_billing_term.
- Credit for unused time on an immediate cancellation is set with credit_option_for_current_term_charges: none, prorate, full or consumption_based. If omitted, Chargebee uses the site setting.
- Contract term subscriptions need a contract term cancel option instead, and two of its values (specific date and end of subscription billing term) must be switched on by Chargebee Support.
- A cancel reason code must match a code configured in Chargebee and is required when your site makes reason codes mandatory.
- Chargebee lets you reactivate a cancelled subscription only if it has card information, and a decommissioned subscription can never be reactivated.
cancel_subscription asks for your OK by default. To run it weekly without you, switch confirmation off for that tool in your dashboard.
Sources: Chargebee Docs: How do I cancel a subscription in Chargebee? · Chargebee Docs: Working with Subscriptions · Chargebee API: Cancel a subscription · Chargebee Docs: What happens when I schedule a cancellation?
Call cancel_subscription from a script
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"}' {
"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"
}
]
} MCP: add https://cotlet.dev/mcp/v1 with the same key; the call is chargebee_write → cancel_subscription. Example data.
Schedule it in n8n, Make, Zapier or cronChargebee tools this automation uses
| Tool | Parameters |
|---|---|
| find_customer | email, company, first_name, last_name, limit, cursor |
| list_subscriptions | customer_id, status, item_price_id, next_billing_before, limit, cursor |
| cancel_subscription | subscription_id, cancel_option, cancel_at, credit_option_for_current_term_charges, refundable_credits_handling, contract_term_cancel_option, cancel_reason_code |
Frequently asked questions
Is it safe to connect Chargebee to Cotlet?
Yes. You sign in to Chargebee yourself, in your own Cloud Browser in the EU, and we never save your password. Your agents only get Chargebee once you enable it, every background request is listed, and the browser profile is stored encrypted with AES-256-GCM, the cipher 1Password uses for its vaults. The AI model never sees a login, posts and messages wait for your OK, and Disable for agents cuts access in one click. Independent scanners grade cotlet.dev A+ on Qualys SSL Labs, securityheaders.com and Mozilla Observatory; live results are on https://cotlet.dev/security.
Give your agent access to Chargebee.
Free 7-day trial with 2,000 credits, no card needed. Cotlet is independent and not affiliated with Chargebee.