API reference
Prices
Prices define the unit cost, currency, and (optional) billing cycle for both recurring and one-time purchases of products. Products help you track inventory or provisioning, and prices help you track payment terms. Different physical goods or levels of service should be represented by products, and pricing options should be represented by prices. This approach lets you change prices without having to change your provisioning scheme. For example, you might have a single "gold" product that has prices for $10/month, $100/year, and €9 once. Related guides: Set up a subscription, create an invoice, and more about products and prices.
https://api.knoxapi.comCreate a price
POST/v1/prices
Creates a new Price for an existing Product. The Price can be recurring or one-time.
Body parameters
currencystringRequiredThree-letter ISO currency code, in lowercase. Must be a supported currency.
activebooleanWhether the price can be used for new purchases. Defaults to
true.billing_schemestringDescribes how to compute the price per period. Either
per_unitortiered.per_unitindicates that the fixed amount (specified inunit_amountorunit_amount_decimal) will be charged per unit inquantity(for prices withusage_type=licensed), or per unit of total usage (for prices withusage_type=metered).tieredindicates that the unit pricing will be computed using a tiering strategy as defined using thetiersandtiers_modeattributes.Possible valuesper_unittiered
currency_optionsobjectPrices defined in each available currency option. Each key must be a three-letter ISO currency code and a supported currency.
custom_unit_amountobjectWhen set, provides configuration for the amount to be adjusted by the customer during Checkout Sessions and Payment Links.
Show 4 child parameters
enabledbooleanRequiredmaximumintegerminimumintegerpresetinteger
expandarray of stringsSpecifies which fields in the response should be expanded.
lookup_keystringA lookup key used to retrieve prices dynamically from a static string. This may be up to 200 characters.
metadataobjectSet of key-value pairs 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.nicknamestringA brief description of the price, hidden from customers.
productstringThe ID of the Product that this Price will belong to.
product_dataobjectThese fields can be used to create a new product that this price will belong to.
Show 7 child parameters
namestringRequiredactivebooleanidstringmetadataobjectstatement_descriptorstringtax_codestringunit_labelstring
recurringobjectThe recurring components of a price such as
intervalandusage_type.Show 4 child parameters
intervalstringRequiredPossible valuesdaymonthweekyear
interval_countintegermeterstringusage_typestringPossible valueslicensedmetered
tax_behaviorstringOnly required if a default tax behavior) was not provided in the Stripe Tax settings. Specifies whether the price is considered inclusive of taxes or exclusive of taxes. One of
inclusive,exclusive, orunspecified. Once specified as eitherinclusiveorexclusive, it cannot be changed.Possible valuesexclusiveinclusiveunspecified
tiersarray of objectsEach element represents a pricing tier. This parameter requires
billing_schemeto be set totiered. See also the documentation forbilling_scheme.Show 5 child parameters
up_tostring | integerRequiredPossible valuesinf
flat_amountintegerflat_amount_decimalstringunit_amountintegerunit_amount_decimalstring
tiers_modestringDefines if the tiering price should be
graduatedorvolumebased. Involume-based tiering, the maximum quantity within a period determines the per unit price, ingraduatedtiering pricing can successively change as the quantity grows.Possible valuesgraduatedvolume
transfer_lookup_keybooleanIf set to true, will atomically remove the lookup key from the existing price, and assign it to this price.
transform_quantityobjectApply a transformation to the reported usage or set quantity before computing the billed price. Cannot be combined with
tiers.Show 2 child parameters
divide_byintegerRequiredroundstringRequiredPossible valuesdownup
unit_amountintegerA positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge. One of
unit_amount,unit_amount_decimal, orcustom_unit_amountis required, unlessbilling_scheme=tiered.unit_amount_decimalstringSame as
unit_amount, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one ofunit_amountandunit_amount_decimalcan be set.
Returns
The price object.
curl https://api.knoxapi.com/v1/prices \
-H "Authorization: Bearer $KNOX_SECRET_KEY" \
-d currency=usdconst Stripe = require('stripe');
const stripe = new Stripe(process.env.KNOX_SECRET_KEY, {host: 'api.knoxapi.com'});
const price = await stripe.prices.create({
currency: 'usd',
});import os
import stripe
client = stripe.StripeClient(
os.environ["KNOX_SECRET_KEY"],
base_addresses={"api": "https://api.knoxapi.com"},
)
price = client.v1.prices.create(params={
"currency": "usd",
})require 'stripe'
Stripe.api_key = ENV['KNOX_SECRET_KEY']
Stripe.api_base = 'https://api.knoxapi.com'
price = Stripe::Price.create({
currency: 'usd',
}){
"active": true,
"billing_scheme": "per_unit",
"created": 1234567890,
"currency": "usd",
"custom_unit_amount": {
"maximum": null,
"minimum": null,
"preset": null
},
"id": "price_1PgafmB7WZ01zgkW6dKueIc5",
"livemode": false,
"lookup_key": null,
"metadata": {},
"nickname": null,
"object": "price",
"product": "prod_QXg1hqf4jFNsqG",
"recurring": {
"interval": "month",
"interval_count": 1,
"meter": null,
"usage_type": "licensed",
"trial_period_days": null
},
"tax_behavior": "unspecified",
"tiers_mode": null,
"transform_quantity": {
"divide_by": 1592560163,
"round": "down"
},
"type": "recurring",
"unit_amount": 2000,
"unit_amount_decimal": "2000"
}List all prices
GET/v1/prices
Returns a list of your active prices, excluding inline prices. For the list of inactive prices, set active to false.
Query parameters
activebooleanOnly return prices that are active or inactive (e.g., pass
falseto list all inactive prices).createdobject | integerA filter on the list, based on the object
createdfield. The value can be a string with an integer Unix timestamp, or it can be a dictionary with a number of different query options.Show 4 child parameters
gtintegergteintegerltintegerlteinteger
currencystringOnly return prices for the given currency.
ending_beforestringA cursor for use in pagination.
ending_beforeis an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting withobj_bar, your subsequent call can includeending_before=obj_barin order to fetch the previous page of the list.expandarray of stringsSpecifies which fields in the response should be expanded.
limitintegerA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
lookup_keysarray of stringsOnly return the price with these lookup_keys, if any exist. You can specify up to 10 lookup_keys.
productstringOnly return prices for the given product.
recurringobjectOnly return prices with these recurring fields.
Show 3 child parameters
intervalstringPossible valuesdaymonthweekyear
meterstringusage_typestringPossible valueslicensedmetered
starting_afterstringA cursor for use in pagination.
starting_afteris an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending withobj_foo, your subsequent call can includestarting_after=obj_fooin order to fetch the next page of the list.typestringOnly return prices of type
recurringorone_time.Possible valuesone_timerecurring
Returns
A list of price objects.
curl -G https://api.knoxapi.com/v1/prices \
-H "Authorization: Bearer $KNOX_SECRET_KEY" \
--data-urlencode limit=3const Stripe = require('stripe');
const stripe = new Stripe(process.env.KNOX_SECRET_KEY, {host: 'api.knoxapi.com'});
const page = await stripe.prices.list({
limit: 3,
});import os
import stripe
client = stripe.StripeClient(
os.environ["KNOX_SECRET_KEY"],
base_addresses={"api": "https://api.knoxapi.com"},
)
page = client.v1.prices.list(params={
"limit": 3,
})require 'stripe'
Stripe.api_key = ENV['KNOX_SECRET_KEY']
Stripe.api_base = 'https://api.knoxapi.com'
page = Stripe::Price.list({
limit: 3,
}){
"object": "list",
"url": "/v1/prices",
"has_more": false,
"data": [
{
"active": true,
"billing_scheme": "per_unit",
"created": 1234567890,
"currency": "usd",
"custom_unit_amount": {
"maximum": null,
"minimum": null,
"preset": null
},
"id": "price_1PgafmB7WZ01zgkW6dKueIc5",
"livemode": false,
"lookup_key": null,
"metadata": {},
"nickname": null,
"object": "price",
"product": "prod_QXg1hqf4jFNsqG",
"recurring": {
"interval": "month",
"interval_count": 1,
"meter": null,
"usage_type": "licensed",
"trial_period_days": null
},
"tax_behavior": "unspecified",
"tiers_mode": null,
"transform_quantity": {
"divide_by": 1592560163,
"round": "down"
},
"type": "recurring",
"unit_amount": 2000,
"unit_amount_decimal": "2000"
}
]
}Search prices
GET/v1/prices/search
Search for prices you’ve previously created using Stripe’s Search Query Language. Don’t use search in read-after-write flows where strict consistency is necessary. Under normal operating conditions, data is searchable in less than a minute. Occasionally, propagation of new or updated data can be up to an hour behind during outages. Search functionality is not available to merchants in India.
Query parameters
querystringRequiredThe search query string. See search query language and the list of supported query fields for prices.
expandarray of stringsSpecifies which fields in the response should be expanded.
limitintegerA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
pagestringA cursor for pagination across multiple pages of results. Don't include this parameter on the first call. Use the next_page value returned in a previous response to request subsequent results.
Returns
A search result of price objects.
curl -G https://api.knoxapi.com/v1/prices/search \
-H "Authorization: Bearer $KNOX_SECRET_KEY" \
--data-urlencode "query=metadata['order_id']:'6735'"const Stripe = require('stripe');
const stripe = new Stripe(process.env.KNOX_SECRET_KEY, {host: 'api.knoxapi.com'});
const page = await stripe.prices.search({
query: "metadata['order_id']:'6735'",
});import os
import stripe
client = stripe.StripeClient(
os.environ["KNOX_SECRET_KEY"],
base_addresses={"api": "https://api.knoxapi.com"},
)
page = client.v1.prices.search(params={
"query": "metadata['order_id']:'6735'",
})require 'stripe'
Stripe.api_key = ENV['KNOX_SECRET_KEY']
Stripe.api_base = 'https://api.knoxapi.com'
page = Stripe::Price.search({
query: "metadata['order_id']:'6735'",
}){
"object": "search_result",
"url": "/v1/prices/search",
"has_more": false,
"data": [
{
"active": true,
"billing_scheme": "per_unit",
"created": 1234567890,
"currency": "usd",
"custom_unit_amount": {
"maximum": null,
"minimum": null,
"preset": null
},
"id": "price_1PgafmB7WZ01zgkW6dKueIc5",
"livemode": false,
"lookup_key": null,
"metadata": {},
"nickname": null,
"object": "price",
"product": "prod_QXg1hqf4jFNsqG",
"recurring": {
"interval": "month",
"interval_count": 1,
"meter": null,
"usage_type": "licensed",
"trial_period_days": null
},
"tax_behavior": "unspecified",
"tiers_mode": null,
"transform_quantity": {
"divide_by": 1592560163,
"round": "down"
},
"type": "recurring",
"unit_amount": 2000,
"unit_amount_decimal": "2000"
}
],
"next_page": null
}Update a price
POST/v1/prices/{price}
Updates the specified price by setting the values of the parameters passed. Any parameters not provided are left unchanged.
Path parameters
pricestringRequired
Body parameters
activebooleanWhether the price can be used for new purchases. Defaults to
true.currency_optionsobjectPrices defined in each available currency option. Each key must be a three-letter ISO currency code and a supported currency.
expandarray of stringsSpecifies which fields in the response should be expanded.
lookup_keystringA lookup key used to retrieve prices dynamically from a static string. This may be up to 200 characters.
metadataobjectSet of key-value pairs 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.nicknamestringA brief description of the price, hidden from customers.
tax_behaviorstringOnly required if a default tax behavior) was not provided in the Stripe Tax settings. Specifies whether the price is considered inclusive of taxes or exclusive of taxes. One of
inclusive,exclusive, orunspecified. Once specified as eitherinclusiveorexclusive, it cannot be changed.Possible valuesexclusiveinclusiveunspecified
transfer_lookup_keybooleanIf set to true, will atomically remove the lookup key from the existing price, and assign it to this price.
Returns
The price object.
curl https://api.knoxapi.com/v1/prices/price_1PgafmB7WZ01zgkW6dKueIc5 \
-H "Authorization: Bearer $KNOX_SECRET_KEY" \
-d "metadata[order_id]=6735"const Stripe = require('stripe');
const stripe = new Stripe(process.env.KNOX_SECRET_KEY, {host: 'api.knoxapi.com'});
const price = await stripe.prices.update('price_1PgafmB7WZ01zgkW6dKueIc5', {
metadata: {
order_id: '6735',
},
});import os
import stripe
client = stripe.StripeClient(
os.environ["KNOX_SECRET_KEY"],
base_addresses={"api": "https://api.knoxapi.com"},
)
price = client.v1.prices.update("price_1PgafmB7WZ01zgkW6dKueIc5", params={
"metadata": {
"order_id": "6735",
},
})require 'stripe'
Stripe.api_key = ENV['KNOX_SECRET_KEY']
Stripe.api_base = 'https://api.knoxapi.com'
price = Stripe::Price.update('price_1PgafmB7WZ01zgkW6dKueIc5', {
metadata: {
order_id: '6735',
},
}){
"active": true,
"billing_scheme": "per_unit",
"created": 1234567890,
"currency": "usd",
"custom_unit_amount": {
"maximum": null,
"minimum": null,
"preset": null
},
"id": "price_1PgafmB7WZ01zgkW6dKueIc5",
"livemode": false,
"lookup_key": null,
"metadata": {},
"nickname": null,
"object": "price",
"product": "prod_QXg1hqf4jFNsqG",
"recurring": {
"interval": "month",
"interval_count": 1,
"meter": null,
"usage_type": "licensed",
"trial_period_days": null
},
"tax_behavior": "unspecified",
"tiers_mode": null,
"transform_quantity": {
"divide_by": 1592560163,
"round": "down"
},
"type": "recurring",
"unit_amount": 2000,
"unit_amount_decimal": "2000"
}Retrieve a price
GET/v1/prices/{price}
Retrieves the price with the given ID.
Path parameters
pricestringRequired
Query parameters
expandarray of stringsSpecifies which fields in the response should be expanded.
Returns
The price object.
curl https://api.knoxapi.com/v1/prices/price_1PgafmB7WZ01zgkW6dKueIc5 \
-H "Authorization: Bearer $KNOX_SECRET_KEY"const Stripe = require('stripe');
const stripe = new Stripe(process.env.KNOX_SECRET_KEY, {host: 'api.knoxapi.com'});
const price = await stripe.prices.retrieve('price_1PgafmB7WZ01zgkW6dKueIc5');import os
import stripe
client = stripe.StripeClient(
os.environ["KNOX_SECRET_KEY"],
base_addresses={"api": "https://api.knoxapi.com"},
)
price = client.v1.prices.retrieve("price_1PgafmB7WZ01zgkW6dKueIc5")require 'stripe'
Stripe.api_key = ENV['KNOX_SECRET_KEY']
Stripe.api_base = 'https://api.knoxapi.com'
price = Stripe::Price.retrieve('price_1PgafmB7WZ01zgkW6dKueIc5'){
"active": true,
"billing_scheme": "per_unit",
"created": 1234567890,
"currency": "usd",
"custom_unit_amount": {
"maximum": null,
"minimum": null,
"preset": null
},
"id": "price_1PgafmB7WZ01zgkW6dKueIc5",
"livemode": false,
"lookup_key": null,
"metadata": {},
"nickname": null,
"object": "price",
"product": "prod_QXg1hqf4jFNsqG",
"recurring": {
"interval": "month",
"interval_count": 1,
"meter": null,
"usage_type": "licensed",
"trial_period_days": null
},
"tax_behavior": "unspecified",
"tiers_mode": null,
"transform_quantity": {
"divide_by": 1592560163,
"round": "down"
},
"type": "recurring",
"unit_amount": 2000,
"unit_amount_decimal": "2000"
}Operations and schemas come from the pinned Stripe OpenAPI specification (MIT); response examples from its fixtures. Nested object definitions and enums are in the complete specification.