This endpoint also has a customer-side flow with session-token auth: see Cancel Subscription (Customer).
Cancellation Behavior
| Current Status | Action | Result Status |
|---|---|---|
pending | Immediate cancel | canceled |
active | Cancel at period end (via PSP) | canceling -> canceled at period end |
- pending: Directly canceled, status becomes
canceled - active: PSP cancellation is triggered (takes effect at billing period end). Local status becomes
canceling, then updated tocanceledvia Webhook when the period ends
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
orderId | string | Yes | Subscription order ID (Short ID format ORD_xxx) |
Example Request
Success Response (200) — Active Subscription
Success Response (200) — Pending Subscription
Response Fields
| Field | Type | Description |
|---|---|---|
orderId | string | Order ID (Short ID) |
status | string | New order status (canceling or canceled) |
Errors
Retry policy: Never retry 4xx — fix the request and resubmit. Retry 5xx with exponential backoff (start 5s, max 3 attempts).
| Status | errors[0].message | What it means | Recommended handling |
|---|---|---|---|
| 400 | Missing X-Context-Merchant-Id header | Merchant context missing in API Key auth | Verify the auth pipeline |
| 400 | Missing required field: orderId | orderId was not provided in the body | Fix the request body, then resubmit |
| 400 | Expected format: ORD_xxx, got "..." | orderId Short ID could not be decoded | Fix the orderId format, then resubmit |
| 400 | Subscription cannot be canceled, current status: X | Order status is not pending or active (e.g. already canceled, canceling, expired) | The subscription is no longer cancellable |
| 401 | Authentication failed | Invalid API Key signature | Verify auth headers |
| 403 | Order does not belong to user | Ownership check failed | Verify the caller owns the order |
| 404 | Order not found | Order does not exist | Verify the order ID |
| 500 | Internal server error | Unexpected server-side failure | Retry with exponential backoff (start 5s, max 3 attempts) |
| 502 | Failed to cancel subscription | Local update or PSP cancellation failed | Retry with exponential backoff (start 5s, max 3 attempts) |