# Update Subscription

<Warning>
**Subscription Transition**

The fields `billing_cycles` and `availability.finish_at` have an impact on each other. If both are completed during the subscription creation, it will transition to the `COMPLETED` state upon reaching the nearest event defined in these fields, whether it is the billing cycle or the corresponding `finish_at`. They are independent end conditions: whichever is reached first completes the subscription.

When the `availability` object is included, `finish_at` is applied as sent: omit it or send it as `null` and any previously set end date is removed, so the subscription becomes open-ended and keeps renewing until it is canceled. This means that when you update `availability.start_at`, you must include `finish_at` in the same request if you want to keep the end date. `start_at` does not behave this way: omitting it leaves the current start date unchanged. Omitting the whole `availability` object leaves both dates unchanged.

Note that `availability.start_at` can only be moved earlier on update. Sending a later date returns a 400 error: `The availability start date cannot be greater than the current availability start date`.
</Warning>

<Note>
**Retroactive Credential Update**

If you have existing subscriptions that are failing rebills because of missing credential usage (e.g. from an initial CIT payment), you can use this `PATCH` endpoint to set `payment_method.card.usage` retroactively to fix the issue.
</Note>

<Note>
**Scheduled Plan Changes**

Use the `plan_change` block to move a subscription to another plan effective at its next billing cycle — no proration, no mid-cycle charge. The subscription must be `ACTIVE` or `TRIALING` and already on a plan; the target plan must be active and only one change can be pending at a time. Send `"plan_change": null` to undo a pending change; omitting the field never touches it. The pending change is returned as `pending_plan_change` on this endpoint and on the subscription object, and the `subscription.plan_change_scheduled`, `subscription.plan_change_canceled` and `subscription.plan_changed` webhooks track its lifecycle.

`amount`, `frequency`, `billing_date` and `country` are managed by the plan and cannot be sent for a plan-linked subscription — combining any of them with `plan_change` returns `400`.
</Note>

<Note>
**Immediate Plan Changes**

Send `"effective": "IMMEDIATE"` inside `plan_change` to apply the move in this call instead of scheduling it: the subscription keeps its `id`, the new plan's price bills from the next charge, and — unlike a scheduled change — this works even in the final billing cycle. An immediate change while another change is pending returns `409 PLAN_CHANGE_ALREADY_SCHEDULED`; undo the pending one first with `"plan_change": null`.

`billing_cycle_behavior` decides what happens to the billing anchor when the plan changes in place:

- `KEEP` (default — omitting the field behaves identically) — the next charge date is untouched; only the price changes.
- `RESTART` — the next charge re-anchors to the moment of the change plus the new plan's frequency. **Only the anchor resets**: billing cycle counters, the retry configuration and the subscription's status all survive. `RESTART` requires `effective: IMMEDIATE` and returns `400` with a scheduled change; `KEEP` alongside a scheduled change is accepted and simply schedules the change as usual — a scheduled change never moves the anchor anyway.

An immediate change emits the `subscription.plan_changed` webhook at the moment of the call — `subscription.plan_change_scheduled` never fires for it, and `pending_plan_change` stays `null` throughout.

`billing_cycle_behavior` is **write-only** — it is accepted on the request and never echoed in any response.
</Note>

<Note>
**Restarting the Billing Cycle Without a Plan**

For a subscription that is *not* linked to a plan, `billing_cycle_behavior` is available as a top-level field on this endpoint, typically combined with a `frequency` change in the same call — for example, moving a subscriber from monthly to yearly and restarting the cycle from today. The same `KEEP`/`RESTART` semantics apply, and on a subscription that has not started yet the re-anchored date clamps to its `availability.start_at`.

Placement rules: on a plan-linked subscription the top-level field returns `400` (the anchor is managed through `plan_change`), and combining the top-level field with a `plan_change` block returns `400` — use `plan_change.billing_cycle_behavior` instead. A `PAUSED` subscription returns `409 INVALID_SUBSCRIPTION_STATUS`: a restart is accepted while the subscription is `ACTIVE`, `TRIALING` or `PAST_DUE` — or while it is still `CREATED`, where (unlike `plan_change`) the request is allowed and the re-anchored date clamps to `availability.start_at`. A top-level restart emits no webhook — read the new anchor from the subscription object.
</Note>

### Plan change errors

Each of the `409` and `422` errors below carries a `current_status` field alongside `code` and `messages`, holding the subscription's status at the moment the request was rejected. The rejected request makes no change.

```json 409 Conflict
{
  "code": "PLAN_CHANGE_ALREADY_SCHEDULED",
  "messages": [
    "A plan change is already scheduled for this subscription. Undo it first with plan_change: null."
  ],
  "current_status": "ACTIVE"
}
```

<div className="code-nowrap-table dense-table">

| HTTP | `code` | When |
|---|---|---|
| `404` | `PLAN_NOT_FOUND` | The target plan does not exist or is not linked to this account. |
| `409` | `PLAN_CHANGE_ALREADY_SCHEDULED` | A change is already pending. Undo it first with `plan_change: null`. |
| `409` | `PLAN_CHANGE_ALREADY_APPLIED` | The `plan_change: null` undo arrived after the pending change had already taken effect at the renewal. |
| `409` | `TARGET_PLAN_NOT_ACTIVE` | The target plan is not active. |
| `409` | `SUBSCRIPTION_NOT_ON_A_PLAN` | The subscription is not on a plan. |
| `409` | `PLAN_CHANGE_NOT_AVAILABLE` | The subscription is in its final billing cycle, or its availability window ends before the next renewal. |
| `409` | `INVALID_SUBSCRIPTION_STATUS` | The subscription is `PAUSED`, `CREATED` or `ERROR`. |
| `422` | `SAME_PLAN` | The subscription is already on this plan. |

</div>

A `CANCELED` or `COMPLETED` subscription is rejected earlier with `400 INVALID_STATE`, which does not carry `current_status`.

Validation problems in the block itself — a missing `plan_id`, an unsupported `effective`, a target plan in another currency, or a `HONOR_PHASES` ladder longer than the remaining billing cycles — return `400 BAD_REQUEST` without `current_status`. The same applies to `billing_cycle_behavior` placement mistakes: `RESTART` without `effective: IMMEDIATE`, the top-level field combined with `plan_change`, or the top-level field on a plan-linked subscription each return `400 BAD_REQUEST` with a message naming the fix. Where an invalid `billing_cycle_behavior` **value** is caught depends on its position: the top-level field is rejected at the API edge as `400 INVALID_PARAMETERS` (`"The field 'billing_cycle_behavior' has an invalid value."`), while a bad value nested inside `plan_change` reaches the engine and returns `400 BAD_REQUEST` (e.g. `"RESET is invalid for plan_change.billing_cycle_behavior field"`) — treat both codes as validation failures.

One exception to the plan-change error table above: `PLAN_CHANGE_NOT_AVAILABLE` applies to *scheduled* changes only. An `IMMEDIATE` change does not need an upcoming cycle, so it is accepted in the final billing cycle.

**PATCH** `/subscriptions/{subscription_id}`

Base URL: `https://api-sandbox.whitelabel.com/v1`

Update Subscription

## Authorization

- public-api-key (apiKey in header)
- private-secret-key (apiKey in header)

## Path parameters

- `subscription_id` (string, required)
  The unique identifier of the subscription.

## Body

Content type: `application/json`

- `name` (string)
  The subscription plan name (MAX 255; MIN 3).
- `description` (string)
  The subscription plan description (MAX 255; MIN 3).
- `account_id` (string)
  The unique identifier of the account that will have the subscription plan available to use (MAX 64 ; MIN 36).
- `merchant_reference` (string)
  Identification of the subscription plan (MAX 255; MIN 3).
- `soft_descriptor` (string)
  Statement descriptor shown on the cardholder's bank statement. Updating it changes the descriptor applied to subsequent rebills generated by the subscription engine. Length and formatting limits vary by provider (for example, Unlimit truncates to 22 characters and Airwallex to 30). Worldpay does not read this field; it builds the statement narrative from `payment_description` instead.
- `country` (string)
  The subscription's country.
- `amount` (object)
  Specifies the `amount` object, with the value of each subscription payment and the used currency.
  - `currency` (string, required)
    The currency used to make the payment (MAX 3; MIN 3; [ISO 4217](/reference/country-reference)).
  - `value` (number<float>, required)
    The value of each payment of the subscription (multiple of 0.0001).
- `frequency` (object)
  Specifies the `frequency` object. Defines the billing frequency for the subscription. Including type and value.
  - `type` ("DAY" | "WEEK" | "MONTH", required)
    The type of interval the subscription will have in time (DAY, WEEK, MONTH). If not set, always MONTH by default.
  - `value` (integer<int32>)
    The value between each interval the subscription will have in time. The system will use the default value of 1 if not set.
  - `monthly_billing_day` (integer)
    The day of the month when billing is processed. (MAX 31; MIN 1). Only valid for MONTH frequency. If the subscription has not started yet (availability.start_at is in the future), the first billing still occurs at availability.start_at and the billing day applies from the second cycle onward; the resulting first billing period may be shorter than a full cycle and is charged in full.
- `billing_cycles` (object)
  Specifies the `billing_cycles` object. Defines the number of charges associated to the subscription.
  - `total` (integer<int32>)
    The total number of billing cycles for the subscription. On update, must be greater than or equal to the current `billing_cycles.current`; a lower value is rejected with 400.
- `customer_payer` (object)
  Specifies the `customer_payer` object to identify the customer.
  - `id` (string, required)
    The unique identifier of the customer (MAX 255; MIN 3).
- `payment_method` (object)
  Specifies the `payment_method` object. Supported types are `CARD` and `PAYPAL_ENROLLMENT`. You can use the `token`, the `vaulted_token`, or the card information through the card object.
  - `type` ("CARD")
    Payment method type.
  - `vaulted_token` (string)
    The vaulted token (MAX: 64; MIN: 36).
  - `card` (object)
    Specifies the card object.
    - `verify` (boolean)
      Using  `amount` = 0 and `verify` = true, you can verify the user´s card without authorizing a real amount.
    - `card_data` (object)
      Specifies the card data object.
      - `number` (string)
        Card’s number without any separators.  (MAX 19; MIN 8) - only available for PCI certified merchants.
      - `expiration_month` (integer<int32>)
        Card’s expiration month - MM (MAX 2; MIN 2) - only available for PCI certified merchants
      - `expiration_year` (integer<int32>)
        Card’s expiration year in the YYYY format (MAX 4; MIN 4) - only available for PCI certified merchants
      - `security_code` (integer<int32>)
        Card’s security code (MAX 4; MIN 3) - only available for PCI certified merchants.
      - `holder_name` (string)
        Cardholder’s full name as it appears on the card (MAX 26; MIN 3) - only available for PCI certified merchants
    - `usage` ("FIRST" | "USED")
      Indicates whether this stored credential is being used for the first time (FIRST) or has been used before (USED). Required if a CIT payment was created before the subscription — without it, rebills are treated as CITs and may be declined.
  - `` (string)
- `availability` (object)
  Specifies the `availability` object. Defines a date interval based on starting and ending dates when the subscription is available to use. If this object is omitted from the request, the availability dates are left unchanged. When it is included, omitting `finish_at` (or sending it as `null`) removes any previously set end date; omitting `start_at` leaves the current start date unchanged.
  - `start_at` (string<date-time>)
    The start date that the subscription plan will be available to use. If not set, the subscription is available from the moment it is created. On update, omitting this field leaves the current start date unchanged, and the start date can only be moved earlier: sending a later date returns a 400 error.
  - `finish_at` (string,null<date-time>)
    The end date until the subscription will be available to use. When the `availability` object is included in the request, omit this field or send `null` to clear a previously set end date: the subscription becomes open-ended and keeps renewing until it is canceled. Send a date-time to set or update the end date. Note that `availability.finish_at` and `billing_cycles.total` are independent end conditions: whichever is reached first completes the subscription.
- `retries` (object)
  The retries configuration to apply going forward. Accepts the same object as Create Subscription — including strategy and schedule — except cancel_on_exhausted_retries, which is create-only. Changes apply the next time retries are scheduled: a billing cycle already running its retries finishes on the configuration it started with, and the update takes effect from the next cycle.
  - `retry_on_decline` (boolean)
    If we should retry a payment or not after a first decline. False by default.
  - `amount` (integer<int32>)
    The number of retries the subscription will attempt, for the DEFAULT and SMART strategies. The maximum equals your environment's configured retry schedule length — 6 in production; a higher value is rejected with 400 (Max retries attempts exceeded). With CUSTOM_SCHEDULE the amount is derived from the length of the schedule array instead.
  - `strategy` ("DEFAULT" | "SMART" | "CUSTOM_SCHEDULE")
    The retry strategy. Allowed values: DEFAULT (the fixed retry schedule), SMART (machine-learning-based retry timing, applied from the second retry onward) or CUSTOM_SCHEDULE (uses the per-attempt schedule array you provide). Sending a schedule without a strategy implies CUSTOM_SCHEDULE.
  - `schedule` (object[])
    Per-attempt retry schedule; replaces the stored schedule as a whole. Up to 7 attempts, attempt numbers must run sequentially from 1, and each delay_seconds must be between 1 and 604800 (7 days). Sending it implies strategy CUSTOM_SCHEDULE and sets the retry amount to the schedule length.
    - `attempt` (number)
      Number of the retry attempt
    - `delay_seconds` (number)
      Specifies the amount of seconds between each retry.
  - `stop_on_hard_decline` (boolean)
    When true, the retry schedule stops for the current billing cycle after a hard decline. On its own, the subscription remains ACTIVE and billing advances to the next cycle; no subscription is canceled or paused and no subscription webhook is emitted. If cancel_on_exhausted_retries is also true, the subscription is canceled instead.
  - `cancel_on_exhausted_retries` (boolean)
    Create-only: this flag cannot be changed after the subscription is created — sending a value different from the one stored on the subscription returns 400 (The field 'retries.cancel_on_exhausted_retries' can only be set when the subscription is created); echoing the current value is accepted. When true, the subscription is canceled once retries for a billing cycle end without a successful payment, instead of remaining ACTIVE and advancing to the next cycle. cancellation_source is set to RETRIES_EXHAUSTED and a single SUBSCRIPTION.CANCEL webhook is emitted. Defaults to false. The cancellation itself is final, so Retry Subscription is rejected afterwards.
- `plan_change` (object)
  Moves the subscription to another plan. `effective: NEXT_BILLING_CYCLE` (the default) schedules the change for the next renewal — no proration, no mid-cycle charge. `effective: IMMEDIATE` applies the change in place, in this call: the subscription keeps its `id`, the new plan's price bills from the next charge, and `billing_cycle_behavior` decides what happens to the billing anchor. The subscription must be ACTIVE or TRIALING and already on a plan; the target plan must be ACTIVE. For scheduled changes only one can be pending at a time — send `"plan_change": null` to undo it before it applies (an IMMEDIATE change while another is pending returns 409). `amount`, `frequency`, `billing_date` and `country` are managed by the plan and cannot be sent for a plan-linked subscription — combining any of them with `plan_change` returns 400.
  - `plan_id` (string, required)
    The identifier of the target plan. Required. The target plan must be ACTIVE and priced in the subscription's currency.
  - `effective` ("NEXT_BILLING_CYCLE" | "IMMEDIATE")
    When the change applies. NEXT_BILLING_CYCLE (default): the current cycle bills the current plan's price, the next one bills the new plan's. IMMEDIATE: the subscription moves to the target plan in this call - unlike a scheduled change, this also works in the final billing cycle.
  - `phases_behavior` ("START_FROM_REGULAR" | "HONOR_PHASES")
    What happens when the target plan has phases. START_FROM_REGULAR (default) enters the regular phase directly — no re-lived trials. HONOR_PHASES enters through the target plan's phase schedule.
  - `billing_cycle_behavior` ("KEEP" | "RESTART")
    What happens to the billing anchor when the plan changes in place with `effective: IMMEDIATE`. KEEP (default — omitting the field behaves identically): the next charge date is untouched. RESTART: the next charge re-anchors to the moment of the change plus the new plan's frequency — the anchor alone resets; billing cycle counters, the retry configuration and the subscription status survive. RESTART requires `effective: IMMEDIATE` and returns 400 with a scheduled change; KEEP alongside a scheduled change is accepted and simply schedules the change as usual. Write-only: this field is never echoed in any response.
- `billing_cycle_behavior` ("KEEP" | "RESTART")
  For subscriptions that are not linked to a plan: re-anchors billing in the same way as `plan_change.billing_cycle_behavior`, typically combined with a `frequency` change in the same call (e.g. monthly to yearly, restarting the cycle from today). KEEP (default): the next charge date is untouched. RESTART: re-anchors the next charge to now plus the (possibly updated) frequency; the anchor alone resets — cycle counters, the retry configuration and the subscription status survive. On a subscription that has not started yet (CREATED — accepted here, unlike `plan_change`), the anchor clamps to its start date. Rules: cannot be combined with `plan_change` (400 — use the nested field); on a plan-linked subscription this field returns 400 (managed through `plan_change`); a PAUSED subscription returns 409 INVALID_SUBSCRIPTION_STATUS. Write-only: never echoed in any response.
- `metadata` (object)
  Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to metadata.
  - `key` (string)
    Object title that represents the key-value pair inside the metadata (MAX 48 ; MIN 1).
  - `value` (string)
    Object value for the key defined  (MAX 512 ; MIN 1).

Example:

```json
{
  "name": "string",
  "description": "string",
  "account_id": "string",
  "merchant_reference": "string",
  "soft_descriptor": "string",
  "country": "string",
  "amount": {
    "currency": "string",
    "value": 0
  },
  "frequency": {
    "type": "DAY",
    "value": 0,
    "monthly_billing_day": 0
  },
  "billing_cycles": {
    "total": 0
  },
  "customer_payer": {
    "id": "string"
  },
  "payment_method": {
    "type": "CARD",
    "vaulted_token": "string",
    "card": {
      "verify": true,
      "card_data": {
        "number": "string",
        "expiration_month": 0,
        "expiration_year": 0,
        "security_code": 0,
        "holder_name": "string"
      },
      "usage": "FIRST"
    },
    "": "string"
  },
  "availability": {
    "start_at": "1970-01-01T00:00:00.000Z",
    "finish_at": null
  },
  "retries": {
    "retry_on_decline": true,
    "amount": 0,
    "strategy": "DEFAULT",
    "schedule": [
      {
        "attempt": 0,
        "delay_seconds": 0
      }
    ],
    "stop_on_hard_decline": true,
    "cancel_on_exhausted_retries": true
  },
  "plan_change": {
    "plan_id": "string",
    "effective": "NEXT_BILLING_CYCLE",
    "phases_behavior": "START_FROM_REGULAR",
    "billing_cycle_behavior": "KEEP"
  },
  "billing_cycle_behavior": "KEEP",
  "metadata": {
    "key": "string",
    "value": "string"
  }
}
```

## Responses

### 200

200

- `id` (string)
- `name` (string)
- `account_id` (string)
- `country` (string)
- `description` (string)
- `merchant_reference` (string)
- `soft_descriptor` (string)
- `status` (string)
- `amount` (object)
  - `currency` (string)
  - `value` (number)
- `frequency` (object)
  - `type` (string)
  - `value` (integer)
- `billing_cycles` (object)
  - `total` (integer)
  - `current` (integer)
  - `next_at` (string)
- `customer_payer` (object)
  - `id` (string)
- `payment_method` (object)
  - `type` (string)
  - `vaulted_token` (string)
- `availability` (object)
  - `start_at` (string)
  - `finish_at` (any)
- `metadata` (any)
- `pending_plan_change` (object)
  The plan change scheduled for the next billing cycle, or null when none is pending.
  - `plan_id` (string)
    The identifier of the target plan.
  - `plan_name` (string)
    The name of the target plan.
  - `direction` ("UPGRADE" | "DOWNGRADE")
    Whether the target plan is an upgrade or a downgrade. Informational only.
  - `effective` ("NEXT_BILLING_CYCLE")
    When the change applies.
  - `phases_behavior` ("START_FROM_REGULAR" | "HONOR_PHASES")
    What happens when the target plan has phases.
  - `applies_at` (string)
    The billing event the change will take effect on — the subscription's next billing date.
  - `requested_at` (string)
    When the change was scheduled.
- `created_at` (string)
- `updated_at` (string)

Example:

```json
{
  "id": "0c7fed3e-ee0d-4d34-9547-778be4ec0798",
  "name": "Test Subscription",
  "account_id": "493e9374-510a-4201-9e09-de669d75f256",
  "country": "US",
  "description": "Subscription Test",
  "merchant_reference": "subscription-ref-merchant-AA01",
  "soft_descriptor": "ACME SUBSCRIPTION",
  "status": "ACTIVE",
  "amount": {
    "currency": "USD",
    "value": 15000
  },
  "frequency": {
    "type": "MONTH",
    "value": 1
  },
  "billing_cycles": {
    "total": 12,
    "current": 1,
    "next_at": "2024-09-30T12:04:23.265393Z"
  },
  "customer_payer": {
    "id": "a1d3b664-e32a-4508-9da1-9ede3e62a60c"
  },
  "payment_method": {
    "type": "CARD",
    "vaulted_token": "d4aa3586-def2-4705-b7cd-fe064bb764e6"
  },
  "availability": {
    "start_at": "2024-09-30T12:04:23.265393Z",
    "finish_at": null
  },
  "metadata": null,
  "pending_plan_change": {
    "plan_id": "1904911d-5df9-429e-8488-ad41abea1a4d",
    "plan_name": "Pro",
    "direction": "UPGRADE",
    "effective": "NEXT_BILLING_CYCLE",
    "phases_behavior": "START_FROM_REGULAR",
    "applies_at": "2024-10-30T12:04:23.265372Z",
    "requested_at": "2024-09-30T12:04:23.265372Z"
  },
  "created_at": "2024-09-30T12:04:23.265372Z",
  "updated_at": "2024-09-30T12:04:23.265372Z"
}
```

### 400

400