Search…
Plans

Standard Plan Object

Standard Plans can only be created on the dashboard or by using a Service Account. See below for more info and the Blueprint Subscribe! for more details about how Plans and Subscriptions can work.
Attribute
Type
Description
method
string
The plan type. Default is basic.
currency
string
3 letter ISO currency code as defined by ISO 4217.
interval_unit
string
The billing frequency. Choices: DAY, WEEK, MONTH, MONTH_END, ANNUAL
name
string
The name of the plan.
human_id
string
Human readable ID that identifies the order easily, e.g. 3AG7UA
note
string
A short description of the plan.
billing_interval
string
Defines billing frequency. Choices: WEEK, MONTH, MONTH_END
items
array
List of items in the Plan. See description below.
units
number
Total number of items in the plan.
total_amount
integer
The amount to be charged on the interval specified. If missing, this will be calculated as the sum of the items.
initial_fail_amount_action
string
Decides the action taken if a payment fails in the Subscription. Choices: CANCEL, CONTINUE
max_fail_attempts
integer
If initial_fail_amount_action is CONTINUE, this is the number of interval_units that is allowed to fail before the Subscription stops.
setup_fee
integer
Initial setup fee or administrative fee, charged on creation of Subscription. Can’t be less than 0. Default is 0.
is_prorated
boolean
Sets if a plan is allowed to charge a prorate amount, which value is defined in the Subscription. Default is true.
should_retry_payments
boolean
Allow to use a retry payment system. It means if the attempt to pay a Subscription fails then automatically BuiltOn will plan another payment later. Default is false
max_payment_retries
integer
Defines how many time BuiltOn will retry to pay a Subscription . Default is 0.
retry_payment_in_minutes
integer
Defines how many time BuiltOn has to wait to retry a payment. Default is 720 (12 hours).

Plan Items

The attribute items in the Plan Object is where you put the Products your user wants to buy. These items are stored in an array. Each item has the below attributes. See Updating Items in an Order for more details on how this is used.
Attributes
Type
Description
product
string
A Product unique ID.
quantity
number
The quantity of the product.
discount
number
The discount of the product.price in the plan.
sub_products
array
An array of sub-product IDs associated in the plan.

Admin Role

*Paths listed above and denoted with a star are accessible to both Users and Admins. Additional Admin Role paths are listed below.

Create a Standard Plan

Parameters
Request
Response
Body Parameters
Type
Description
interval_unit
string
The frequency that the Subscription acts upon. Choices areday, week, month, month_end, annual
billing_interval
string
Defines billing frequency. Choices are week, month, month_end
currency
string
Three letter ISO currency code as defined by ISO 4217.7
name
string
The name of the plan.
note
string
A short description of the plan.
items
array
List of items associated with the Plan.
setup_fee
number
A setup fee that will be paid at the beginning of the first payment cycle. Can't be less than 0. Default value is 0.
prepay
boolean
Defines whether the subscription payment is charged at the beginning or end of the billing cycle. Default value is false.
is_prorated
boolean
Sets if a Plan is allowed to charge a prorate amount, which value is defined in the Subscription. Default is true.
total_amount
number
Total amount of plan if not calculated automatically from products/resources.
should_retry_payments
boolean
Allow to use a retry payment system. It means if the attempt to pay a Subscription fails then automatically BuiltOn will plan another payment later. Default is false
max_payment_retries
integer
Defines how many time BuiltOn will retry to pay a Subscription . Default is 0.
retry_payment_in_minutes
integer
Defines how many time BuiltOn has to wait to retry a payment. Default is 720 (12 hours).
1
POST /plans HTTP/1.1
2
Content-Type: application/json
3
Authorization: Bearer <service-account-key>
4
X-Builton-Api-Key: <builton-api-key>
5
Host: api.builton.dev
6
7
{
8
"interval_unit": "WEEK",
9
"name": "Plan Deluxe",
10
"currency": "NOK",
11
"static": true,
12
"billing_interval": "MONTH",
13
"items": [{"product": "<product1_id>", "quantity": 1},
14
{"product": "<product2_id>", "quantity": 2, "discount": 0.5}],
15
"initial_fail_amount_action": "CONTINUE",
16
"max_fail_attempts": 1,
17
"note": "This is a note regarding the Plan"
18
}
Copied!
1
HTTP/1.1 200 OK
2
Content-Type: application/json
3
4
{
5
"_id": {
6
"$oid": "5931697ed57ba271c0c7de66"},
7
"created": {
8
"$date": 1496410494652},
9
"modified": {
10
"$date": 1496410494652},
11
"auto_bill_amount": false,
12
"billing_interval": "MONTH",
13
"initial_fail_amount_action": "CONTINUE",
14
"max_fail_attempts": 1,
15
"name": "Plan Deluxe",
16
"name": "basic"
17
"total_amount": 300.0,
18
"interval_unit": "WEEK",
19
"items": [
20
{"discount": 0.0,
21
"product": {"$oid": "5931697ed57ba271c0c7de64"},
22
"quantity": 1},
23
{"discount": 0.5,
24
"product": {"$oid": "5931697ed57ba271c0c7de65"},
25
"quantity": 2}],
26
"currency": "NOK",
27
"note": "This is a note regarding the Plan",
28
"deleted": false,
29
"company": {
30
"$oid": "57ee9c71d76d431f8511142f"},
31
"static": true,
32
"setup_fee": 0
33
}
Copied!

Retrieve a Plan

Parameters
Request
Response
Path Parameters
Type
Description
<plan_id>
string
ID of the plan to get.
1
GET /plans/5931697ed57ba271c0c7de66 HTTP/1.1
2
Content-Type: application/json
3
Authorization: Bearer <service-account-key>
4
X-Builton-Api-Key: <builton-api-key>
5
Host: api.builton.dev
Copied!
1
HTTP/1.1 200 OK
2
Content-Type: application/json
3
4
{
5
"_id": {
6
"$oid": "5931697ed57ba271c0c7de66"},
7
"created": {
8
"$date": 1496410494652},
9
"updated": {
10
"$date": 1496411756242},
11
"items": [
12
{"discount": 0.0,
13
"product": {"$oid": "5931697ed57ba271c0c7de64"},
14
"quantity": 1},
15
{"discount": 0.5,
16
"product": {"$oid": "5931697ed57ba271c0c7de65"},
17
"quantity": 2}
18
],
19
"deleted": false,
20
"billing_interval": "MONTH",
21
"currency": "NOK",
22
"name": "Golden Plan",
23
"interval_unit": "WEEK",
24
"static": false,
25
"total_amount": 500.0,
26
"company": {"$oid": "57ee9c71d76d431f8511142f"},
27
"setup_fee": 0
28
}
Copied!

Get List of all Plans associated with Company

Request
Response
1
GET /plans HTTP/1.1
2
Content-Type: application/json
3
Authorization: Bearer <service-account-key>
4
X-Builton-Api-Key: <builton-api-key>
5
Host: api.builton.dev
Copied!
1
HTTP/1.1 200 OK
2
Content-Type: application/json
3
[
4
{
5
"created": {"$date": 1496412265911},
6
"interval_unit": "WEEK",
7
"currency": "NOK",
8
"name": "Golden Plan",
9
"updated": {"$date": 1496412265911},
10
"static": false,
11
"billing_interval": "MONTH",
12
"_id": {"$oid": "59317069d57ba2781c739479"},
13
"total_amount": 500.0,
14
"company": {"$oid": "57ee9c71d76d431f8511142f"},
15
"deleted": false,
16
"items": [
17
{
18
"discount": 0.0,
19
"quantity": 1,
20
"product": {"$oid": "59317069d57ba2781c739477"}
21
},
22
{
23
"discount": 0.0,
24
"quantity": 2,
25
"product": {"$oid": "59317069d57ba2781c739478"}
26
}
27
]
28
},
29
{
30
"created": {"$date": 1496412265930},
31
"interval_unit": "WEEK",
32
"...": "..."
33
}
34
]
Copied!

Add Items to a Plan

Parameters
Request
Response
Path Parameters
Type
Description
<plan_id>
string
Plan ID where Items will be added
Body Parameters
Type
Description
items
array
List of Item objects associated with Plan.
1
PUT /plans/5931697ed57ba271c0c7de66/items HTTP/1.1
2
Content-Type: application/json
3
Authorization: Bearer <service-account-key>
4
X-Builton-Api-Key: <builton-api-key>
5
Host: api.builton.dev
6
7
{
8
"items": [{"product": "<product1_id>", "quantity": 1},
9
{"product": "<product2_id>", "quantity": 2, "discount": 0.5}]
10
}
Copied!
1
HTTP/1.1 200 OK
2
Content-Type: application/json
3
4
{
5
"_id": {"$oid": "5931697ed57ba271c0c7de66"},
6
"created": {"$date": 1496410494652},
7
"updated": {"$date": 1496410494652},
8
"method": "recurring_order",
9
"auto_bill_amount": false,
10
"billing_interval": "MONTH",
11
"initial_fail_amount_action": "CONTINUE",
12
"max_fail_attempts": 1,
13
"name": "Recurring Order Plan Deluxe",
14
"total_amount": 300.0,
15
"interval_unit": "WEEK",
16
"items": [{"product": "<product1_id>", "quantity": 1},
17
{"product": "<product2_id>", "quantity": 2, "discount": 0.5}],
18
"currency": "NOK",
19
"note": "This is a note regarding the Plan",
20
"deleted": false,
21
"company": {"$oid": "57ee9c71d76d431f8511142f"},
22
"static": true,
23
}
Copied!

Get Subscriptions used by Plan

Parameters
Request
Response
Path Parameters
Type
Description
<plan_id>
string
Plan ID associated with returned list of subscriptions.
1
GET /plans/5bace152cb416c14a3115a6c/subscriptions HTTP/1.1
2
Content-Type: application/json
3
Authorization: Bearer <service-account-key>
4
X-Builton-Api-Key: <builton-api-key>
5
Host: api.builton.dev
Copied!
1
HTTP/1.1 200 OK
2
Content-Type: application/json
3
4
[
5
{
6
"_id":{"$oid":"5964a0ead57ba2036750a3b4"},
7
"_cls":"SubscriptionMethod.LicenseSubscription",
8
"created":{"$date":1538056530832},
9
"updated":{"$date":1538056530832},
10
"active":true,
11
"deleted":false,
12
"trial":false,
13
"user":{"$oid":"57ee9c72d76d431f85111432"},
14
"company":{"$oid":"57ee9c71d76d431f8511142f"},
15
"status":"CREATED",
16
"payments":[],
17
"infinite":false,
18
"plan":{"$oid":"5bace152cb416c14a3115a6c"},
19
"prorate_amount":0.0,
20
"total_fail_attempts":0,
21
"method":"license",
22
"name":"LICENSE"
23
}
24
]
Copied!