ClocknextClocknextHelp
DocumentationAPI ReferenceMCP Tools
Dashboard

Get started

OverviewQuickstart

Good to know

Response formatHandling errorsPaginating resultsSending data reliablyYour own customer idsWebhooks

API reference

Signals

Record credit POSTRecord outcome POSTComplete outcome POSTRecord wallet POSTRecord unit POSTComplete composite POSTList raw signals GETRetry signals POSTList Customer Usage Log GETLook Up Usage Logs by ID GET

Deprecated

Record credit POSTRecord outcome POSTComplete outcome POSTRecord wallet POSTRecord unit POSTComplete composite POSTList raw signals GETRetry signals POST

Customers

List customers GETCreate a customer POSTGet a customer GETUpdate a customer PATCHDelete a customer DELETEGet a customer's balances GETGet a customer's wallet ledger GETSet a customer's low-balance alert for wallet PUTGet a customer's current plan GETChange a recurring grant PUTUpdate a customer's card POSTGet a customer's invoice balance GETAdjust a customer's invoice balance POST

Deprecated

List Customer Usage Log GETLook Up Usage Logs by ID GET

Manage

Manage a customer's credit balance POSTManage a customer's outcome balance POSTManage a customer's unit balance POSTManage a customer's composite balance POSTManage a customer's wallet balance POST

Members

List a customer's members GETAdd a member POSTUpdate a member PATCHRemove a member DELETE

Plans and Entitlements

PlansPackagesCreditsOutcomesUnitsComposites

Taxes

List taxes GETCreate a tax POSTGet a tax GETUpdate a tax PATCH

Purchases

List purchases GETCreate a purchase POSTGet a purchase GETUpdate a purchase's auto-payment setting PATCHCancel a purchase POST

Checkout

Create a checkout POST

Subscriptions

List subscriptions GETGet a subscription GETCancel a subscription POSTAdd packages to a subscription POSTRemove a package from a subscription POST

Plan changes

List plan changes GETPreview a plan change POSTChange a customer's plan POSTGet a plan change GET

Invoices

List invoices GETGet an invoice GETMint a hosted pay link GETRecord a payment POST

Credit notes

List credit notes GETCreate a credit note POSTGet a credit note GETVoid a credit note POST

Refunds

List refunds GETRefund to the card POSTGet a refund GET

Payments

List payments GETGet a payment GET

Webhooks

subscription.created POSTsubscription.activated POSTsubscription.renewed POSTsubscription.on_hold POSTsubscription.resumed POSTsubscription.cancellation_scheduled POSTsubscription.cancelled POST

Customer Portal

Mint a customer-portal access token POST
Subscription

subscription.cancelled

Triggered when a subscription ends — cancelled, replaced by a plan change, or unpaid.

Header Parameters

X-Clocknext-Signature*string

t=<unix seconds>,v1=<hex HMAC-SHA256> — the HMAC of ${t}.${rawBody} keyed with the endpoint's signing secret. See Verify the signature.

X-Clocknext-Event-Id*string

The event's id — the same as id in the body, and the same on every retry.

X-Clocknext-Event-Type*string

The event name — the same as event_type in the body.

Request Body

application/json
  1. body
  1. body
  2. …
id*string

evt_ + 32 hex characters. Unique per event, and the same on every retry of it — use it to skip duplicates.

event_type*string

Always subscription.cancelled.

triggered_at*string

When the event was triggered (ISO 8601).

Formatdate-time
data*

The customer, why the subscription ended, and the subscription.

Response Body

Answer any 2xx within 5 seconds; the body is ignored. Anything else counts as failed and is retried.

Example Requests
POST/subscription.cancelled
Request Body
application/json
{  "id": "evt_b03de1015f7cb36b159eccc57e7c33b8",  "event_type": "subscription.cancelled",  "triggered_at": "2026-11-01T00:00:03.862Z",  "data": {    "customer": {      "id": "cus_abc123",      "name": "Acme Corp"    },    "reason": "CANCELLED",    "subscription": {      "id": "pur_ghi789",      "number": "SUB-0004",      "status": "CANCELLED",      "plan": {        "id": "plan_growth",        "name": "Growth"      },      "billing_cycle": "MONTHLY",      "starts_at": "2026-10-01T00:00:00.000Z",      "current_period_start": null,      "current_period_end": null,      "next_renewal_date": null,      "hold_ends_at": null,      "cancel_requested_at": null,      "ends_at": null,      "cancel_reason": "Too expensive"    }  }}
Header Parameters
{  "X-Clocknext-Signature": "t=1791367200,v1=5257a869e7ecebeda32affa62cdca3fa51cad7e77a0e56ff536d0ce8e108d8bd",  "X-Clocknext-Event-Id": "evt_b03de1015f7cb36b159eccc57e7c33b8",  "X-Clocknext-Event-Type": "subscription.cancelled"}

Types

Every object type on this page, with its fields.

SubscriptionCancelledEvent

FieldTypeRequiredDescription
idstringyesevt_ + 32 hex characters. Unique per event, and the same on every retry of it — use it to skip duplicates.
event_typestringyesAlways subscription.cancelled.
triggered_atstringyesWhen the event was triggered (ISO 8601).
dataSubscriptionCancelledDatayesThe customer, why the subscription ended, and the subscription.

SubscriptionCancelledData

The data object of a subscription.cancelled event: the customer, why the subscription ended, and the subscription.

FieldTypeRequiredDescription
customerWebhookCustomeryesThe customer the event is about.
reason"CANCELLED" | "PLAN_CHANGE" | "HOLD_EXPIRED" | "UNPAID"yesCANCELLED, PLAN_CHANGE (another plan replaced it), HOLD_EXPIRED or UNPAID (first invoice unpaid).
subscriptionWebhookSubscriptionyesThe subscription when the event is triggered.

WebhookCustomer

The customer the event is about.

FieldTypeRequiredDescription
idstringyesThe customer's Clocknext id.
namestringyesThe customer's name.

WebhookSubscription

The subscription when the event is triggered, as Get a subscription returns its current period.

FieldTypeRequiredDescription
idstringyesThe subscription's id — its purchaseId in the Subscriptions API.
numberstring | nullyesThe subscription's number.
status"SCHEDULED" | "ACTIVE" | "MARKED_FOR_CANCELLATION" | "CANCELLED"yesSCHEDULED, ACTIVE (also on hold, see hold_ends_at), MARKED_FOR_CANCELLATION or CANCELLED.
planobjectyesThe plan the subscription is for.
billing_cycle"MONTHLY" | "QUARTERLY" | "SEMI_ANNUAL" | "YEARLY" | "FREE"yesHow often the subscription renews.
starts_atstring | nullyesWhen the current period started; the planned start date while SCHEDULED.
current_period_startstring | nullyesThe start of the running period. Null when it isn't running (SCHEDULED, CANCELLED).
current_period_endstring | nullyesThe end of the running period. Null when it isn't running (SCHEDULED, CANCELLED).
next_renewal_datestring | nullyesWhen it renews next. Null when it won't renew.
hold_ends_atstring | nullyesThe deadline to pay a held renewal or a first invoice; unpaid, the subscription is cancelled. Else null.
cancel_requested_atstring | nullyesWhen it was marked for cancellation. Null when it wasn't.
ends_atstring | nullyesWhen a MARKED_FOR_CANCELLATION subscription ends. Null otherwise.
cancel_reasonstring | nullyesThe text typed when it was cancelled. Null when none was given.

WebhookSubscription.plan

The plan the subscription is for.

FieldTypeRequiredDescription
idstring | nullyesThe plan's id.
namestringyesThe plan's name.

subscription.cancellation_scheduled POST

Triggered when a subscription is marked to end at the end of its paid period. It keeps working until then.

package.added POST

Triggered when a package on a subscription becomes active: its invoice is paid or recorded as paid. An unpaid attach is announced by `invoice.created`.