Create Plan

Plans are immutable

There’s no update endpoint. A price change means creating a new plan — existing subscriptions stay on the plan (and price) they were created with until you move them or they cancel. To move them, use Change Subscription Plan (immediate replacement) or the plan_change object on Update Subscription (scheduled, same id).

Refer to the HTTP Response Codes section for details on possible error outcomes.

POST/subscriptions/plans

Creates a reusable pricing plan. Plans are immutable once created — a price change means creating a new plan; existing subscriptions on the old plan are unaffected.

Body application/json

namestringrequired

The plan name (MAX 255; MIN 3).

descriptionstring

The plan description. No length limit is currently enforced.

merchant_referencestring

Your own identifier for the plan. No length limit is currently enforced.

base_amountobjectrequired

The default price used for any country without an explicit entry in country_prices.

Show base_amount properties
currencystringrequired

MAX 3; MIN 3; ISO 4217.

valuenumber<float>required

Multiple of 0.0001.

frequencyobjectrequired

The billing frequency for the plan. Subscriptions created from this plan inherit it.

Show frequency properties
type"DAY" | "WEEK" | "MONTH" | "QUARTER" | "HALF_YEAR" | "YEAR"required
valueinteger<int32>required
country_pricesobject[]

Optional explicit per-country prices. A country not listed falls back to base_amount.

Show country_prices properties
countrystring
amountobject
Show amount properties
currencystring
valuenumber<float>
allowed_payment_methodsstring[]

Payment method types accepted for subscriptions on this plan.

metadataobject[]

Key-value pairs attached to the plan. Independent of any metadata set on a subscription created from it.

Show metadata properties
keystring

MAX 48.

valuestring

MAX 512.

phasesobject[]

Optional leading ladder (for example, a trial) before the plan’s regular price. Omit for a flat plan. The last entry must be the terminal REGULAR phase with no duration.

Show phases properties
orderinteger<int32>required
namestringrequired

Required, non-empty — each phase must have a name.

type"TRIAL" | "REGULAR"required
durationobject

Required on every non-terminal phase, omitted on the terminal REGULAR phase.

Show duration properties
type"DAY" | "WEEK" | "MONTH" | "YEAR"
valueinteger<int32>
frequencyobject

Optional. If omitted, the phase bills as a single lump-sum charge covering the whole duration. If set, the phase bills every frequency interval instead, and the server computes total_payments = duration / frequency (both in the same unit) — e.g. a 3-month duration with a 1-month frequency produces 3 charges. Not applicable to the terminal phase.

Show frequency properties
type"DAY" | "WEEK" | "MONTH" | "QUARTER" | "HALF_YEAR" | "YEAR"
valueinteger<int32>
amountobject

Flat price for the phase. 0 is allowed (a free trial). On a non-terminal phase, this or country_prices is required (one of the two). On the terminal REGULAR phase, omit this entirely — sending it is rejected with 400 BAD_REQUEST (“The terminal phase price comes from the plan base_amount/country_prices - remove the phase amount”); the terminal price always comes from the plan’s own base_amount/country_prices.

Show amount properties
currencystring
valuenumber<float>
country_pricesobject[]

Per-country prices for this phase. On a non-terminal phase, this or amount is required. Not applicable to the terminal phase — its pricing always comes from the plan’s own country_prices.

Show country_prices properties
countrystring
amountobject
Show amount properties
currencystring
valuenumber<float>
account_idstringrequired

The account_id found in your WHITELABEL Dashboard (UUID). Required — on this endpoint the account is sent in the request body, not the X-Account-Code header.

Response

201

idstring
account_idstring
namestring
descriptionstring
merchant_referencestring
statusstring
base_amountobject
Show base_amount properties
currencystring
valuenumber
frequencyobject
Show frequency properties
typestring
valueinteger
country_pricesobject[]
Show country_prices properties
countrystring
amountobject
Show amount properties
currencystring
valuenumber
allowed_payment_methodsstring[]
metadataobject[]
phasesobject[]
created_atstring
updated_atstring

400

Request
curl -X POST "https://api-sandbox.whitelabel.com/v1/subscriptions/plans" \
  -H "Content-Type: application/json" \
  -H "public-api-key: <public-api-key>" \
  -H "private-secret-key: <private-secret-key>" \
  -d '{
  "name": "string",
  "description": "string",
  "merchant_reference": "string",
  "base_amount": {
    "currency": "string",
    "value": 0
  },
  "frequency": {
    "type": "DAY",
    "value": 0
  },
  "country_prices": [
    {
      "country": "string",
      "amount": {
        "currency": "string",
        "value": 0
      }
    }
  ],
  "allowed_payment_methods": [
    "string"
  ],
  "metadata": [
    {
      "key": "string",
      "value": "string"
    }
  ],
  "phases": [
    {
      "order": 0,
      "name": "string",
      "type": "TRIAL",
      "duration": {
        "type": "DAY",
        "value": 0
      },
      "frequency": {
        "type": "DAY",
        "value": 0
      },
      "amount": {
        "currency": "string",
        "value": 0
      },
      "country_prices": [
        {
          "country": "string",
          "amount": {
            "currency": "string",
            "value": 0
          }
        }
      ]
    }
  ],
  "account_id": "string"
}'
Response
{
  "id": "string",
  "account_id": "string",
  "name": "string",
  "description": "string",
  "merchant_reference": "string",
  "status": "ACTIVE",
  "base_amount": {
    "currency": "string",
    "value": 0
  },
  "frequency": {
    "type": "string",
    "value": 0
  },
  "country_prices": [
    {
      "country": "string",
      "amount": {
        "currency": "string",
        "value": 0
      }
    }
  ],
  "allowed_payment_methods": [
    "string"
  ],
  "metadata": [
    {}
  ],
  "phases": [
    {}
  ],
  "created_at": "string",
  "updated_at": "string"
}