Package com.stripe.model
Class Price
java.lang.Object
com.stripe.model.StripeObject
com.stripe.net.ApiResource
com.stripe.model.Price
- All Implemented Interfaces:
HasId
,MetadataStore<Price>
,StripeActiveObject
,StripeObjectInterface
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.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static class
Up to and including to this quantity will be contained in the tier.static class
static class
static class
Nested classes/interfaces inherited from class com.stripe.net.ApiResource
ApiResource.RequestMethod
-
Field Summary
Fields inherited from class com.stripe.net.ApiResource
CHARSET, GSON, INTERNAL_GSON
Fields inherited from class com.stripe.model.StripeObject
PRETTY_PRINT_GSON
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
static Price
create
(PriceCreateParams params) Creates a new price for an existing product.static Price
create
(PriceCreateParams params, RequestOptions options) Creates a new price for an existing product.static Price
Creates a new price for an existing product.static Price
create
(Map<String, Object> params, RequestOptions options) Creates a new price for an existing product.boolean
Whether the price can be used for new purchases.Describes how to compute the price per period.Time at which the object was created.Three-letter ISO currency code, in lowercase.Prices defined in each available currency option.When set, provides configuration for the amount to be adjusted by the customer during Checkout Sessions and Payment Links.Always true for a deleted object.getId()
Unique identifier for the object.Has the valuetrue
if the object exists in live mode or the valuefalse
if the object exists in test mode.A lookup key used to retrieve prices dynamically from a static string.Set of key-value pairs that you can attach to an object.A brief description of the price, hidden from customers.String representing the object's type.Get ID of expandableproduct
object.Get expandedproduct
.The recurring components of a price such asinterval
andusage_type
.Only required if a default tax behavior was not provided in the Stripe Tax settings.getTiers()
Each element represents a pricing tier.Defines if the tiering price should begraduated
orvolume
based.Apply a transformation to the reported usage or set quantity before computing the amount billed.getType()
One ofone_time
orrecurring
depending on whether the price is for a one-time purchase or a recurring (subscription) purchase.The unit amount in cents (or local equivalent) to be charged, represented as a whole integer if possible.The unit amount in cents (or local equivalent) to be charged, represented as a decimal string with at most 12 decimal places.int
hashCode()
static PriceCollection
list
(PriceListParams params) Returns a list of your active prices, excluding inline prices.static PriceCollection
list
(PriceListParams params, RequestOptions options) Returns a list of your active prices, excluding inline prices.static PriceCollection
Returns a list of your active prices, excluding inline prices.static PriceCollection
list
(Map<String, Object> params, RequestOptions options) Returns a list of your active prices, excluding inline prices.static Price
Retrieves the price with the given ID.static Price
retrieve
(String price, RequestOptions options) Retrieves the price with the given ID.static Price
retrieve
(String price, PriceRetrieveParams params, RequestOptions options) Retrieves the price with the given ID.static Price
Retrieves the price with the given ID.static PriceSearchResult
search
(PriceSearchParams params) Search for prices you’ve previously created using Stripe’s Search Query Language.static PriceSearchResult
search
(PriceSearchParams params, RequestOptions options) Search for prices you’ve previously created using Stripe’s Search Query Language.static PriceSearchResult
Search for prices you’ve previously created using Stripe’s Search Query Language.static PriceSearchResult
search
(Map<String, Object> params, RequestOptions options) Search for prices you’ve previously created using Stripe’s Search Query Language.void
Whether the price can be used for new purchases.void
setBillingScheme
(String billingScheme) Describes how to compute the price per period.void
setCreated
(Long created) Time at which the object was created.void
setCurrency
(String currency) Three-letter ISO currency code, in lowercase.void
setCurrencyOptions
(Map<String, Price.CurrencyOption> currencyOptions) Prices defined in each available currency option.void
setCustomUnitAmount
(Price.CustomUnitAmount customUnitAmount) When set, provides configuration for the amount to be adjusted by the customer during Checkout Sessions and Payment Links.void
setDeleted
(Boolean deleted) Always true for a deleted object.void
Unique identifier for the object.void
setLivemode
(Boolean livemode) Has the valuetrue
if the object exists in live mode or the valuefalse
if the object exists in test mode.void
setLookupKey
(String lookupKey) A lookup key used to retrieve prices dynamically from a static string.void
setMetadata
(Map<String, String> metadata) Set of key-value pairs that you can attach to an object.void
setNickname
(String nickname) A brief description of the price, hidden from customers.void
String representing the object's type.void
setProduct
(String id) void
setProductObject
(Product expandableObject) void
setRecurring
(Price.Recurring recurring) The recurring components of a price such asinterval
andusage_type
.void
setResponseGetter
(StripeResponseGetter responseGetter) Method is used by the containing object orStripeResponseGetter
implementations to set theStripeResponseGetter
instance used to make further requests.void
setTaxBehavior
(String taxBehavior) Only required if a default tax behavior was not provided in the Stripe Tax settings.void
setTiers
(List<Price.Tier> tiers) Each element represents a pricing tier.void
setTiersMode
(String tiersMode) Defines if the tiering price should begraduated
orvolume
based.void
setTransformQuantity
(Price.TransformQuantity transformQuantity) Apply a transformation to the reported usage or set quantity before computing the amount billed.void
One ofone_time
orrecurring
depending on whether the price is for a one-time purchase or a recurring (subscription) purchase.void
setUnitAmount
(Long unitAmount) The unit amount in cents (or local equivalent) to be charged, represented as a whole integer if possible.void
setUnitAmountDecimal
(BigDecimal unitAmountDecimal) The unit amount in cents (or local equivalent) to be charged, represented as a decimal string with at most 12 decimal places.update
(PriceUpdateParams params) Updates the specified price by setting the values of the parameters passed.update
(PriceUpdateParams params, RequestOptions options) Updates the specified price by setting the values of the parameters passed.Updates the specified price by setting the values of the parameters passed.update
(Map<String, Object> params, RequestOptions options) Updates the specified price by setting the values of the parameters passed.Methods inherited from class com.stripe.net.ApiResource
checkNullTypedParams, getGlobalResponseGetter, getResponseGetter, setExpandableFieldId, setStripeResponseGetter, urlEncode, urlEncodeId
Methods inherited from class com.stripe.model.StripeObject
deserializeStripeObject, deserializeStripeObject, deserializeStripeObject, equals, getLastResponse, getRawJsonObject, setLastResponse, toJson, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.stripe.model.StripeActiveObject
trySetResponseGetter
-
Constructor Details
-
Price
public Price()
-
-
Method Details
-
getProduct
Get ID of expandableproduct
object. -
setProduct
-
getProductObject
Get expandedproduct
. -
setProductObject
-
create
Creates a new price for an existing product. The price can be recurring or one-time.- Throws:
StripeException
-
create
public static Price create(Map<String, Object> params, RequestOptions options) throws StripeExceptionCreates a new price for an existing product. The price can be recurring or one-time.- Throws:
StripeException
-
create
Creates a new price for an existing product. The price can be recurring or one-time.- Throws:
StripeException
-
create
Creates a new price for an existing product. The price can be recurring or one-time.- Throws:
StripeException
-
list
Returns a list of your active prices, excluding inline prices. For the list of inactive prices, setactive
to false.- Throws:
StripeException
-
list
public static PriceCollection list(Map<String, Object> params, RequestOptions options) throws StripeExceptionReturns a list of your active prices, excluding inline prices. For the list of inactive prices, setactive
to false.- Throws:
StripeException
-
list
Returns a list of your active prices, excluding inline prices. For the list of inactive prices, setactive
to false.- Throws:
StripeException
-
list
public static PriceCollection list(PriceListParams params, RequestOptions options) throws StripeException Returns a list of your active prices, excluding inline prices. For the list of inactive prices, setactive
to false.- Throws:
StripeException
-
retrieve
Retrieves the price with the given ID.- Throws:
StripeException
-
retrieve
Retrieves the price with the given ID.- Throws:
StripeException
-
retrieve
public static Price retrieve(String price, Map<String, Object> params, RequestOptions options) throws StripeExceptionRetrieves the price with the given ID.- Throws:
StripeException
-
retrieve
public static Price retrieve(String price, PriceRetrieveParams params, RequestOptions options) throws StripeException Retrieves the price with the given ID.- Throws:
StripeException
-
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.- Throws:
StripeException
-
search
public static PriceSearchResult search(Map<String, Object> params, RequestOptions options) throws StripeExceptionSearch 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.- Throws:
StripeException
-
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.- Throws:
StripeException
-
search
public static PriceSearchResult search(PriceSearchParams params, RequestOptions options) throws StripeException 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.- Throws:
StripeException
-
update
Updates the specified price by setting the values of the parameters passed. Any parameters not provided are left unchanged.- Specified by:
update
in interfaceMetadataStore<Price>
- Throws:
StripeException
-
update
Updates the specified price by setting the values of the parameters passed. Any parameters not provided are left unchanged.- Specified by:
update
in interfaceMetadataStore<Price>
- Throws:
StripeException
-
update
Updates the specified price by setting the values of the parameters passed. Any parameters not provided are left unchanged.- Throws:
StripeException
-
update
Updates the specified price by setting the values of the parameters passed. Any parameters not provided are left unchanged.- Throws:
StripeException
-
setResponseGetter
Description copied from interface:StripeActiveObject
Method is used by the containing object orStripeResponseGetter
implementations to set theStripeResponseGetter
instance used to make further requests.- Specified by:
setResponseGetter
in interfaceStripeActiveObject
- Overrides:
setResponseGetter
in classApiResource
- Parameters:
responseGetter
- theStripeResponseGetter
instance to use for making further requests.
-
getActive
Whether the price can be used for new purchases. -
getBillingScheme
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.One of
per_unit
, ortiered
. -
getCreated
Time at which the object was created. Measured in seconds since the Unix epoch. -
getCurrency
Three-letter ISO currency code, in lowercase. Must be a supported currency. -
getCurrencyOptions
Prices defined in each available currency option. Each key must be a three-letter ISO currency code and a supported currency. -
getCustomUnitAmount
When set, provides configuration for the amount to be adjusted by the customer during Checkout Sessions and Payment Links. -
getDeleted
Always true for a deleted object. -
getLivemode
Has the valuetrue
if the object exists in live mode or the valuefalse
if the object exists in test mode. -
getLookupKey
A lookup key used to retrieve prices dynamically from a static string. This may be up to 200 characters. -
getNickname
A brief description of the price, hidden from customers. -
getObject
String representing the object's type. Objects of the same type share the same value.Equal to
price
. -
getRecurring
The recurring components of a price such asinterval
andusage_type
. -
getTaxBehavior
Only 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 ofinclusive
,exclusive
, orunspecified
. Once specified as eitherinclusive
orexclusive
, it cannot be changed. -
getTiers
Each element represents a pricing tier. This parameter requiresbilling_scheme
to be set totiered
. See also the documentation forbilling_scheme
. -
getTiersMode
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.One of
graduated
, orvolume
. -
getTransformQuantity
Apply a transformation to the reported usage or set quantity before computing the amount billed. Cannot be combined withtiers
. -
getType
One ofone_time
orrecurring
depending on whether the price is for a one-time purchase or a recurring (subscription) purchase. -
getUnitAmount
The unit amount in cents (or local equivalent) to be charged, represented as a whole integer if possible. Only set ifbilling_scheme=per_unit
. -
getUnitAmountDecimal
The unit amount in cents (or local equivalent) to be charged, represented as a decimal string with at most 12 decimal places. Only set ifbilling_scheme=per_unit
. -
setActive
Whether the price can be used for new purchases. -
setBillingScheme
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.One of
per_unit
, ortiered
. -
setCreated
Time at which the object was created. Measured in seconds since the Unix epoch. -
setCurrency
Three-letter ISO currency code, in lowercase. Must be a supported currency. -
setCurrencyOptions
Prices defined in each available currency option. Each key must be a three-letter ISO currency code and a supported currency. -
setCustomUnitAmount
When set, provides configuration for the amount to be adjusted by the customer during Checkout Sessions and Payment Links. -
setDeleted
Always true for a deleted object. -
setId
Unique identifier for the object. -
setLivemode
Has the valuetrue
if the object exists in live mode or the valuefalse
if the object exists in test mode. -
setLookupKey
A lookup key used to retrieve prices dynamically from a static string. This may be up to 200 characters. -
setMetadata
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. -
setNickname
A brief description of the price, hidden from customers. -
setObject
String representing the object's type. Objects of the same type share the same value.Equal to
price
. -
setRecurring
The recurring components of a price such asinterval
andusage_type
. -
setTaxBehavior
Only 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 ofinclusive
,exclusive
, orunspecified
. Once specified as eitherinclusive
orexclusive
, it cannot be changed. -
setTiers
Each element represents a pricing tier. This parameter requiresbilling_scheme
to be set totiered
. See also the documentation forbilling_scheme
. -
setTiersMode
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.One of
graduated
, orvolume
. -
setTransformQuantity
Apply a transformation to the reported usage or set quantity before computing the amount billed. Cannot be combined withtiers
. -
setType
One ofone_time
orrecurring
depending on whether the price is for a one-time purchase or a recurring (subscription) purchase. -
setUnitAmount
The unit amount in cents (or local equivalent) to be charged, represented as a whole integer if possible. Only set ifbilling_scheme=per_unit
. -
setUnitAmountDecimal
The unit amount in cents (or local equivalent) to be charged, represented as a decimal string with at most 12 decimal places. Only set ifbilling_scheme=per_unit
. -
equals
-
canEqual
-
hashCode
public int hashCode() -
getId
Unique identifier for the object. -
getMetadata
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.- Specified by:
getMetadata
in interfaceMetadataStore<Price>
-