Stripe pack: cancel a subscription
The cancel_subscription workflow: the subscription cancelled in Stripe with the approved timing, the case resolved, the customer told; every check, its parameters and what each failure looks like.
Last changed Markdown versionllms.txt
One of the five workflows of the Stripe Customer Operations pack, version 2.3.0.
Contract scop_cancel_subscription, action type cancel_subscription, settlement window 1h, on the Builder plan
and above. This page is generated from the pack's own files (the manifest, the contract, the recorder mapping and the
fixture cases as the engine judges them), so it says what the installed pack does.
What the agent does
The agent cancels a customer's subscription in Stripe, either at once or at the end of the period the customer has paid for, as it was approved to, then resolves the support case and tells the customer.
In the pack's words: The active subscription cancelled in Stripe with the approved timing (now or end of period), the case resolved, the customer told; no refund with it; a retried call is one action.
The subject
The Stripe subscription, by its own id (sub_…), which is the id the agent's tool call names.
The action record
What POST /v1/actions carries for this workflow, whether it comes from the recorder, an SDK or your own code. A
required parameter is one a check reads: an action that would pass without it is UNKNOWN on the policy lens with
param_missing:<name>. Amounts are in major units (40.0 for forty dollars).
| Parameter | Required | What reads it |
|---|---|---|
subscription_id |
no | recorded with the action; no check reads it |
customer_reference |
no | recorded with the action; no check reads it |
cancel_at_period_end |
yes | compared with stripe.subscription_canceled.cancel_at_period_end |
reason |
no | recorded with the action; no check reads it |
support_case_id |
no | recorded with the action; no check reads it |
The action of the pack's happy-path fixture, as a request body:
{
"action_id": "cancel:sub_1",
"contract_id": "scop_cancel_subscription",
"subject_id": "sub_1",
"subject_kind": "subscription",
"params": {
"subscription_id": "sub_1",
"customer_reference": "cus_1",
"cancel_at_period_end": false,
"support_case_id": "zendesk_ticket_601",
"reason": "customer_request"
}
}
Tool calls the recorder maps to it
| Tool key | Subject read from | Action id | Note |
|---|---|---|---|
stripe.subscriptions_cancel |
arguments.subscription |
cancel:{arguments.subscription} |
The tool keys and argument names are this pack's convention, not a verified list of any vendor's MCP tools; rename
them to what your server exposes (recorder setup). Calls that render the same action
id are one action when they agree on every parameter both carry (the reason apart, which the rules list under
describes), and the first record stands.
The rule reads the timing from arguments.cancel_at_period_end. Stripe's own cancel-subscription call, as its API
reference read on 13 November 2026, has no such parameter and cancels at once, so a tool shaped after that call sends
none and its action is UNKNOWN on the policy lens (param_missing:cancel_at_period_end). Where the tool does not
state the timing, record the action from your own code with cancel_at_period_end set to what was approved.
What CommitLayer reads, and from which system
Every check of the contract, in the engine's own description of it, with the reason code it reports when it goes
against the action. within times are measured from the action's requested_at.
Before the action (policy lens)
| Check | Read from | When it goes wrong | Reason code |
|---|---|---|---|
| latest stripe.subscription_status before the action had status=active | stripe |
The subscription was not active when the agent cancelled it | precondition_unmet:stripe.subscription_status |
What must be seen afterwards (outcome and policy lens)
| Check | Read from | Trust needed | When it goes wrong | Reason code |
|---|---|---|---|---|
| stripe.subscription_canceled observed within 1h of the action, from a source rated independent or better | stripe |
independent | Stripe does not show the subscription cancelled | expected_effect_missing:stripe.subscription_canceled, effect_below_trust:stripe.subscription_canceled |
| zendesk.status_change observed within 1h of the action where to=solved, from a source rated shared or better | zendesk |
shared | The support case was not resolved | expected_effect_missing:zendesk.status_change, effect_below_trust:zendesk.status_change |
| messaging.customer_notified observed within 1h of the action, from a source rated shared or better | messaging |
shared | No customer notification was recorded | expected_effect_missing:messaging.customer_notified, effect_below_trust:messaging.customer_notified |
What must not be seen (policy lens)
| Check | Read from | When it goes wrong | Reason code |
|---|---|---|---|
| stripe.subscription_canceled cancel_at_period_end differs from the action's cancel_at_period_end | stripe |
Stripe cancelled with a different timing than approved (immediately versus end of period) | effect_attr_mismatch:stripe.subscription_canceled.cancel_at_period_end |
| stripe.refund observed within 1h of the action | stripe |
A refund was issued with the cancellation; refunds are approved separately | effect_observed:stripe.refund |
What undoes it later (outcome and policy lens)
| Check | Read from | When it goes wrong | Reason code |
|---|---|---|---|
| zendesk.reopen observed within 14d of the action, undoing it | zendesk |
The support case was reopened | reversed:zendesk.reopen |
How the case-resolved check reads a help desk. It looks for a status_change whose to attribute is the resolved
status (solved by default; Intercom closes a conversation, so set closed for it), which is how the Zendesk,
Intercom, Salesforce and HubSpot connectors record a status change. A help desk you push from sends status_change
with the same from and to attributes. Version 2.0.0 read a status attribute that no connector writes, so a case
solved in a connected help desk read expected_effect_missing:<help desk>.status_change. See connector
requirements.
What makes it unverifiable
When stripe has never reported in the workspace, both lenses are UNKNOWN with missing_fact_source: there is
nothing to judge the action against.
What settles it
Pending while Stripe has not reported past the action's window; until then the view shows a provisional verdict, which
reads FAIL for an effect not seen yet. Stripe records a scheduled cancellation at once (canceled_at with
cancel_at_period_end), so an end-of-period cancellation settles like an immediate one; the flag is compared with the
approval.
A verdict is pending until then, and the pending view shows the provisional verdict of the evidence so far. A case
reopened within 14 days re-verifies the action and fails it. A subscription resumed after a scheduled cancellation is
not visible to the connector (Stripe keeps no timestamp for it); the next versions read Stripe events for it.
Identity links it needs
| Link | From | To | Who makes it |
|---|---|---|---|
subscription_to_customer |
stripe subscription | stripe customer | Made by the Stripe connector on every sync from the subscription's customer, so a refund on the customer is visible to a cancellation. Nothing to push. |
ticket_to_subscription |
zendesk ticket | stripe subscription | The ticket names the subscription it is about (the Stripe id, sub_…); push the link beside the ticket facts or with the action. |
A link is pushed in the links field of POST /v1/facts with its link_type. The pack's coverage (GET /v1/packs/stripe_customer_operations/coverage) counts the links it has seen of each type.
Parameters and their defaults
Set in the install wizard, or in configuration on the pack's configure, dry-run and install routes as
{"cancel_subscription": {"<key>": <value>}}. A value that makes a check weaker than the default (a higher limit, a
longer window) is listed as a warning before anything is saved.
| Key | What it sets | Default | Type | Places in the contract |
|---|---|---|---|---|
window |
How long Stripe and the help desk have to show the effects | 1h |
duration | 1 |
active_status |
The Stripe subscription status the agent may cancel from | active |
string: one of active, trialing, past_due |
1 |
helpdesk_source |
The system of record for support cases | zendesk |
source | 2 |
case_resolved_status |
The helpdesk status that means the case is resolved | solved |
string | 1 |
What each failure looks like
The pack's 12 fixture cases for this workflow, with the verdict the engine returns for each under the default parameters (a case written for one combination of systems under that configuration): the outcome lens (did it happen), the policy lens (was it allowed and done as approved), the status, and the reason codes of both lenses. These are the cases the dry run replays in your workspace. What each code means and what to do about it is on the failure interpretation page.
| Case | What is staged | Outcome | Policy | Status | Reason codes |
|---|---|---|---|---|---|
happy_path |
Subscription cancelled immediately as approved; case solved; customer told | PASS | PASS | settled | effect_observed:stripe.subscription_canceled, effect_observed:zendesk.status_change, effect_observed:messaging.customer_notified |
stripe_still_billing |
The tool reported the cancellation; Stripe still shows the subscription active | FAIL | FAIL | settled | verified_condition_not_met, expected_effect_missing:stripe.subscription_canceled |
cancelled_now_when_period_end_was_approved |
Approved for the end of the period; Stripe cancelled immediately and the customer lost access | PASS | FAIL | settled | effect_observed:stripe.subscription_canceled, effect_observed:zendesk.status_change, effect_observed:messaging.customer_notified, effect_attr_mismatch:stripe.subscription_canceled.cancel_at_period_end |
period_end_as_approved |
Approved and scheduled for the end of the period | PASS | PASS | settled | effect_observed:stripe.subscription_canceled, effect_observed:zendesk.status_change, effect_observed:messaging.customer_notified |
subscription_was_not_active |
The subscription was already cancelled before the agent acted | PASS | FAIL | settled | effect_observed:stripe.subscription_canceled, effect_observed:zendesk.status_change, effect_observed:messaging.customer_notified, precondition_unmet:stripe.subscription_status |
refund_with_the_cancellation |
The agent also refunded the last payment, which the approval did not cover | PASS | FAIL | settled | effect_observed:stripe.subscription_canceled, effect_observed:zendesk.status_change, effect_observed:messaging.customer_notified, effect_observed:stripe.refund |
case_not_resolved |
Stripe shows the cancellation; the ticket is still open | FAIL | FAIL | settled | verified_condition_not_met, expected_effect_missing:zendesk.status_change |
retried_tool_call |
The cancel call timed out and was retried: one action, not two | PASS | PASS | settled | effect_observed:stripe.subscription_canceled, effect_observed:zendesk.status_change, effect_observed:messaging.customer_notified |
only_the_agent_says_so |
The cancellation fact was pushed by the agent's own key, not read from Stripe | FAIL | FAIL | settled | verified_condition_not_met, effect_below_trust:stripe.subscription_canceled |
delayed_evidence |
Stripe has not reported past the action's window yet: nothing is asserted until it does | FAIL | FAIL | pending | verified_condition_not_met, expected_effect_missing:stripe.subscription_canceled |
source_unavailable |
No Stripe connection at all | UNKNOWN | UNKNOWN | settled | missing_fact_source |
case_reopened |
The customer came back a week later: the case was reopened | PASS | PASS | settled | effect_observed:stripe.subscription_canceled, effect_observed:zendesk.status_change, effect_observed:messaging.customer_notified |
| the same case after the later record arrives | FAIL | FAIL | settled | reversed:zendesk.reopen |