Skip to main content
Cancel an active or pending subscription. The behavior depends on the current subscription status.
POST /v1/actions/subscription-order/cancel-order
Authentication: API Key (merchant, owner role)
This endpoint also has a customer-side flow with session-token auth: see Cancel Subscription (Customer).

Cancellation Behavior

Current StatusActionResult Status
pendingImmediate cancelcanceled
activeCancel 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 to canceled via Webhook when the period ends

Request Body

FieldTypeRequiredDescription
orderIdstringYesSubscription order ID (Short ID format ORD_xxx)

Example Request

import { WaffoPancake } from "@waffo/pancake-ts";

const client = new WaffoPancake({
  merchantId: process.env.WAFFO_MERCHANT_ID!,
  privateKey: process.env.WAFFO_PRIVATE_KEY!,
});

const result = await client.orders.cancelSubscription({
  orderId: "ORD_2aUyqjCzEIiEcYMKj7TZtw",
});

console.log(result.orderId); // "ORD_2aUyqjCzEIiEcYMKj7TZtw"
console.log(result.status);  // "canceling" or "canceled"

Success Response (200) — Active Subscription

{
  "data": {
    "orderId": "ORD_2aUyqjCzEIiEcYMKj7TZtw",
    "status": "canceling"
  }
}

Success Response (200) — Pending Subscription

{
  "data": {
    "orderId": "ORD_2aUyqjCzEIiEcYMKj7TZtw",
    "status": "canceled"
  }
}

Response Fields

FieldTypeDescription
orderIdstringOrder ID (Short ID)
statusstringNew 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).
Statuserrors[0].messageWhat it meansRecommended handling
400Missing X-Context-Merchant-Id headerMerchant context missing in API Key authVerify the auth pipeline
400Missing required field: orderIdorderId was not provided in the bodyFix the request body, then resubmit
400Expected format: ORD_xxx, got "..."orderId Short ID could not be decodedFix the orderId format, then resubmit
400Subscription cannot be canceled, current status: XOrder status is not pending or active (e.g. already canceled, canceling, expired)The subscription is no longer cancellable
401Authentication failedInvalid API Key signatureVerify auth headers
403Order does not belong to userOwnership check failedVerify the caller owns the order
404Order not foundOrder does not existVerify the order ID
500Internal server errorUnexpected server-side failureRetry with exponential backoff (start 5s, max 3 attempts)
502Failed to cancel subscriptionLocal update or PSP cancellation failedRetry with exponential backoff (start 5s, max 3 attempts)