API reference
Test mode. Use your secret key on your server; live processing is currently disabled.
https://api.knoxapi.comSend form-encoded requests with Authorization: Bearer sk_test_....
Complete OpenAPI specification · Integration guide
Operations and schemas are based on the pinned Stripe OpenAPI specification (MIT). Nested object definitions and enums are available in the complete specification.
List all plans
Returns a list of your plans.
Request parameters
| Parameter | Location | Type | Description |
|---|---|---|---|
active | query | boolean | Only return plans that are active or inactive (e.g., pass `false` to list all inactive plans). |
created | query | one of multiple schemas | A filter on the list, based on the object `created` field. The value can be a string with an integer Unix timestamp, or it can be a dictionary with a number of different query options. |
ending_before | query | string | A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. |
expand | query | array of string | Specifies which fields in the response should be expanded. |
limit | query | integer | A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10. |
product | query | string | Only return plans for the given product. |
starting_after | query | string | A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list. |
object. See the OpenAPI specification for the complete schema.
Responses
HTTP 200: Successful response.
| Field | Type | Description |
|---|---|---|
data required | array of plan | Details about each object. |
has_more required | boolean | True if this list has another page of items after this one that can be fetched. |
object required | string | String representing the object's type. Objects of the same type share the same value. Always has the value `list`. |
url required | string | The URL where this list can be accessed. |
HTTP default: Error response.
| Field | Type | Description |
|---|---|---|
error required | api_errors |
Create a plan
You can now model subscriptions more flexibly using the Prices API. It replaces the Plans API and is backwards compatible to simplify your migration.
Request parameters
| Field | Type | Description |
|---|---|---|
active | boolean | Whether the plan is currently available for new subscriptions. Defaults to `true`. |
amount | integer | A positive integer in cents (or local equivalent) (or 0 for a free plan) representing how much to charge on a recurring basis. |
amount_decimal | string | Same as `amount`, but accepts a decimal value with at most 12 decimal places. Only one of `amount` and `amount_decimal` can be set. |
billing_scheme | string | Describes how to compute the price per period. Either `per_unit` or `tiered`. `per_unit` indicates that the fixed amount (specified in `amount`) will be charged per unit in `quantity` (for plans with `usage_type=licensed`), or per unit of total usage (for plans with `usage_type=metered`). `tiered` indicates that the unit pricing will be computed using a tiering strategy as defined using the `tiers` and `tiers_mode` attributes. |
currency required | string | Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). |
expand | array of string | Specifies which fields in the response should be expanded. |
id | string | An identifier randomly generated by Stripe. Used to identify this plan when subscribing a customer. You can optionally override this ID, but the ID must be unique across all plans in your Stripe account. You can, however, use the same plan ID in both live and test modes. |
interval required | string | Specifies billing frequency. Either `day`, `week`, `month` or `year`. |
interval_count | integer | The number of intervals between subscription billings. For example, `interval=month` and `interval_count=3` bills every 3 months. Maximum of three years interval allowed (3 years, 36 months, or 156 weeks). |
metadata | one of multiple schemas | Set of [key-value pairs](https://docs.stripe.com/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`. |
meter | string | The meter tracking the usage of a metered price |
nickname | string | A brief description of the plan, hidden from customers. |
product | one of multiple schemas | |
tiers | array of object | Each element represents a pricing tier. This parameter requires `billing_scheme` to be set to `tiered`. See also the documentation for `billing_scheme`. |
tiers_mode | string | Defines if the tiering price should be `graduated` or `volume` based. In `volume`-based tiering, the maximum quantity within a period determines the per unit price, in `graduated` tiering pricing can successively change as the quantity grows. |
transform_usage | object | Apply a transformation to the reported usage or set quantity before computing the billed price. Cannot be combined with `tiers`. |
trial_period_days | integer | Default number of trial days when subscribing a customer to this plan using [`trial_from_plan=true`](https://docs.stripe.com/api#create_subscription-trial_from_plan). |
usage_type | string | Configures how the quantity per period should be determined. Can be either `metered` or `licensed`. `licensed` automatically bills the `quantity` set when adding it to a subscription. `metered` aggregates the total usage based on usage records. Defaults to `licensed`. |
Responses
HTTP 200: Successful response.
| Field | Type | Description |
|---|---|---|
active required | boolean | Whether the plan can be used for new purchases. |
amount | integer | The unit amount in cents (or local equivalent) to be charged, represented as a whole integer if possible. Only set if `billing_scheme=per_unit`. |
amount_decimal | string | The unit amount in cents (or local equivalent) to be charged, represented as a decimal string with at most 12 decimal places. Only set if `billing_scheme=per_unit`. |
billing_scheme required | string | Describes how to compute the price per period. Either `per_unit` or `tiered`. `per_unit` indicates that the fixed amount (specified in `amount`) will be charged per unit in `quantity` (for plans with `usage_type=licensed`), or per unit of total usage (for plans with `usage_type=metered`). `tiered` indicates that the unit pricing will be computed using a tiering strategy as defined using the `tiers` and `tiers_mode` attributes. |
created required | integer | Time at which the object was created. Measured in seconds since the Unix epoch. |
currency required | string | Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). |
id required | string | Unique identifier for the object. |
interval required | string | The frequency at which a subscription is billed. One of `day`, `week`, `month` or `year`. |
interval_count required | integer | The number of intervals (specified in the `interval` attribute) between subscription billings. For example, `interval=month` and `interval_count=3` bills every 3 months. |
livemode required | boolean | If the object exists in live mode, the value is `true`. If the object exists in test mode, the value is `false`. |
metadata | object | Set of [key-value pairs](https://docs.stripe.com/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. |
meter | string | The meter tracking the usage of a metered price |
nickname | string | A brief description of the plan, hidden from customers. |
object required | string | String representing the object's type. Objects of the same type share the same value. |
product | one of multiple schemas | The product whose pricing this plan determines. |
tiers | array of plan_tier | Each element represents a pricing tier. This parameter requires `billing_scheme` to be set to `tiered`. See also the documentation for `billing_scheme`. |
tiers_mode | string | Defines if the tiering price should be `graduated` or `volume` based. In `volume`-based tiering, the maximum quantity within a period determines the per unit price. In `graduated` tiering, pricing can change as the quantity grows. |
transform_usage | one of multiple schemas | Apply a transformation to the reported usage or set quantity before computing the amount billed. Cannot be combined with `tiers`. |
trial_period_days | integer | Default number of trial days when subscribing a customer to this plan using [`trial_from_plan=true`](https://docs.stripe.com/api#create_subscription-trial_from_plan). |
usage_type required | string | Configures how the quantity per period should be determined. Can be either `metered` or `licensed`. `licensed` automatically bills the `quantity` set when adding it to a subscription. `metered` aggregates the total usage based on usage records. Defaults to `licensed`. |
HTTP default: Error response.
| Field | Type | Description |
|---|---|---|
error required | api_errors |
Delete a plan
Deleting plans means new subscribers can’t be added. Existing subscribers aren’t affected.
Request parameters
| Parameter | Location | Type | Description |
|---|---|---|---|
plan | path | string |
object. See the OpenAPI specification for the complete schema.
Responses
HTTP 200: Successful response.
| Field | Type | Description |
|---|---|---|
deleted required | boolean | Always true for a deleted object |
id required | string | Unique identifier for the object. |
object required | string | String representing the object's type. Objects of the same type share the same value. |
HTTP default: Error response.
| Field | Type | Description |
|---|---|---|
error required | api_errors |
Retrieve a plan
Retrieves the plan with the given ID.
Request parameters
| Parameter | Location | Type | Description |
|---|---|---|---|
expand | query | array of string | Specifies which fields in the response should be expanded. |
plan | path | string |
object. See the OpenAPI specification for the complete schema.
Responses
HTTP 200: Successful response.
| Field | Type | Description |
|---|---|---|
active required | boolean | Whether the plan can be used for new purchases. |
amount | integer | The unit amount in cents (or local equivalent) to be charged, represented as a whole integer if possible. Only set if `billing_scheme=per_unit`. |
amount_decimal | string | The unit amount in cents (or local equivalent) to be charged, represented as a decimal string with at most 12 decimal places. Only set if `billing_scheme=per_unit`. |
billing_scheme required | string | Describes how to compute the price per period. Either `per_unit` or `tiered`. `per_unit` indicates that the fixed amount (specified in `amount`) will be charged per unit in `quantity` (for plans with `usage_type=licensed`), or per unit of total usage (for plans with `usage_type=metered`). `tiered` indicates that the unit pricing will be computed using a tiering strategy as defined using the `tiers` and `tiers_mode` attributes. |
created required | integer | Time at which the object was created. Measured in seconds since the Unix epoch. |
currency required | string | Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). |
id required | string | Unique identifier for the object. |
interval required | string | The frequency at which a subscription is billed. One of `day`, `week`, `month` or `year`. |
interval_count required | integer | The number of intervals (specified in the `interval` attribute) between subscription billings. For example, `interval=month` and `interval_count=3` bills every 3 months. |
livemode required | boolean | If the object exists in live mode, the value is `true`. If the object exists in test mode, the value is `false`. |
metadata | object | Set of [key-value pairs](https://docs.stripe.com/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. |
meter | string | The meter tracking the usage of a metered price |
nickname | string | A brief description of the plan, hidden from customers. |
object required | string | String representing the object's type. Objects of the same type share the same value. |
product | one of multiple schemas | The product whose pricing this plan determines. |
tiers | array of plan_tier | Each element represents a pricing tier. This parameter requires `billing_scheme` to be set to `tiered`. See also the documentation for `billing_scheme`. |
tiers_mode | string | Defines if the tiering price should be `graduated` or `volume` based. In `volume`-based tiering, the maximum quantity within a period determines the per unit price. In `graduated` tiering, pricing can change as the quantity grows. |
transform_usage | one of multiple schemas | Apply a transformation to the reported usage or set quantity before computing the amount billed. Cannot be combined with `tiers`. |
trial_period_days | integer | Default number of trial days when subscribing a customer to this plan using [`trial_from_plan=true`](https://docs.stripe.com/api#create_subscription-trial_from_plan). |
usage_type required | string | Configures how the quantity per period should be determined. Can be either `metered` or `licensed`. `licensed` automatically bills the `quantity` set when adding it to a subscription. `metered` aggregates the total usage based on usage records. Defaults to `licensed`. |
HTTP default: Error response.
| Field | Type | Description |
|---|---|---|
error required | api_errors |
Update a plan
Updates the specified plan by setting the values of the parameters passed. Any parameters not provided are left unchanged. By design, you cannot change a plan’s ID, amount, currency, or billing cycle.
Request parameters
| Parameter | Location | Type | Description |
|---|---|---|---|
plan | path | string |
| Field | Type | Description |
|---|---|---|
active | boolean | Whether the plan is currently available for new subscriptions. |
expand | array of string | Specifies which fields in the response should be expanded. |
metadata | one of multiple schemas | Set of [key-value pairs](https://docs.stripe.com/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`. |
nickname | string | A brief description of the plan, hidden from customers. |
product | string | The product the plan belongs to. This cannot be changed once it has been used in a subscription or subscription schedule. |
trial_period_days | integer | Default number of trial days when subscribing a customer to this plan using [`trial_from_plan=true`](https://docs.stripe.com/api#create_subscription-trial_from_plan). |
Responses
HTTP 200: Successful response.
| Field | Type | Description |
|---|---|---|
active required | boolean | Whether the plan can be used for new purchases. |
amount | integer | The unit amount in cents (or local equivalent) to be charged, represented as a whole integer if possible. Only set if `billing_scheme=per_unit`. |
amount_decimal | string | The unit amount in cents (or local equivalent) to be charged, represented as a decimal string with at most 12 decimal places. Only set if `billing_scheme=per_unit`. |
billing_scheme required | string | Describes how to compute the price per period. Either `per_unit` or `tiered`. `per_unit` indicates that the fixed amount (specified in `amount`) will be charged per unit in `quantity` (for plans with `usage_type=licensed`), or per unit of total usage (for plans with `usage_type=metered`). `tiered` indicates that the unit pricing will be computed using a tiering strategy as defined using the `tiers` and `tiers_mode` attributes. |
created required | integer | Time at which the object was created. Measured in seconds since the Unix epoch. |
currency required | string | Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). |
id required | string | Unique identifier for the object. |
interval required | string | The frequency at which a subscription is billed. One of `day`, `week`, `month` or `year`. |
interval_count required | integer | The number of intervals (specified in the `interval` attribute) between subscription billings. For example, `interval=month` and `interval_count=3` bills every 3 months. |
livemode required | boolean | If the object exists in live mode, the value is `true`. If the object exists in test mode, the value is `false`. |
metadata | object | Set of [key-value pairs](https://docs.stripe.com/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. |
meter | string | The meter tracking the usage of a metered price |
nickname | string | A brief description of the plan, hidden from customers. |
object required | string | String representing the object's type. Objects of the same type share the same value. |
product | one of multiple schemas | The product whose pricing this plan determines. |
tiers | array of plan_tier | Each element represents a pricing tier. This parameter requires `billing_scheme` to be set to `tiered`. See also the documentation for `billing_scheme`. |
tiers_mode | string | Defines if the tiering price should be `graduated` or `volume` based. In `volume`-based tiering, the maximum quantity within a period determines the per unit price. In `graduated` tiering, pricing can change as the quantity grows. |
transform_usage | one of multiple schemas | Apply a transformation to the reported usage or set quantity before computing the amount billed. Cannot be combined with `tiers`. |
trial_period_days | integer | Default number of trial days when subscribing a customer to this plan using [`trial_from_plan=true`](https://docs.stripe.com/api#create_subscription-trial_from_plan). |
usage_type required | string | Configures how the quantity per period should be determined. Can be either `metered` or `licensed`. `licensed` automatically bills the `quantity` set when adding it to a subscription. `metered` aggregates the total usage based on usage records. Defaults to `licensed`. |
HTTP default: Error response.
| Field | Type | Description |
|---|---|---|
error required | api_errors |