Skip to content
Try For Free
Bizstim
Free tools
Pricing Contact Log in
Try For Free Book Demo
Resource

Plans

Membership plans: a monthly or weekly allowance of sessions or hours for a recurring price, the services it covers, and whether it is sold on your public Plans page.

The plan object

Every plan record carries these fields in this order, after object, which is always "plan".

FieldTypeDescription
idinteger
namestring, up to 100 charactersThe plan name, shown to clients wherever the plan is offered.
descriptiontext, nullableWhat the plan includes, in your words (plain text); null or empty when none.
category_idintegerThe plan category it is listed under (GET /api/v1/plan-categories); 0 = no category.
category_namestring, up to 100 charactersThe category's name; null when the plan has no category. Read-only.
orderingintegerThe plan's place within its category, lowest first; plans with the same number are listed by name.
pricedecimalThe price of one period, 2 decimals.
count_bystringWhat the allowance counts: sessions or hours. Locked once anyone has held the plan (see locked).
allowancedecimalHow many sessions (a whole number) or hours each period includes.
periodstringHow often the plan renews and the allowance refills: week or month. Locked once anyone has held the plan.
topup_pricedecimalWhat one extra session or hour costs once the allowance is used up; 0 = extra bookings are charged at the normal service rate.
taxableinteger1 = tax is added at the rate in taxes for the state on the member's record, 0 = no tax.
taxesobjectTax rate by state: {"state": percent}, the state exactly as client records hold it. {} when none. Used when taxable is 1.
missed_countsinteger1 = a missed session still uses the allowance, 0 = it does not.
cancelled_countsinteger1 = a cancelled session still uses the allowance, 0 = it does not.
grace_daysintegerDays after an unpaid renewal the member may still book (0 to 31).
onlineinteger1 = sold on your public Plans page (needs a price above 0 and client card payments through Stripe), 0 = enrolled by your office only.
statusinteger1 = active (offered for enrolment and plan changes), 0 = inactive.
popularinteger1 = highlighted on the Plans page with popular_label (one plan per category), 0 = not.
popular_labelstring, up to 30 charactersThe highlight's words, e.g. Most popular or Best value.
service_idsarrayThe ids of the services the plan covers (GET /api/v1/services), ascending.
membersintegerCurrent members: enrolments that are active or awaiting payment. Read-only.
lockedbooleantrue once anyone has held the plan (or is waiting to switch to it): count_by and period can no longer change and the plan cannot be deleted (set status 0 instead). Read-only.

Example

{
    "object": "plan",
    "id": 42,
    "name": "Example name",
    "description": "An example description.",
    "category_id": 7,
    "category_name": "Example name",
    "ordering": 1,
    "price": 25.5,
    "count_by": "sessions",
    "allowance": 25.5,
    "period": "month",
    "topup_price": 25.5,
    "taxable": 1,
    "taxes": {
        "NY": 8.88,
        "NJ": 6.63
    },
    "missed_counts": 1,
    "cancelled_counts": 1,
    "grace_days": 1,
    "online": 1,
    "status": 1,
    "popular": 1,
    "popular_label": "Most popular",
    "service_ids": [
        3,
        5
    ],
    "members": 1,
    "locked": true
}

List plans

GET /api/v1/plans

Parameters

ParameterInDescription
limitqueryRecords per page, 1 to 1000 (default 100).
offsetqueryRecords to skip (default 0).
statusqueryOnly plans with this status: 1 active, 0 inactive (or 0,1).
onlinequeryOnly plans sold online (1) or not (0).
category_idqueryOnly plans in this plan category.

Returns

A list envelope of plan records (see Pagination).

Request

curl "https://www.bizstim.com/api/v1/plans" \
  -H "X-API-KEY: YOUR_API_KEY" \
  -H "Accept: application/json"

Response

{
    "object": "list",
    "total": 2,
    "limit": 100,
    "offset": 0,
    "has_more": false,
    "data": [
        {
            "object": "plan",
            "id": 42,
            "name": "Example name",
            "description": "An example description.",
            "category_id": 7,
            "category_name": "Example name",
            "ordering": 1,
            "price": 25.5,
            "count_by": "sessions",
            "allowance": 25.5,
            "period": "month",
            "topup_price": 25.5,
            "taxable": 1,
            "taxes": {
                "NY": 8.88,
                "NJ": 6.63
            },
            "missed_counts": 1,
            "cancelled_counts": 1,
            "grace_days": 1,
            "online": 1,
            "status": 1,
            "popular": 1,
            "popular_label": "Most popular",
            "service_ids": [
                3,
                5
            ],
            "members": 1,
            "locked": true
        },
        {
            "object": "plan",
            "id": 43,
            "name": "Example name",
            "description": "An example description.",
            "category_id": 7,
            "category_name": "Example name",
            "ordering": 1,
            "price": 25.5,
            "count_by": "sessions",
            "allowance": 25.5,
            "period": "month",
            "topup_price": 25.5,
            "taxable": 1,
            "taxes": {
                "NY": 8.88,
                "NJ": 6.63
            },
            "missed_counts": 1,
            "cancelled_counts": 1,
            "grace_days": 1,
            "online": 1,
            "status": 1,
            "popular": 1,
            "popular_label": "Most popular",
            "service_ids": [
                3,
                5
            ],
            "members": 1,
            "locked": true
        }
    ]
}

Retrieve a plan

GET /api/v1/plans/{id}

Parameters

ParameterInDescription
idpathThe record's id.

Returns

One plan record, or 404 not_found when no record with that id exists on your account.

Request

curl "https://www.bizstim.com/api/v1/plans/42" \
  -H "X-API-KEY: YOUR_API_KEY" \
  -H "Accept: application/json"

Response

{
    "object": "plan",
    "id": 42,
    "name": "Example name",
    "description": "An example description.",
    "category_id": 7,
    "category_name": "Example name",
    "ordering": 1,
    "price": 25.5,
    "count_by": "sessions",
    "allowance": 25.5,
    "period": "month",
    "topup_price": 25.5,
    "taxable": 1,
    "taxes": {
        "NY": 8.88,
        "NJ": 6.63
    },
    "missed_counts": 1,
    "cancelled_counts": 1,
    "grace_days": 1,
    "online": 1,
    "status": 1,
    "popular": 1,
    "popular_label": "Most popular",
    "service_ids": [
        3,
        5
    ],
    "members": 1,
    "locked": true
}

Create a plan

POST /api/v1/plans

Request body

A JSON object (Content-Type: application/json) with these fields.

FieldTypeRequiredDescription
namestring, up to 100 charactersyesThe plan name.
pricenumber, 0 to 99999999.99yesThe price of one period. Above 0 to sell the plan online.
allowancenumber, more than 0, up to 9999.99yesSessions (a whole number) or hours each period includes.
service_idsarray of integersyesThe services the plan covers, at least one: active services, never the Smart Learn service.
descriptionstring, up to 2000 charactersnoWhat the plan includes (plain text; tags are removed).
category_idintegernoA plan category id (GET /api/v1/plan-categories); 0 = none (default).
orderinginteger, 0 to 9999noThe place within the category, lowest first. Default 0.
count_bystringnosessions (default) or hours.
periodstringnomonth (default) or week.
topup_pricenumber, 0 to 99999999.99noWhat one extra session or hour costs once the allowance is used up; 0 (default) = the normal service rate.
grace_daysinteger, 0 to 31noDays after an unpaid renewal the member may still book. Default 0.
missed_countsbooleannoA missed session uses the allowance. Default true.
cancelled_countsbooleannoA cancelled session uses the allowance. Default false.
taxablebooleannoTax is added at the rates in taxes. Default false.
taxesobjectnoTax rate by state, {"state": percent from 0 to 100}, stored with 2 decimals. Default none.
onlinebooleannoSold on your public Plans page. Needs a price above 0 and services visible to all users. Default false.
statusintegerno1 active (default), 0 inactive.
popularbooleannoHighlight this plan on the Plans page; clears the highlight of the other plans in its category. Default false.
popular_labelstring, up to 30 charactersnoThe highlight's words. Default Most popular.

Returns

201 with the new plan record. Fields left out take the app's Add plan defaults: counts sessions, renews monthly, missed sessions use the allowance, active, not sold online, no tax. 400 invalid_request names the field to fix; 409 conflict when the app refuses the plan (e.g. a plan sold online that covers a service hidden from clients, or no active service).

Request

curl -X POST "https://www.bizstim.com/api/v1/plans" \
  -H "X-API-KEY: YOUR_API_KEY" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Monthly 4 sessions",
    "price": 240,
    "allowance": 4,
    "service_ids": [
        3,
        5
    ]
}'

Response (201)

{
    "object": "plan",
    "id": 42,
    "name": "Example name",
    "description": "An example description.",
    "category_id": 7,
    "category_name": "Example name",
    "ordering": 1,
    "price": 25.5,
    "count_by": "sessions",
    "allowance": 25.5,
    "period": "month",
    "topup_price": 25.5,
    "taxable": 1,
    "taxes": {
        "NY": 8.88,
        "NJ": 6.63
    },
    "missed_counts": 1,
    "cancelled_counts": 1,
    "grace_days": 1,
    "online": 1,
    "status": 1,
    "popular": 1,
    "popular_label": "Most popular",
    "service_ids": [
        3,
        5
    ],
    "members": 1,
    "locked": true
}

Update a plan

PATCH /api/v1/plans/{id}

Parameters

ParameterInDescription
idpathThe record's id.

Request body

A JSON object (Content-Type: application/json) with these fields.

FieldTypeRequiredDescription
namestring, up to 100 charactersnoThe plan name (cannot be emptied).
pricenumber, 0 to 99999999.99noThe price of one period.
allowancenumber, more than 0, up to 9999.99noSessions (a whole number) or hours each period includes.
service_idsarray of integersnoThe whole list of covered services (at least one). A service the plan does not cover yet must be active.
descriptionstring, up to 2000 charactersnoWhat the plan includes; "" removes it.
category_idintegernoA plan category id; 0 = none.
orderinginteger, 0 to 9999noThe place within the category.
count_bystringnosessions or hours (409 once the plan is locked).
periodstringnomonth or week (409 once the plan is locked).
topup_pricenumber, 0 to 99999999.99noWhat one extra session or hour costs; 0 = the normal service rate.
grace_daysinteger, 0 to 31noDays after an unpaid renewal the member may still book.
missed_countsbooleannoA missed session uses the allowance.
cancelled_countsbooleannoA cancelled session uses the allowance.
taxablebooleannoTax is added at the rates in taxes.
taxesobjectnoThe whole set of rates, {"state": percent}; {} removes them all.
onlinebooleannoSold on your public Plans page.
statusintegerno1 active, 0 inactive.
popularbooleannoHighlight this plan in its category.
popular_labelstring, up to 30 charactersnoThe highlight's words; "" = Most popular.

Returns

200 with the updated plan record. Fields left out keep their values; service_ids and taxes, when sent, replace the whole list. 400 invalid_request names the field to fix; 404 not_found; 409 conflict when the app refuses the change (count_by or period on a locked plan, a removed service that members have upcoming sessions on, a plan sold online that covers a hidden service).

Request

curl -X PATCH "https://www.bizstim.com/api/v1/plans/42" \
  -H "X-API-KEY: YOUR_API_KEY" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "price": 260,
    "online": true
}'

Response

{
    "object": "plan",
    "id": 42,
    "name": "Example name",
    "description": "An example description.",
    "category_id": 7,
    "category_name": "Example name",
    "ordering": 1,
    "price": 25.5,
    "count_by": "sessions",
    "allowance": 25.5,
    "period": "month",
    "topup_price": 25.5,
    "taxable": 1,
    "taxes": {
        "NY": 8.88,
        "NJ": 6.63
    },
    "missed_counts": 1,
    "cancelled_counts": 1,
    "grace_days": 1,
    "online": 1,
    "status": 1,
    "popular": 1,
    "popular_label": "Most popular",
    "service_ids": [
        3,
        5
    ],
    "members": 1,
    "locked": true
}

Delete a plan

DELETE /api/v1/plans/{id}

Parameters

ParameterInDescription
idpathThe record's id.

Returns

200 with {"id", "object": "plan", "deleted": true}: the plan, its services and its tax rates are removed. 404 not_found; 409 conflict for a plan anyone has held (locked true): set status 0 instead.

Request

curl -X DELETE "https://www.bizstim.com/api/v1/plans/42" \
  -H "X-API-KEY: YOUR_API_KEY" \
  -H "Accept: application/json"

Response

{
    "id": 42,
    "object": "plan",
    "deleted": true
}