Cancel Subscription

Calling this endpoint with an empty body (or no body at all) cancels the subscription right away, changing its status to CANCELED. This is unchanged and still final: once immediate, it cannot be reverted.

You can cancel from CREATED, ACTIVE, TRIALING, PAST_DUE and PAUSED. COMPLETED and CANCELED are terminal, so canceling from either returns 400 INVALID_STATE — including a second cancel on a subscription that is already canceled. See Subscription Status.

Refund on immediate cancel

Allowlisted organizations only

Refund quoting is gated per organization, independently of scheduled cancellation. If your calls return 400 "Refund quote is not enabled for this organization", contact your WHITELABEL representative to have it enabled.

Send a refund mode alongside an immediate cancel (an absent schedule) to have WHITELABEL compute a refund quote for the current billing cycle. WHITELABEL only computes the quote — it never moves money. refund.execution on the response is always "MERCHANT": you execute the refund yourself against your own payment rail, using the quoted amount as input.

Cancel with a prorated refund
{
  "refund": "PRORATED"
}
ValueBehavior
NONE (default)No refund is computed. Identical to an absent refund key.
PRORATEDRefunds the unused portion of the current cycle, based on calendar days.
FULLRefunds the entire amount charged for the current cycle.
CUSTOMRefunds a merchant-supplied amount, capped at what was charged for the cycle.

refund cannot be combined with schedule — sending both, or sending refund together with "schedule": null, is rejected with 400 before anything is written. refund: NONE, or omitting refund entirely, still works normally alongside schedule.

The refund basis

Every refund mode is computed against the same basis: the most recently captured payment on the subscription — never the subscription’s own list price, and never an estimate. If the current cycle has no captured payment at all (a decline, a payment still pending, or a gap), PRORATED, FULL, and CUSTOM all return 400 REFUND_NOT_AVAILABLE — except a genuine $0 phase (a trial or promotional phase with nothing charged), which returns 200 with amount: 0.00. There’s nothing to refund there, but that’s not an error.

A PAST_DUE subscription has no captured payment for the cycle in progress, so the same rule applies: refund: NONE (or an absent refund) still cancels normally, but any other mode returns 400 REFUND_NOT_AVAILABLE with current_status: "PAST_DUE".

PRORATED

Refunds the unused days of the current cycle, using calendar-date arithmetic — never hours or minutes:

  • period_start — the date the last captured payment was charged.
  • period_end — the date the current cycle naturally ends, capped at availability.finish_at when the subscription has one and it falls earlier.
  • unused_days = period_days − used_days, where used_days counts the day you cancel on as a full used day — canceling at any time on day 10 of a 30-day cycle still counts 10 used days.
  • amount = charged_amount × unused_days / period_days, rounded HALF_UP at the currency’s minor units.

For example, a 30-day cycle charged $30.00, canceled on day 10: 10 days used, 20 days unused, amount = 30.00 × 20/30 = 20.00.

Cancel with a prorated refund — response
{
  "refund": {
    "mode": "PRORATED",
    "amount": { "value": 20.00, "currency": "USD" },
    "unused_days": 20,
    "period_days": 30,
    "basis": {
      "billing_cycle": 4,
      "charged_amount": { "value": 30.00, "currency": "USD" },
      "payment_id": "<example>",
      "charged_at": "<example>"
    },
    "execution": "MERCHANT",
    "quoted_at": "<example>"
  }
}

A subscription billed by the hour or minute has no meaningful notion of a “day,” so PRORATED returns 400 "proration is not available for sub-daily cadences" there. FULL and CUSTOM are unaffected — both still work on a sub-daily cadence.

FULL

Refunds the entire basis.charged_amount of the current cycle — amount always equals basis.charged_amount exactly, and unused_days equals period_days (the whole cycle is treated as unused).

CUSTOM

Provisional — semantics under product review

CUSTOM’s current behavior is a merchant-supplied refund_amount sent on the cancel request itself, capped at the current cycle’s charged amount. Product is reviewing whether the refund rule for CUSTOM should instead live on the plan as a standing rule, rather than a per-cancel amount. Treat everything in this subsection as unstable until that’s resolved.

Send refund_amount alongside "refund": "CUSTOM" to refund a specific amount instead of a computed one:

Cancel with a custom refund amount
{
  "refund": "CUSTOM",
  "refund_amount": { "value": 5.00, "currency": "USD" }
}

amount in the response is your refund_amount echoed back exactly — not recomputed or rounded again. refund_amount.value must be greater than 0 and must not exceed the current cycle’s charged amount, and refund_amount.currency must match the subscription’s own currency.

Reading the refund object

refund is null when refund was NONE or omitted. Otherwise:

FieldDescription
modePRORATED, FULL, or CUSTOM — echoes what was requested.
amountThe computed (or CUSTOM-echoed) refund amount.
unused_days / period_daysThe day-count inputs the amount was computed from. For FULL, unused_days equals period_days — the whole cycle counts as unused.
basis.billing_cycleThe billing cycle the refund was computed against.
basis.charged_amountThe amount actually charged for that cycle — the refund’s ceiling.
basis.payment_idThe captured payment’s own id. null for a $0-phase quote with no payment to reference.
basis.charged_atWhen that payment was captured. null for a $0-phase quote with no payment to reference.
executionAlways "MERCHANT" — WHITELABEL computes the quote, you execute the refund.
quoted_atWhen this quote was computed.

Where refund appears

  • The cancel 200 response always carries the refund key — null when no quote was computed, the object otherwise.
  • GET /v1/subscriptions/{id} and GET /v1/subscriptions?merchant_reference=... carry the last computed refund too, once one exists — canceling with a refund quote persists it, so it keeps showing up on every later read of that subscription through either of these.
  • GET /v1/subscriptions (the paginated list) does not carry refund on any entry, whether or not that subscription was canceled with a quote — the list item is a smaller summary shape than the full subscription object, and refund isn’t one of the fields it includes.
  • The subscription.cancel webhook carries refund only when a quote was actually computed (PRORATED/FULL/CUSTOM) — it’s absent, not null, for a NONE/absent-refund cancellation.

Scheduling a cancellation instead

Allowlisted organizations only

Scheduled cancellation is gated per organization. If your calls return 400 "Scheduled cancellation is not enabled for this organization", contact your WHITELABEL representative to have it enabled.

Send a schedule object to defer the cancellation instead of applying it now. The subscription stays in its current status — billing continues normally — until the schedule fires.

Schedule after 3 more billing cycles
{
  "schedule": {
    "after_cycles": 3
  }
}
Schedule for a specific date
{
  "schedule": {
    "at": "2026-11-01T00:00:00Z"
  }
}

schedule takes exactly one of:

FieldTypeRules
after_cyclesinteger1–60, and cannot exceed the billing cycles remaining on the subscription (billing_cycles.total − billing_cycles.current, when the plan has a total).
atTimestampISO-8601 with a UTC offset, must be in the future, and must fall before availability.finish_at when the subscription has one.

Sending both or neither returns 400.

A PIX_AUTOMATIC subscription billed with frequency.execution: MERCHANT cannot schedule a cancellation — schedule it as at or after_cycles on a different payment method type, or cancel immediately instead.

Behavior while retries are running

past_due_behavior is echoed on cancel_scheduled, pending product confirmation

The engine currently stamps whatever past_due_behavior resolved for the schedule (explicit value, or the EXHAUST_RETRIES default) onto the cancel_scheduled.past_due_behavior field in every response. Treat this echo as provisional until product confirms it as the intended external contract — it may change.

past_due_behavior controls what a scheduled cancellation does if the subscription is PAST_DUE when the schedule would otherwise fire:

ValueBehavior
EXHAUST_RETRIES (default)The scheduled cancel waits — retries keep running for the cycle in progress, and the cancellation only fires once the subscription leaves PAST_DUE (recovered or retries exhausted).
SKIP_RETRIESThe scheduled cancel fires immediately, without waiting for the outstanding retries to finish.
Schedule and skip retries if PAST_DUE when it fires
{
  "schedule": {
    "after_cycles": 1,
    "past_due_behavior": "SKIP_RETRIES"
  }
}

Independently of past_due_behavior, canceling a PAST_DUE subscription — whether immediately or because a schedule became due — never errors and always stops that cycle’s retries. See Subscription Status and Retries.

Refund handling is only available on an immediate cancel — see Refund on immediate cancel. It does not ship with scheduled cancellation: a schedule request cannot also carry a refund mode.

Undoing a scheduled cancellation

Send "schedule": null to clear a pending schedule. The subscription is unaffected otherwise — no status change, no charge.

Undo a scheduled cancellation
{
  "schedule": null
}

Sending "schedule": null when nothing is scheduled is a no-op: 200, cancel_scheduled stays null, and no webhook is sent. When a schedule is cleared, subscription.cancel_schedule_canceled fires instead.

Reading the result

The response carries the same Subscription shape as every other subscription endpoint. Four fields are relevant here:

  • cancel_scheduled — null when no cancellation is pending, otherwise the schedule’s mode, after_cycles/at, requested_at and past_due_behavior.
  • retries.stopped, retries.attempts_made, retries.outcome, retries.next_retry_at — populated whenever the subscription is PAST_DUE or has a cancel_scheduled pending; omitted otherwise.
  • unpaid_cycle — present when the current billing cycle is PAST_DUE and has not settled.
  • refund — null (or absent on non-cancel reads) when no refund quote was computed, otherwise the quoted amount and its basis. See Refund on immediate cancel.

Persistence of retries and unpaid_cycle after cancellation is pending product confirmation

Both fields are computed from the subscription’s live state at request time. Whether a GET /v1/subscriptions/{id} issued after the subscription reaches CANCELED continues to surface the retry snapshot / unpaid cycle from the cycle that was in flight, or omits them once terminal, is not yet confirmed as a stable contract — verify against a live response before depending on it.

See the Subscription object for the full field reference.

Webhooks

  • subscription.cancel_scheduled — sent when a cancellation is scheduled via this endpoint.
  • subscription.cancel_schedule_canceled — sent when a pending scheduled cancellation is undone via "schedule": null.

An immediate cancellation (empty body, or a schedule becoming due) still emits subscription.cancel as before — scheduling emits its own events only for the scheduling and undoing actions themselves. subscription.cancel’s payload carries refund too, following the same rule as the cancel response itself: present only when a quote was actually computed (PRORATED/FULL/CUSTOM), absent for a NONE/absent-refund cancellation.

Errors

HTTPcodeWhen
400BAD_REQUESTAn unrecognized top-level key, or an unrecognized key inside schedule.
400BAD_REQUESTschedule carries both at and after_cycles, or neither.
400BAD_REQUESTafter_cycles is not an integer between 1 and 60, or exceeds the billing cycles remaining.
400BAD_REQUESTat is not an ISO-8601 date-time with a UTC offset, is not in the future, or falls on/after availability.finish_at.
400BAD_REQUESTpast_due_behavior is not EXHAUST_RETRIES or SKIP_RETRIES.
400BAD_REQUESTScheduled cancellation is not enabled for this organization.
400BAD_REQUESTA PIX_AUTOMATIC subscription billed with frequency.execution: MERCHANT cannot schedule a cancellation.
400BAD_REQUESTrefund is not one of NONE, PRORATED, FULL, CUSTOM.
400BAD_REQUESTrefund (any mode other than NONE) is combined with schedule, including "schedule": null.
400BAD_REQUESTRefund quoting is not enabled for this organization (refund: NONE/absent is never gated).
400BAD_REQUESTrefund_amount is sent without refund: CUSTOM, or refund: CUSTOM is sent without refund_amount.
400BAD_REQUESTrefund_amount.value is missing, not greater than 0, or exceeds the current cycle’s charged amount (the cap).
400BAD_REQUESTrefund_amount.currency is missing or does not match the subscription’s own currency.
400BAD_REQUESTrefund: PRORATED on a sub-daily (HOUR/MINUTE) cadence.
400REFUND_NOT_AVAILABLErefund is not NONE, and the current billing cycle has no captured payment to refund against (includes every PAST_DUE case). Carries current_status.
400INVALID_STATEThe subscription’s status does not support cancellation (COMPLETED or already CANCELED).
POST/subscriptions/{subscription_id}/cancel

Path Parameters

subscription_idstringrequired

The unique identifier of a subscription.

Body application/json

refundstring

NONE (default), PRORATED, FULL, or CUSTOM. Computes a refund quote for the current billing cycle on an immediate cancel. Cannot be combined with schedule.

refund_amountobject

Required, and only allowed, when refund is CUSTOM. Must not exceed the current cycle’s charged amount.

Show refund_amount properties
valuenumber
currencystring

Must match the subscription’s own currency.

scheduleobjectnull

Response

200

idstring
namestring
descriptionstring
account_idstring
merchant_referencestring
statusstring
subscription_plan_idstring
amountobject
Show amount properties
currencystring
valuenumber
frequencyobject
Show frequency properties
typestring
valueinteger
billing_cyclesobject
Show billing_cycles properties
totalinteger
currentinteger
next_atstring
customer_payerobject
Show customer_payer properties
idstring
payment_methodobject

The payment method the subscription charges. A single object, not a list.

Show payment_method properties
typestring
tokenstring
vaulted_tokenstring
cardobject
Show card properties
verifyboolean
card_dataobject
Show card_data properties
numberstring
expiration_monthinteger
expiration_yearinteger
security_codeinteger
holder_namestring
availabilityobject
Show availability properties
start_atstring
finish_atstring
metadataobject
Show metadata properties
keystring
valuestring
paymentsstring[]
retriesobject
Show retries properties
retry_on_declineboolean
amountinteger
strategystring
stoppedboolean

Present only when the subscription is PAST_DUE or has cancel_scheduled pending.

attempts_madeinteger

Present only when the subscription is PAST_DUE or has cancel_scheduled pending.

outcomestring

RECOVERED, EXHAUSTED or ABANDONED. Present only when the subscription is PAST_DUE or has cancel_scheduled pending.

next_retry_atstring

Present only when the subscription is PAST_DUE or has cancel_scheduled pending.

unpaid_cycleobject

Present only when the current billing cycle is PAST_DUE and has not settled.

Show unpaid_cycle properties
cycle_numberinteger
amountobject
Show amount properties
currencystring
valuenumber
attemptsinteger
last_failure_codestring
cancel_scheduledobjectnull

null when no cancellation is pending.

refundobjectnull

null when refund was NONE or omitted. Present on the cancel response and on every later read once computed.

created_atstring
updated_atstring

400

Request
curl -X POST "https://api-sandbox.whitelabel.com/v1/subscriptions/<subscription_id>/cancel" \
  -H "Content-Type: application/json" \
  -H "public-api-key: <public-api-key>" \
  -H "private-secret-key: <private-secret-key>" \
  -d '{
  "refund": "PRORATED",
  "refund_amount": {
    "value": 5,
    "currency": "USD"
  },
  "schedule": {
    "after_cycles": 3,
    "at": "2026-11-01T00:00:00Z",
    "past_due_behavior": "EXHAUST_RETRIES"
  }
}'
Response
{
  "id": "7304911d-5df9-429e-8488-ad41abea1a4c",
  "name": "sub_001",
  "description": "streaming service",
  "account_id": "2404911d-5df9-429e-8488-ad41abea1a4b",
  "merchant_reference": "001_marzo_23",
  "status": "CANCELED",
  "subscription_plan_id": "1904911d-5df9-429e-8488-ad41abea1a4d",
  "amount": {
    "currency": "USD",
    "value": 12100
  },
  "frequency": {
    "type": "MONTH",
    "value": 1
  },
  "billing_cycles": {
    "total": 10,
    "current": 2,
    "next_at": "2023-02-16T20:00:00.786342Z"
  },
  "customer_payer": {
    "id": "3t04911d-5df9-429e-8488-ad41abea1a2c"
  },
  "payment_method": {
    "type": "CARD",
    "token": "9104911d-5df9-429e-8488-ad41abea1a4b",
    "vaulted_token": "6104911d-5df9-429e-8488-ad41abea1a4b",
    "card": {
      "verify": false,
      "card_data": {
        "number": "4507990000000010",
        "expiration_month": 10,
        "expiration_year": 2025,
        "security_code": 123,
        "holder_name": "JOHN DOE"
      }
    }
  },
  "availability": {
    "start_at": "2024-01-16T00:00:00.786342Z",
    "finish_at": "2024-05-26T20:00:00.786342Z"
  },
  "metadata": {
    "key": "sub_ext_id",
    "value": "AA001"
  },
  "payments": [
    "5104911d-5df9-229e-8468-bd41abea1a4s"
  ],
  "retries": {
    "retry_on_decline": true,
    "amount": 0,
    "strategy": "string",
    "stopped": true,
    "attempts_made": 0,
    "outcome": "string",
    "next_retry_at": "string"
  },
  "unpaid_cycle": {
    "cycle_number": 0,
    "amount": {
      "currency": "string",
      "value": 0
    },
    "attempts": 0,
    "last_failure_code": "string"
  },
  "cancel_scheduled": {
    "mode": "AFTER_CYCLES",
    "after_cycles": 3,
    "at": "string",
    "requested_at": "string",
    "past_due_behavior": "EXHAUST_RETRIES"
  },
  "refund": {
    "mode": "PRORATED",
    "amount": {
      "currency": "USD",
      "value": 20
    },
    "unused_days": 20,
    "period_days": 30,
    "basis": {
      "billing_cycle": 4,
      "charged_amount": {
        "currency": "USD",
        "value": 30
      },
      "payment_id": "string",
      "charged_at": "string"
    },
    "execution": "MERCHANT",
    "quoted_at": "string"
  },
  "created_at": "2023-12-16T20:46:54.786342Z",
  "updated_at": "2023-12-16T21:00:54.786342Z"
}