Create a purchase
Subscribes a customer to a plan. It is PENDING with a first invoice (invoice.payUrl) and starts once that is paid. With autoPayment: true the balance, then the saved card, pay it. A FREE plan starts at once. It replaces any current plan without credit; for credit, change plan.
Base URL https://payments.clocknext.com/api/v1
apiKeyAuthorizationBearer <cnk_…>Organisation-scoped key from Settings → API Keys.
application/json- body
Name the customer with customerId or externalId — one is required.
customerId?stringCustomer id. Required unless externalId is sent.
1 <= lengthexternalId?stringYour own id for the customer, instead of customerId.
^[A-Za-z0-9-]{1,64}$1 <= length <= 64planId*stringThe id of the plan to subscribe the customer to. It must be active: an archived plan is a 400.
1 <= lengthbillingDate?stringYYYY-MM-DD: date of the first invoice. Defaults to today; can't be in the past.
datesubscriptionDate?stringYYYY-MM-DD: when the plan starts and renews. Defaults to today; can't be before this month.
datenotes?stringA free-text note stored on the purchase. Up to 500 characters, after leading and trailing spaces are removed.
length <= 500autoPayment?booleantrue: the balance, then the saved card, pay every invoice, the first one too. Default false.
falsevoidAfterMinutes?integerMinutes an unpaid renewal invoice stays open before it is voided.
1 <= valuePurchase created.
application/json- response
statusCode*integerThe 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 new purchase and, when there is one, its first invoice to pay.
curl -X POST 'https://payments.clocknext.com/api/v1/purchases' \ -H 'Content-Type: application/json' \ -d '{ "customerId": "cmvgva5po000c07iir1vtn8vl", "planId": "cmvgvg2yq000s08l21gkr472h", "notes": "Annual kickoff — upgraded from Starter", "autoPayment": false}'{ "statusCode": 201, "statusDetail": { "status": "SUCCESS", "message": "Purchase created." }, "result": { "purchase": { "id": "cmvgvkmxz002h08l2h2i1dnsr", "purchaseNumber": "PUR-001", "subscriptionNumber": "SUB-001", "customerId": "cmvgva5po000c07iir1vtn8vl", "customerName": "Northwind Traders", "customerLogoUrl": "https://img.logo.dev/northwindtraders.com?token=pk_XyJ5Zd6NSUexPIq3rDQr4A&size=128&format=png&retina=true", "planId": "cmvgvg2yq000s08l21gkr472h", "planName": "Pro", "planType": "BUNDLE", "hasWallet": true, "hasCredit": true, "hasOutcome": true, "hasUnit": true, "hasComposite": true, "billingCycle": "MONTHLY", "cost": 499, "currencyCode": "USD", "billingDate": "2026-10-20T00:00:00.000Z", "nextBillingDate": "2026-11-20T00:00:00.000Z", "status": "PENDING", "voidAfterMinutes": 52560000, "autoPayment": false, "autoPaymentPauseReason": null, "notes": "Annual kickoff — upgraded from Starter", "createdAt": "2026-10-20T16:05:52.295Z" }, "invoice": { "id": "cmvgvkn14002u08l2ct47s2a7", "invoiceNumber": "INV-0001", "amount": 535.18, "status": "OPEN", "payUrl": "https://payments.clocknext.com/pay/<token>.vIKjeEFzR0YC_z5epJPcxKjavvXrik32JXc9fNbzDxk" } }}Types
Every object type on this page, with its fields.
CreatePurchaseInput
Name the customer with customerId or externalId — one is required.
| Field | Type | Required | Description |
|---|---|---|---|
customerId | string | no | Customer id. Required unless externalId is sent. |
externalId | ExternalId | no | Your own id for the customer, instead of customerId. |
planId | string | yes | The id of the plan to subscribe the customer to. It must be active: an archived plan is a 400. |
billingDate | string | no | YYYY-MM-DD: date of the first invoice. Defaults to today; can't be in the past. |
subscriptionDate | string | no | YYYY-MM-DD: when the plan starts and renews. Defaults to today; can't be before this month. |
notes | string | no | A free-text note stored on the purchase. Up to 500 characters, after leading and trailing spaces are removed. |
autoPayment | boolean | no | true: the balance, then the saved card, pay every invoice, the first one too. Default false. |
voidAfterMinutes | integer | no | Minutes an unpaid renewal invoice stays open before it is voided. |
CreatePurchaseInput.externalId
The id YOUR product uses for a customer: 1–64 letters, numbers or "-", matched exactly (case-sensitive). Unique among the organisation's active customers — an archived customer's id can be reused.
Purchase
| Field | Type | Required | Description |
|---|---|---|---|
id | string | yes | The purchase's id. |
purchaseNumber | string | yes | The workspace's reference for the purchase, such as PUR-042. |
subscriptionNumber | string | null | yes | The subscription's reference. null on a FREE plan and on older purchases. |
customerId | string | yes | The id of the customer who holds the purchase. |
customerName | string | yes | The customer's name. |
customerLogoUrl | string | null | yes | The customer's logo URL. It can be a data: URL. null when no logo is set. |
planId | string | null | yes | The id of the plan bought. null when that plan was deleted later. |
planName | string | yes | The plan's name, saved when the purchase was created. |
planType | "WALLET" | "BUNDLE" | yes | BUNDLE when the plan has credit, outcome or composite lines, else WALLET. Saved at purchase. |
hasWallet | boolean | yes | Whether the plan has a wallet line. Read from the plan as it is now. false when the plan was deleted. |
hasCredit | boolean | yes | Whether the plan has a credit line. Read from the plan as it is now. false when the plan was deleted. |
hasOutcome | boolean | yes | Whether the plan has an outcome line. Read from the plan as it is now. false when the plan was deleted. |
hasUnit | boolean | yes | Whether the plan has a unit line. Read from the plan as it is now. false when the plan was deleted. |
hasComposite | boolean | yes | Whether the plan has a composite line. Read from the plan as it is now. false when the plan was deleted. |
billingCycle | "MONTHLY" | "QUARTERLY" | "SEMI_ANNUAL" | "YEARLY" | "FREE" | yes | The plan's billing cycle, saved when the purchase was created. |
cost | number | yes | The pay-in-advance price of one cycle in USD, saved at purchase. 0 on a FREE plan; usage is billed apart. |
currencyCode | string | yes | The currency the plan's price was set in, for display. cost stays in USD. |
billingDate | string | yes | The purchase's billing date, as set when it was created. |
nextBillingDate | string | yes | When the next billing period starts. Before the plan starts, when its first period starts. |
status | "COMPLETED" | "PENDING" | "CANCELLED" | yes | COMPLETED, PENDING or CANCELLED, by payment. |
voidAfterMinutes | integer | yes | Minutes an unpaid renewal invoice stays open before it is voided. |
autoPayment | boolean | yes | When true, invoices from the second cycle on are charged to the saved card. |
autoPaymentPauseReason | string | null | yes | The pauseReason sent when auto-payment was paused. null while it is on. |
notes | string | null | yes | A free note saved on the purchase. null when none was given. |
createdAt | string | yes | When the purchase was created. |
PurchaseFirstInvoice
The first invoice to pay, with its payment link. Left out when there is none (a FREE or pay-as-you-go plan) or the invoice balance paid it all.
| Field | Type | Required | Description |
|---|---|---|---|
id | string | yes | The id of the first invoice. |
invoiceNumber | string | yes | The workspace's reference for the first invoice, such as INV-0042. |
amount | number | yes | Total due in USD, tax included. 0 on the $0 card invoice. |
status | string | yes | Always OPEN: the invoice waits for payment. |
payUrl | string | no | The hosted payment page. Left out while autoPayment is there. |
autoPayment | object | no | With autoPayment: true and a saved card: the card is being charged. Left out otherwise. |
PurchaseFirstInvoice.autoPayment
With autoPayment: true and a saved card: the card is being charged. Left out otherwise.
| Field | Type | Required | Description |
|---|---|---|---|
status | "PROCESSING" | yes | PROCESSING: the saved card is being charged. |
message | string | yes | A short note for people: "The saved card is being charged." |
List purchases GET
The workspace's purchases, newest first. Filter by `customerId` or `status` (`COMPLETED`, `PENDING` or `CANCELLED`). Paged with `limit` (at most 50) and `cursor`; see [Paginating results](/docs/api-reference/pagination). Any other parameter is a `400`.
Get a purchase GET
One purchase. `status` is by payment (`COMPLETED`, `PENDING` or `CANCELLED`); `lifecycleStatus` says whether the plan has started.