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.
The Price object
Attributes
- idstring
Unique identifier for the object.
- activeboolean
Whether the price can be used for new purchases.
- currencyenum
Three-letter ISO currency code, in lowercase. Must be a supported currency.
- metadatadictionary
Set 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.
- nicknamenullable string
A brief description of the price, hidden from customers.
- productstringExpandable
The ID of the product this price is associated with.
- recurringnullable dictionary
The recurring components of a price such as
interval
andusage_type
. - typeenum
One of
one_time
orrecurring
depending on whether the price is for a one-time purchase or a recurring (subscription) purchase. - unit_
amountnullable integer The unit amount in cents to be charged, represented as a whole integer if possible. Only set if
billing_scheme=per_unit
.
More attributes
- objectstring
- billing_
schemeenum - createdtimestamp
- currency_
optionsnullable dictionaryExpandable - custom_
unit_ amountnullable dictionary - livemodeboolean
- lookup_
keynullable string - tax_
behaviornullable enum - tiersnullable array of dictionariesExpandable
- tiers_
modenullable enum - transform_
quantitynullable dictionary - unit_
amount_ decimalnullable decimal string
Create a price
Creates a new price for an existing product. The price can be recurring or one-time.
Parameters
- currencyenumRequired
Three-letter ISO currency code, in lowercase. Must be a supported currency.
- activeboolean
Whether the price can be used for new purchases. Defaults to
true
. - metadatadictionary
Set 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
. - nicknamestring
A brief description of the price, hidden from customers.
- productstringRequired unless product_data is provided
The ID of the product that this price will belong to.
- recurringdictionary
The recurring components of a price such as
interval
andusage_type
. - unit_
amountintegerRequired conditionally A positive integer in cents (or 0 for a free price) representing how much to charge. One of
unit_amount
orcustom_unit_amount
is required, unlessbilling_scheme=tiered
.
More parameters
- billing_
schemeenum - currency_
optionsdictionary - custom_
unit_ amountdictionaryRequired unless unit_amount is provided - lookup_
keystring - product_
datadictionaryRequired unless product is provided - tax_
behaviorenum - tiersarray of dictionariesRequired if billing_scheme=tiered
- tiers_
modeenumRequired if billing_scheme=tiered - transfer_
lookup_ keyboolean - transform_
quantitydictionary - unit_
amount_ decimalstring
Returns
The newly created Price
object is returned upon success. Otherwise, this call raises an error.
Update a price
Updates the specified price by setting the values of the parameters passed. Any parameters not provided are left unchanged.
Parameters
- activeboolean
Whether the price can be used for new purchases. Defaults to
true
. - metadatadictionary
Set 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
. - nicknamestring
A brief description of the price, hidden from customers.
More parameters
- currency_
optionsdictionary - lookup_
keystring - tax_
behaviorenum - transfer_
lookup_ keyboolean
Returns
The updated price object is returned upon success. Otherwise, this call raises an error.
Retrieve a price
Retrieves the price with the given ID.
Parameters
No parameters.
Returns
Returns a price if a valid price or plan ID was provided. Raises an error otherwise.