curl "https://api.integrateledger.com/v1/customers/subscription-items/7/cancellation?customerId=user_123" \
-H "Authorization: Bearer $LEDGER_API_KEY" \
-H "Idempotency-Key: cancel_sso_123" \
-H "Content-Type: application/json" \
-d '{"timing": "period_end"}'
import ledger from "integrateledger";
const client = new ledger({ apiKey: process.env.LEDGER_API_KEY ?? "" });
const cancelled = await client.cancelSubscriptionItem({
itemId: 7,
customerId: "user_123",
idempotencyKey: "cancel_sso_123",
body: { timing: "period_end" },
});
console.log(cancelled.item.status);
import os
from integrateledger import ledger
client = ledger(api_key=os.environ["LEDGER_API_KEY"])
cancelled = client.cancel_subscription_item(
customer_id="user_123", item_id=7, timing="period_end", idempotency_key="cancel_sso_123"
)
print(cancelled["item"]["status"])
{
"itemChangeId": 12,
"timing": "period_end",
"status": "scheduled",
"item": {
"id": 7,
"planId": "sso_addon",
"kind": "add_on",
"group": "default",
"quantity": 1,
"status": "canceling",
"endsAt": "2026-12-07T07:40:38.000Z"
}
}
{
"error": "item_not_cancellable"
}
Customers
Cancel a subscription item
End one recurring add-on on a customer’s subscription, at the period end or now, with no refund.
POST
/
v1
/
customers
/
subscription-items
/
{itemId}
/
cancellation
curl "https://api.integrateledger.com/v1/customers/subscription-items/7/cancellation?customerId=user_123" \
-H "Authorization: Bearer $LEDGER_API_KEY" \
-H "Idempotency-Key: cancel_sso_123" \
-H "Content-Type: application/json" \
-d '{"timing": "period_end"}'
import ledger from "integrateledger";
const client = new ledger({ apiKey: process.env.LEDGER_API_KEY ?? "" });
const cancelled = await client.cancelSubscriptionItem({
itemId: 7,
customerId: "user_123",
idempotencyKey: "cancel_sso_123",
body: { timing: "period_end" },
});
console.log(cancelled.item.status);
import os
from integrateledger import ledger
client = ledger(api_key=os.environ["LEDGER_API_KEY"])
cancelled = client.cancel_subscription_item(
customer_id="user_123", item_id=7, timing="period_end", idempotency_key="cancel_sso_123"
)
print(cancelled["item"]["status"])
{
"itemChangeId": 12,
"timing": "period_end",
"status": "scheduled",
"item": {
"id": 7,
"planId": "sso_addon",
"kind": "add_on",
"group": "default",
"quantity": 1,
"status": "canceling",
"endsAt": "2026-12-07T07:40:38.000Z"
}
}
{
"error": "item_not_cancellable"
}
Cancels one recurring add-on (a plan with
addOn: true) on the customer’s subscription. The base plan and any other add-ons are untouched.
timing: "period_end"(the default): the item becomescanceling, withendsAtat the period end. Its features and credits last until then, and the renewal bills the subscription without it, with no proration. The item then ends.timing: "immediately": the item ends now, and its credits and features end with it. Stripe stops billing it from now on, and nothing is refunded or credited.itemIdis anidfrom the subscription’sitemsin List customer subscriptions;customerIdgoes in the query string.- Send an
Idempotency-Keyheader, and reuse it on every retry of the same cancellation. Without one the request is refused with400 idempotency_key_required. - The base plan’s item is refused with
400 item_not_cancellable: stop its renewal with Stop or resume renewal, which ends the whole subscription. - An item that already ended is
409 item_ended. A change on the subscription still waiting on payment is409 subscription_change_pending, and a downgrade scheduled for the period end is409 downgrade_scheduled: cancel the downgrade first. While an add-on is canceling, attaching another add-on, upgrading or downgrading is409 subscription_change_pendinguntil the renewal. - Cancelling an add-on that is already canceling at the period end returns that cancellation.
curl "https://api.integrateledger.com/v1/customers/subscription-items/7/cancellation?customerId=user_123" \
-H "Authorization: Bearer $LEDGER_API_KEY" \
-H "Idempotency-Key: cancel_sso_123" \
-H "Content-Type: application/json" \
-d '{"timing": "period_end"}'
import ledger from "integrateledger";
const client = new ledger({ apiKey: process.env.LEDGER_API_KEY ?? "" });
const cancelled = await client.cancelSubscriptionItem({
itemId: 7,
customerId: "user_123",
idempotencyKey: "cancel_sso_123",
body: { timing: "period_end" },
});
console.log(cancelled.item.status);
import os
from integrateledger import ledger
client = ledger(api_key=os.environ["LEDGER_API_KEY"])
cancelled = client.cancel_subscription_item(
customer_id="user_123", item_id=7, timing="period_end", idempotency_key="cancel_sso_123"
)
print(cancelled["item"]["status"])
{
"itemChangeId": 12,
"timing": "period_end",
"status": "scheduled",
"item": {
"id": 7,
"planId": "sso_addon",
"kind": "add_on",
"group": "default",
"quantity": 1,
"status": "canceling",
"endsAt": "2026-12-07T07:40:38.000Z"
}
}
{
"error": "item_not_cancellable"
}
Authorizations
Headers
Path Parameters
Query Parameters
Body
application/json
Response
The cancellation, and the item as it stands now