Subscriptions are created in Chargebee using items. Items represent the products or services that you offer to your customers. Items often differ in the number of product features that are available to them. The Features API helps you define the various features offered as part of your product line. It also defines the entitlements that items and subscriptions can have towards said features.
Note
The maximum number of features a site can have is 400.
The Features API enables you to:
{
"feature": {
"description": "Integration of Chargebee with Quickbooks",
"id": "fea-4c163c85-f873-46d4-a268-5a80ddf40971",
"levels": [],
"name": "Quickbooks Integration_123",
"object": "feature",
"status": "draft",
"type": "switch"
}
}
user license
, data storage
, Salesforce Integration
, devices
, UHD Streaming
, and so on. type
quantity
or range
, this specifies the unit of measure. The value is expected in the singular form and when used by the system, it is pluralized automatically as needed. For example, for a feature such as user licenses
, the unit
can be license
. type
is other than switch
.type
of the feature is switch
, this is not applicable. This is because any given entity can be either fully entitled to a switch
feature or not entitled at all; there are no intermediate entitlement levels.curl https://{site}.chargebee.com/api/v2/features \ -G \ -u {site_api_key}:\ --data-urlencode limit=2
user license
, data storage
, Salesforce Integration
, devices
, UHD Streaming
, and so on. number-of-users-ccjht01
. When not provided, a random value is automatically set. # create a switch feature curl https://{site}.chargebee.com/api/v2/features \ -u {site_api_key}:\ -d name="Quickbooks Integration_123" \ -d type="SWITCH" \ -d description="Integration of Chargebee with Quickbooks"
# create a custom type feature curl https://{site}.chargebee.com/api/v2/features \ -u {site_api_key}:\ -d name="Phone Support" \ -d type="CUSTOM" \ -d levels[level][0]=0 \ -d levels[value][0]="24 * 5" \ -d levels[name][0]="24 * 5" \ -d levels[level][1]=1 \ -d levels[value][1]="24 * 7" \ -d levels[name][1]="24 * 7"
# create a quantity type feature curl https://{site}.chargebee.com/api/v2/features \ -u {site_api_key}:\ -d name="User Licenses" \ -d type="QUANTITY" \ -d description="Maximum user licenses allowed" \ -d levels[level][0]=0 \ -d levels[value][0]="5" \ -d levels[name][0]="5 Users" \ -d levels[level][1]=1 \ -d levels[value][1]="10" \ -d levels[name][1]="10 Users" \ -d levels[level][2]=2 \ -d levels[value][2]="Unlimited" \ -d levels[name][2]="Unlimited Users" \ -d levels[is_unlimited][2]=true
# create a range type feature curl https://{site}.chargebee.com/api/v2/features \ -u {site_api_key}:\ -d name="API call limit" \ -d type="RANGE" \ -d description="API call limit" \ -d levels[level][0]=0 \ -d levels[value][0]="5" \ -d levels[name][0]="5 calls/month" \ -d levels[level][1]=1 \ -d levels[value][1]="100" \ -d levels[name][1]="100 calls/month"
user license
, data storage
, Salesforce Integration
, devices
, UHD Streaming
, and so on. type
quantity
or range
, this specifies the unit of measure. The value is expected in the singular form and when used by the system, it is pluralized automatically as needed. For example, for a feature such as user licenses
, the unit
can be license
. Updates a specific feature.
Note
The list of objects levels[]
provided as part of this operation fully replaces the existing
list of objects levels[]
of the feature.
levels
This section describes validations that are performed by Chargebee when modifying the levels
list of
objects for the feature, using this operation.
levels
Adding a new object to the levels[]
list is allowed if and only if the feature type
is quantity
or custom
levels
Removing an existing object in the levels[]
list is not allowed if the value
for that
object is currently mapped to one or more item_entitlement
s or
subscription_entitlement
s.
levels
Note
The validation described in this section is only applicable for features of type
custom
If any of levels[].value
are currently mapped to item_entitlement
s or subscription_entitlement
s,
then the relative order of the corresponding levels[].level
must be preserved when invoking this
operation.
For example, consider that the levels[]
list is currently in the state shown below. (For brevity,
only the value
and level
key are shown here and the JSONs have been compacted.)
{
"levels":[{
"value":"email-basic",
"level":0
},{
"value":"email-rise",
"level":1
},{
"value":"email-advanced",
"level":2
},{
"value":"email-pro",
"level":3
},{
"value":"email-scale",
"level":4
}]
}
Now consider that email-rise
, email-advanced
, and email-pro
have already
been mapped to item_entitlement
s or subscription_entitlement
s. As seen in the above
object, the relative order of levels[].level
is such that email-rise
< email-advanced
< email-pro
.
Invoking this API to change levels[]
to the state below is allowed since the relative order of
level
corresponding to email-rise
, email-advanced
, and
email-pro
has been preserved.
{
"levels":[{
"value":"email-basic",
"level":0
},{
"value":"email-rise",
"level":1
},{
"value":"email-scale",
"level":2
},{
"value":"email-advanced",
"level":3
},{
"value":"email-pro",
"level":4
}]
}
However, changing levels[]
to the state shown below is not permissible because the
level
of email-advanced
is provided as greater than the level
of email-pro
,
thereby disrupting the original order.
{
"levels":[{
"value":"email-basic",
"level":0
},{
"value":"email-rise",
"level":1
},{
"value":"email-pro",
"level":2
},{
"value":"email-advanced",
"level":3
},{
"value":"email-scale",
"level":4
}]
}
# update a quantity type feature curl https://{site}.chargebee.com/api/v2/features/fea-a5d1f7de-c58c-45da-a08b-6934e3ab3ede \ -u {site_api_key}:\ -d name="User Licenses (updated name)" \ -d description="Maximum number of user licenses allowed" \ -d status="ACTIVE" \ -d levels[level][0]=0 \ -d levels[value][0]="25" \ -d levels[name][0]="25 Users" \ -d levels[level][1]=1 \ -d levels[value][1]="100" \ -d levels[name][1]="100 Users" \ -d levels[level][2]=2 \ -d levels[value][2]="Unlimited" \ -d levels[name][2]="Unlimited Users" \ -d levels[is_unlimited][2]=true
user license
, data storage
, Salesforce Integration
, devices
, UHD Streaming
, and so on. type
quantity
or range
, this specifies the unit of measure. The value is expected in the singular form and when used by the system, it is pluralized automatically as needed. For example, for a feature such as user licenses
, the unit
can be license
. curl https://{site}.chargebee.com/api/v2/features/fea-user-licenes \ -u {site_api_key}:
status
of the feature is active
.curl https://{site}.chargebee.com/api/v2/features/fea-d49b2371-572b-439d-993d-04b8135194c3/delete \ -X POST \ -u {site_api_key}:
draft
feature so that any entitlements or subscription entitlements defined towards it take effect immediately. This operation changes the status
of the feature to active
. The feature status
must be draft
when calling this endpoint.curl https://{site}.chargebee.com/api/v2/features/fea-8f2fb6c8-d582-435a-9d92-b3e04ec7f40e/activate_command \ -X POST \ -u {site_api_key}:
active
feature so that no new entitlements or subscription entitlements can be created towards the feature. Any pre-existing item or subscription entitlements from the time that the feature was active
remain effective. This operation changes the status
of the feature to archived
. The feature status
must be active
when calling this endpoint.curl https://{site}.chargebee.com/api/v2/features/fea-c3c68438-9f26-4a88-b2cb-88428a8d85f5/archive_command \ -X POST \ -u {site_api_key}:
status
of the feature to active
. The feature status
must be archived
when calling this endpoint.curl https://{site}.chargebee.com/api/v2/features/fea-a2dbb732-c54d-4a96-aaa3-b8c0b362e578/reactivate_command \ -X POST \ -u {site_api_key}: