View Source Stripe.Price (Striped v0.1.0)
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.
Link to this section Summary
Functions
Creates a new price for an existing product. The price can be recurring or one-time.
Returns a list of your prices.
Retrieves the price with the given ID.
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.
Updates the specified price by setting the values of the parameters passed. Any parameters not provided are left unchanged.
Link to this section Types
@type t() :: %Stripe.Price{ active: boolean(), billing_scheme: binary(), created: integer(), currency: binary(), currency_options: term(), custom_unit_amount: term() | nil, id: binary(), livemode: boolean(), lookup_key: binary() | nil, metadata: term(), nickname: binary() | nil, object: binary(), product: binary() | Stripe.Product.t() | Stripe.DeletedProduct.t(), recurring: term() | nil, tax_behavior: binary() | nil, tiers: term(), tiers_mode: binary() | nil, transform_quantity: term() | nil, type: binary(), unit_amount: integer() | nil, unit_amount_decimal: binary() | nil }
The price
type.
active
Whether the price can be used for new purchases.billing_scheme
Describes how to compute the price per period. Eitherper_unit
ortiered
.per_unit
indicates that the fixed amount (specified inunit_amount
orunit_amount_decimal
) will be charged per unit inquantity
(for prices withusage_type=licensed
), or per unit of total usage (for prices withusage_type=metered
).tiered
indicates that the unit pricing will be computed using a tiering strategy as defined using thetiers
andtiers_mode
attributes.created
Time at which the object was created. Measured in seconds since the Unix epoch.currency
Three-letter ISO currency code, in lowercase. Must be a supported currency.currency_options
Prices defined in each available currency option. Each key must be a three-letter ISO currency code and a supported currency.custom_unit_amount
When set, provides configuration for the amount to be adjusted by the customer during Checkout Sessions and Payment Links.id
Unique identifier for the object.livemode
Has the valuetrue
if the object exists in live mode or the valuefalse
if the object exists in test mode.lookup_key
A lookup key used to retrieve prices dynamically from a static string. This may be up to 200 characters.metadata
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.nickname
A brief description of the price, hidden from customers.object
String representing the object's type. Objects of the same type share the same value.product
The ID of the product this price is associated with.recurring
The recurring components of a price such asinterval
andusage_type
.tax_behavior
Specifies whether the price is considered inclusive of taxes or exclusive of taxes. One ofinclusive
,exclusive
, orunspecified
. Once specified as eitherinclusive
orexclusive
, it cannot be changed.tiers
Each element represents a pricing tier. This parameter requiresbilling_scheme
to be set totiered
. See also the documentation forbilling_scheme
.tiers_mode
Defines if the tiering price should begraduated
orvolume
based. Involume
-based tiering, the maximum quantity within a period determines the per unit price. Ingraduated
tiering, pricing can change as the quantity grows.transform_quantity
Apply a transformation to the reported usage or set quantity before computing the amount billed. Cannot be combined withtiers
.type
One ofone_time
orrecurring
depending on whether the price is for a one-time purchase or a recurring (subscription) purchase.unit_amount
The unit amount in %s to be charged, represented as a whole integer if possible. Only set ifbilling_scheme=per_unit
.unit_amount_decimal
The unit amount in %s to be charged, represented as a decimal string with at most 12 decimal places. Only set ifbilling_scheme=per_unit
.
Link to this section Functions
@spec create(client :: term(), params :: map()) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
Creates a new price for an existing product. The price can be recurring or one-time.
Details
- Method:
post
- Path:
/v1/prices
@spec list(client :: term(), params :: map()) :: {:ok, Stripe.List.t(t())} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
Returns a list of your prices.
Details
- Method:
get
- Path:
/v1/prices
Query parameters
:active
boolean:created
any of:- object with (optional) properties:
gt
: integergte
: integerlt
: integerlte
: integer
- integer
- object with (optional) properties:
:currency
string:ending_before
string:expand
array of: string:limit
integer:lookup_keys
array of: string:product
string:recurring
object with (optional) properties:interval
: stringusage_type
: string
:starting_after
string:type
string
@spec retrieve(client :: term(), price :: binary(), params :: map()) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
Retrieves the price with the given ID.
Details
- Method:
get
- Path:
/v1/prices/{price}
Query parameters
:expand
array of: string
@spec search(client :: term(), params :: map()) :: {:ok, Stripe.SearchResult.t(t())} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
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.
#### Details * Method: `get` * Path: `/v1/prices/search` #### Query parameters * `:expand` array of: string * `:limit` integer * `:page` string * `:query` (Required) string@spec update(client :: term(), price :: binary(), params :: map()) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
Updates the specified price by setting the values of the parameters passed. Any parameters not provided are left unchanged.
Details
- Method:
post
- Path:
/v1/prices/{price}