Cancel Subscription
POST
/v1/subscriptions/{id}/cancelOptionalCancel immediately (atPeriodEnd=false) or at the end of the current period (atPeriodEnd=true).
Authentication
Signature Pattern
HMAC-SHA256(secretKey, "{timestamp}\nPOST\n/v1/subscriptions/{id}/cancel\n{sha256(body)}")| Header | Value | Description |
|---|---|---|
X-Api-Key | pk_live_a1b2c3d4e5f6g7h8 | Merchant public API key |
X-Signature | {hmac_sha256_hex} | Hex HMAC-SHA256 request signature |
X-Timestamp | 2026-04-13T10:00:00Z | ISO 8601 UTC request time (±5 min) |
Request Parameters
| Name | Type | Required | Description |
|---|---|---|---|
atPeriodEnd | boolean | Required | Cancel now (false) or at period end (true) |
reason | string | Optional | Cancellation reason |
Request Example
JSONRequest Body
{
"atPeriodEnd": true,
"reason": "Customer requested"
}Response Parameters
| Field | Type | Example |
|---|---|---|
id | string | "sub_5e6f70819a2b" |
status | string | "active" |
cancelAtPeriodEnd | boolean | true |
Response Example
JSONResponse
{
"id": "sub_5e6f70819a2b",
"status": "active",
"cancelAtPeriodEnd": true
}Status Codes
200Success
201Created
400Bad Request
401Unauthorized
404Not Found
429Rate Limited
Try itMock
POSThttps://api.pay.sandbox.kvell.group