Plans

Plans are a template for making a subscription. For example, you may have a plan that has a 30-day free trial followed by a recurring charge of $19.95 per month until canceled. The combination of the plan and a request to make an order will apply those instructions to create the invoices according to the plan's schedule.

Retrieve a list of plans

Retrieve a list of plans.

SecuritySecretApiKey or JWT
Request
query Parameters
filter
string

The collection items filter requires a special format. Use "," for multiple allowed values. Use ";" for multiple fields. See the filter guide for more options and examples about this format.

sort
Array of strings

The collection items sort field and order (prefix with "-" for descending sort).

limit
integer [ 0 .. 1000 ]

The collection items limit.

offset
integer >= 0

The collection items offset.

q
string

The partial search of the text fields.

Responses
200

A list of plans was retrieved successfully.

Response Headers
Pagination-Total
integer

Total items count.

Pagination-Limit
integer

Items per page limit.

Pagination-Offset
integer

Pagination offset.

Response Schema: application/json
Array
name
required
string

The plan name, displayed on invoices and receipts.

currency
required
string 3 characters

ISO 4217 alphabetic currency code.

productId
required
string <= 50 characters

The resource ID. Defaults to UUID v4.

required
object (PlanPriceFormula)
formula
required
string

The price formula determines what algorithm is used to calculate the invoice price based on a few factors,

  • the quantity in the order (which may be variable if usage pricing, otherwise determined when creating the order)
  • the price brackets data

To determine which formula is correct, please see the price formula documentation.

price
required
number <double>

For the very simple price when it's fixed and does not depend on the quantity chosen by customer.

If the price is 0, it's free.

id
string <= 50 characters

The resource ID. Defaults to UUID v4.

object

Name-value pairs to specify the product options.

property name*
additional property
string
currencySign
string

Currency sign.

object

The service interval. For a one-time item, use null.

unit
required
string

The unit of time.

Enum: "day" "week" "month" "year"
length
required
integer

The length of time.

limit
integer

The number of invoices this subscription order will generate (if 1, it will not generate any beyond the initial order creation). For example, set this property to 12, when the periodUnit is month and the periodDuration is 1, for a 1 year contract billed monthly.

billingTiming
string (PlanBillingTiming)
Default: "prepaid"

The billing timing in relation to the service period. For prepaid plans the customer pays when the service period starts, whereas, for postpaid plans, the customer pays when the service period ends.

Enum: "prepaid" "postpaid"
object

The trial. Set null if no trial.

price
required
number <double>

The price of the trial. For a free trial, use 0.

required
object (PlanPeriod)
isTrialOnly
boolean

Whether a plan has a trial without recurring instructions.

object

The setup. Set null if no setup.

price
required
number <double>

The price of a setup - 0 is a valid value (for free).

customFields
object (ResourceCustomFields)
Default: {}

Custom Fields list as a map {"custom field name": "custom field value", ...}. The format must follow the saved format (see Custom Fields section for the formats).

revision
integer

Increments when the plan is modified. Compare to materialized subscription items revision.

createdTime
string <date-time>

Read-only timestamp, automatically assigned on back-end.

updatedTime
string <date-time>

Read-only timestamp, automatically assigned on back-end.

Array of SelfLink (object) non-empty

The links related to resource.

Array (non-empty)
Any of:
rel
required
string

The link type.

Value: "self"
href
required
string

The link URL.

401

Unauthorized access, invalid credentials were used.

403

Access forbidden.

get/plans
Request samples
curl -i -X GET \
  'https://api-sandbox.rebilly.com/storefront/plans?filter=string&sort=string&limit=1000&offset=0&q=string' \
  -H 'REB-APIKEY: YOUR_API_KEY_HERE'
Response samples
application/json
[
  • {
    }
]

Retrieve a plan

Retrieve a plan with specified ID.

SecuritySecretApiKey or JWT
Request
path Parameters
id
required
string <= 50 characters ^[@~\-\.\w]+$

The resource identifier string.

Responses
200

Plan was retrieved successfully.

Response Schema: application/json
name
required
string

The plan name, displayed on invoices and receipts.

currency
required
string 3 characters

ISO 4217 alphabetic currency code.

productId
required
string <= 50 characters

The resource ID. Defaults to UUID v4.

required
object (PlanPriceFormula)
formula
required
string

The price formula determines what algorithm is used to calculate the invoice price based on a few factors,

  • the quantity in the order (which may be variable if usage pricing, otherwise determined when creating the order)
  • the price brackets data

To determine which formula is correct, please see the price formula documentation.

price
required
number <double>

For the very simple price when it's fixed and does not depend on the quantity chosen by customer.

If the price is 0, it's free.

id
string <= 50 characters

The resource ID. Defaults to UUID v4.

object

Name-value pairs to specify the product options.

property name*
additional property
string
currencySign
string

Currency sign.

object

The service interval. For a one-time item, use null.

unit
required
string

The unit of time.

Enum: "day" "week" "month" "year"
length
required
integer

The length of time.

limit
integer

The number of invoices this subscription order will generate (if 1, it will not generate any beyond the initial order creation). For example, set this property to 12, when the periodUnit is month and the periodDuration is 1, for a 1 year contract billed monthly.

billingTiming
string (PlanBillingTiming)
Default: "prepaid"

The billing timing in relation to the service period. For prepaid plans the customer pays when the service period starts, whereas, for postpaid plans, the customer pays when the service period ends.

Enum: "prepaid" "postpaid"
object

The trial. Set null if no trial.

price
required
number <double>

The price of the trial. For a free trial, use 0.

required
object (PlanPeriod)
unit
required
string

The unit of time.

Enum: "day" "week" "month" "year"
length
required
integer

The length of time.

isTrialOnly
boolean

Whether a plan has a trial without recurring instructions.

object

The setup. Set null if no setup.

price
required
number <double>

The price of a setup - 0 is a valid value (for free).

customFields
object (ResourceCustomFields)
Default: {}

Custom Fields list as a map {"custom field name": "custom field value", ...}. The format must follow the saved format (see Custom Fields section for the formats).

revision
integer

Increments when the plan is modified. Compare to materialized subscription items revision.

createdTime
string <date-time>

Read-only timestamp, automatically assigned on back-end.

updatedTime
string <date-time>

Read-only timestamp, automatically assigned on back-end.

Array of SelfLink (object) non-empty

The links related to resource.

Array (non-empty)
Any of:
rel
required
string

The link type.

Value: "self"
href
required
string

The link URL.

401

Unauthorized access, invalid credentials were used.

403

Access forbidden.

404

Resource was not found.

get/plans/{id}
Request samples
curl -i -X GET \
  'https://api-sandbox.rebilly.com/storefront/plans/{id}' \
  -H 'REB-APIKEY: YOUR_API_KEY_HERE'
Response samples
application/json
{
  • "id": "4f6cf35x-2c4y-483z-a0a9-158621f77a21",
  • "name": "string",
  • "productId": "4f6cf35x-2c4y-483z-a0a9-158621f77a21",
  • "productOptions": {
    },
  • "currency": "USD",
  • "currencySign": "string",
  • "pricing": {
    },
  • "recurringInterval": {
    },
  • "trial": {
    },
  • "isTrialOnly": true,
  • "setup": {
    },
  • "customFields": {
    },
  • "revision": 0,
  • "createdTime": "2019-08-24T14:15:22Z",
  • "updatedTime": "2019-08-24T14:15:22Z",
  • "_links": [
    ]
}