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
Nested ClassesModifier and TypeClassDescriptionstatic classFor more details about CurrencyOption, please refer to the API Reference.static classFor more details about CustomUnitAmount, please refer to the API Reference.static classFor more details about MigrateTo, please refer to the API Reference.static classFor more details about Recurring, please refer to the API Reference.static classFor more details about Tier, please refer to the API Reference.static classFor more details about TransformQuantity, please refer to the API Reference.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_GSONFields inherited from class com.stripe.model.StripeObject
PRETTY_PRINT_GSON -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanstatic Pricecreate(PriceCreateParams params) static Pricecreate(PriceCreateParams params, RequestOptions options) static Pricestatic Pricecreate(Map<String, Object> params, RequestOptions options) booleanWhether 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 valuetrueif the object exists in live mode or the valuefalseif 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.Subscriptions using this price will be migrated to use the new referenced price.A brief description of the price, hidden from customers.String representing the object's type.Get ID of expandableproductobject.Get expandedproduct.The recurring components of a price such asintervalandusage_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 begraduatedorvolumebased.Apply a transformation to the reported usage or set quantity before computing the amount billed.getType()One ofone_timeorrecurringdepending 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.inthashCode()static PriceCollectionlist(PriceListParams params) Returns a list of your active prices, excluding inline prices.static PriceCollectionlist(PriceListParams params, RequestOptions options) Returns a list of your active prices, excluding inline prices.static PriceCollectionReturns a list of your active prices, excluding inline prices.static PriceCollectionlist(Map<String, Object> params, RequestOptions options) Returns a list of your active prices, excluding inline prices.static PriceRetrieves the price with the given ID.static Priceretrieve(String price, RequestOptions options) Retrieves the price with the given ID.static Priceretrieve(String price, PriceRetrieveParams params, RequestOptions options) Retrieves the price with the given ID.static PriceRetrieves the price with the given ID.static PriceSearchResultsearch(PriceSearchParams params) Search for prices you’ve previously created using Stripe’s Search Query Language.static PriceSearchResultsearch(PriceSearchParams params, RequestOptions options) Search for prices you’ve previously created using Stripe’s Search Query Language.static PriceSearchResultSearch for prices you’ve previously created using Stripe’s Search Query Language.static PriceSearchResultsearch(Map<String, Object> params, RequestOptions options) Search for prices you’ve previously created using Stripe’s Search Query Language.voidWhether the price can be used for new purchases.voidsetBillingScheme(String billingScheme) Describes how to compute the price per period.voidsetCreated(Long created) Time at which the object was created.voidsetCurrency(String currency) Three-letter ISO currency code, in lowercase.voidsetCurrencyOptions(Map<String, Price.CurrencyOption> currencyOptions) Prices defined in each available currency option.voidsetCustomUnitAmount(Price.CustomUnitAmount customUnitAmount) When set, provides configuration for the amount to be adjusted by the customer during Checkout Sessions and Payment Links.voidsetDeleted(Boolean deleted) Always true for a deleted object.voidUnique identifier for the object.voidsetLivemode(Boolean livemode) Has the valuetrueif the object exists in live mode or the valuefalseif the object exists in test mode.voidsetLookupKey(String lookupKey) A lookup key used to retrieve prices dynamically from a static string.voidsetMetadata(Map<String, String> metadata) Set of key-value pairs that you can attach to an object.voidsetMigrateTo(Price.MigrateTo migrateTo) Subscriptions using this price will be migrated to use the new referenced price.voidsetNickname(String nickname) A brief description of the price, hidden from customers.voidString representing the object's type.voidsetProduct(String id) voidsetProductObject(Product expandableObject) voidsetRecurring(Price.Recurring recurring) The recurring components of a price such asintervalandusage_type.voidsetResponseGetter(StripeResponseGetter responseGetter) Method is used by the containing object orStripeResponseGetterimplementations to set theStripeResponseGetterinstance used to make further requests.voidsetTaxBehavior(String taxBehavior) Only required if a default tax behavior was not provided in the Stripe Tax settings.voidsetTiers(List<Price.Tier> tiers) Each element represents a pricing tier.voidsetTiersMode(String tiersMode) Defines if the tiering price should begraduatedorvolumebased.voidsetTransformQuantity(Price.TransformQuantity transformQuantity) Apply a transformation to the reported usage or set quantity before computing the amount billed.voidOne ofone_timeorrecurringdepending on whether the price is for a one-time purchase or a recurring (subscription) purchase.voidsetUnitAmount(Long unitAmount) The unit amount in cents (or local equivalent) to be charged, represented as a whole integer if possible.voidsetUnitAmountDecimal(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, setGlobalResponseGetter, urlEncode, urlEncodeIdMethods inherited from class com.stripe.model.StripeObject
deserializeStripeObject, deserializeStripeObject, deserializeStripeObject, deserializeStripeObject, equals, getLastResponse, getRawJsonObject, setLastResponse, toJson, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.stripe.model.StripeActiveObject
trySetResponseGetter
-
Constructor Details
-
Price
public Price()
-
-
Method Details
-
getProduct
Get ID of expandableproductobject. -
setProduct
-
getProductObject
Get expandedproduct. -
setProductObject
-
create
- Throws:
StripeException
-
create
public static Price create(Map<String, Object> params, RequestOptions options) throws StripeException- Throws:
StripeException
-
create
- Throws:
StripeException
-
create
- Throws:
StripeException
-
list
Returns a list of your active prices, excluding inline prices. For the list of inactive prices, setactiveto 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, setactiveto false.- Throws:
StripeException
-
list
Returns a list of your active prices, excluding inline prices. For the list of inactive prices, setactiveto 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, setactiveto 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:
updatein 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:
updatein 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:StripeActiveObjectMethod is used by the containing object orStripeResponseGetterimplementations to set theStripeResponseGetterinstance used to make further requests.- Specified by:
setResponseGetterin interfaceStripeActiveObject- Overrides:
setResponseGetterin classApiResource- Parameters:
responseGetter- theStripeResponseGetterinstance 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_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.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 valuetrueif the object exists in live mode or the valuefalseif 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. -
getMigrateTo
Subscriptions using this price will be migrated to use the new referenced price. -
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 asintervalandusage_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 eitherinclusiveorexclusive, it cannot be changed. -
getTiers
Each element represents a pricing tier. This parameter requiresbilling_schemeto be set totiered. See also the documentation forbilling_scheme. -
getTiersMode
Defines if the tiering price should begraduatedorvolumebased. Involume-based tiering, the maximum quantity within a period determines the per unit price. Ingraduatedtiering, 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_timeorrecurringdepending 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_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.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 valuetrueif the object exists in live mode or the valuefalseif 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. -
setMigrateTo
Subscriptions using this price will be migrated to use the new referenced price. -
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 asintervalandusage_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 eitherinclusiveorexclusive, it cannot be changed. -
setTiers
Each element represents a pricing tier. This parameter requiresbilling_schemeto be set totiered. See also the documentation forbilling_scheme. -
setTiersMode
Defines if the tiering price should begraduatedorvolumebased. Involume-based tiering, the maximum quantity within a period determines the per unit price. Ingraduatedtiering, 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_timeorrecurringdepending 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:
getMetadatain interfaceMetadataStore<Price>
-