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

Customer Portal

Mint a customer-portal access token POST

Mint a customer-portal access token

Returns a short-lived HS256 JWT for the customer portal. A customer not in the key's organisation is reported as 400 here (not 404); an organizationId mismatch is 403. When your Clocknext plan does not include the Customer portal, every call is 403 FEATURE_LOCKED.

Base URL https://payments.clocknext.com/api/v1

POST
/portal/token

Authorization

apiKey
headerAuthorizationBearer <cnk_…>

Organisation-scoped key from Settings → API Keys.

Request Body

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

The ClockNext id of the customer the portal is for. Your own externalId is not accepted here.

Length1 <= length
organizationId?string

If present, must equal the key's organisation (else 403).

Length1 <= length
ttlSeconds?integer

Clamped to the organisation's configured TTL cap.

Range1 <= value <= 3600
memberEmail?string

Paid-by / receipt email; embedded as the token's email claim.

Formatemail

Response Body

Token minted.

application/json
  1. response
  1. response
  2. …
statusCode*integer

The HTTP status code of the response, repeated in the body.

statusDetail*

The status of the request. status is SUCCESS, and message says what happened.

result*

The customer-portal token and when it expires.

curl -X POST 'https://payments.clocknext.com/api/v1/portal/token' \  -H 'Content-Type: application/json' \  -d '{  "customerId": "cmvgva5po000c07iir1vtn8vl"}'
Example Response
{  "statusCode": 200,  "statusDetail": {    "status": "SUCCESS",    "message": "Request processed successfully."  },  "result": {    "token": "eyJhbGciO…redacted",    "expiresAt": 1792516260,    "expiresIn": 3600  }}

Types

Every object type on this page, with its fields.

PortalTokenInput

FieldTypeRequiredDescription
customerIdstringyesThe ClockNext id of the customer the portal is for. Your own externalId is not accepted here.
organizationIdstringnoIf present, must equal the key's organisation (else 403).
ttlSecondsintegernoClamped to the organisation's configured TTL cap.
memberEmailstringnoPaid-by / receipt email; embedded as the token's email claim.

PortalToken

FieldTypeRequiredDescription
tokenstringyesHS256 JWT (header.payload.signature).
expiresAtintegeryesExpiry as a Unix timestamp (seconds).
expiresInintegeryesSeconds until expiry.

refund.failed POST

Triggered when the payment gateway fails or rejects a card refund, also after an earlier `refund.succeeded`. The money goes into the customer's invoice balance: ask for the refund again or tell the customer. `status` is `FAILED` or `REJECTED_IN_GATEWAY_REVIEW`.