Class Price

All Implemented Interfaces:
HasId, MetadataStore<Price>, StripeObjectInterface

public class Price extends ApiResource implements HasId, MetadataStore<Price>
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.

  • Constructor Details

    • Price

      public Price()
  • Method Details

    • getProduct

      public String getProduct()
      Get ID of expandable product object.
    • setProduct

      public void setProduct(String id)
    • getProductObject

      public Product getProductObject()
      Get expanded product.
    • setProductObject

      public void setProductObject(Product expandableObject)
    • create

      public static Price create(Map<String,Object> params) throws StripeException
      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 StripeException
      Creates a new price for an existing product. The price can be recurring or one-time.
      Throws:
      StripeException
    • create

      public static Price create(PriceCreateParams params) throws StripeException
      Creates a new price for an existing product. The price can be recurring or one-time.
      Throws:
      StripeException
    • create

      public static Price create(PriceCreateParams params, RequestOptions options) throws StripeException
      Creates a new price for an existing product. The price can be recurring or one-time.
      Throws:
      StripeException
    • list

      public static PriceCollection list(Map<String,Object> params) throws StripeException
      Returns a list of your prices.
      Throws:
      StripeException
    • list

      public static PriceCollection list(Map<String,Object> params, RequestOptions options) throws StripeException
      Returns a list of your prices.
      Throws:
      StripeException
    • list

      public static PriceCollection list(PriceListParams params) throws StripeException
      Returns a list of your prices.
      Throws:
      StripeException
    • list

      public static PriceCollection list(PriceListParams params, RequestOptions options) throws StripeException
      Returns a list of your prices.
      Throws:
      StripeException
    • retrieve

      public static Price retrieve(String price) throws StripeException
      Retrieves the price with the given ID.
      Throws:
      StripeException
    • retrieve

      public static Price retrieve(String price, RequestOptions options) throws StripeException
      Retrieves the price with the given ID.
      Throws:
      StripeException
    • retrieve

      public static Price retrieve(String price, Map<String,Object> params, RequestOptions options) throws StripeException
      Retrieves 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

      public static PriceSearchResult search(Map<String,Object> params) 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
    • search

      public static PriceSearchResult search(Map<String,Object> 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
    • search

      public static PriceSearchResult search(PriceSearchParams params) 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
    • 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

      public Price update(Map<String,Object> params) throws StripeException
      Updates the specified price by setting the values of the parameters passed. Any parameters not provided are left unchanged.
      Specified by:
      update in interface MetadataStore<Price>
      Throws:
      StripeException
    • update

      public Price update(Map<String,Object> params, RequestOptions options) throws StripeException
      Updates the specified price by setting the values of the parameters passed. Any parameters not provided are left unchanged.
      Specified by:
      update in interface MetadataStore<Price>
      Throws:
      StripeException
    • update

      public Price update(PriceUpdateParams params) throws StripeException
      Updates the specified price by setting the values of the parameters passed. Any parameters not provided are left unchanged.
      Throws:
      StripeException
    • update

      public Price update(PriceUpdateParams params, RequestOptions options) throws StripeException
      Updates the specified price by setting the values of the parameters passed. Any parameters not provided are left unchanged.
      Throws:
      StripeException
    • getActive

      public Boolean getActive()
      Whether the price can be used for new purchases.
    • getBillingScheme

      public String getBillingScheme()
      Describes how to compute the price per period. Either per_unit or tiered. per_unit indicates that the fixed amount (specified in unit_amount or unit_amount_decimal) will be charged per unit in quantity (for prices with usage_type=licensed), or per unit of total usage (for prices with usage_type=metered). tiered indicates that the unit pricing will be computed using a tiering strategy as defined using the tiers and tiers_mode attributes.

      One of per_unit, or tiered.

    • getCreated

      public Long getCreated()
      Time at which the object was created. Measured in seconds since the Unix epoch.
    • getCurrency

      public String getCurrency()
      Three-letter ISO currency code, in lowercase. Must be a supported currency.
    • getCurrencyOptions

      public Map<String,Price.CurrencyOption> getCurrencyOptions()
      Prices defined in each available currency option. Each key must be a three-letter ISO currency code and a supported currency.
    • getCustomUnitAmount

      public Price.CustomUnitAmount getCustomUnitAmount()
      When set, provides configuration for the amount to be adjusted by the customer during Checkout Sessions and Payment Links.
    • getDeleted

      public Boolean getDeleted()
      Always true for a deleted object.
    • getLivemode

      public Boolean getLivemode()
      Has the value true if the object exists in live mode or the value false if the object exists in test mode.
    • getLookupKey

      public String getLookupKey()
      A lookup key used to retrieve prices dynamically from a static string. This may be up to 200 characters.
    • getMigrateTo

      public Price.MigrateTo getMigrateTo()
      Subscriptions using this price will be migrated to use the new referenced price.
    • getNickname

      public String getNickname()
      A brief description of the price, hidden from customers.
    • getObject

      public String getObject()
      String representing the object's type. Objects of the same type share the same value.

      Equal to price.

    • getRecurring

      public Price.Recurring getRecurring()
      The recurring components of a price such as interval and usage_type.
    • getTaxBehavior

      public String getTaxBehavior()
      Specifies whether the price is considered inclusive of taxes or exclusive of taxes. One of inclusive, exclusive, or unspecified. Once specified as either inclusive or exclusive, it cannot be changed.
    • getTiers

      public List<Price.Tier> getTiers()
      Each element represents a pricing tier. This parameter requires billing_scheme to be set to tiered. See also the documentation for billing_scheme.
    • getTiersMode

      public String getTiersMode()
      Defines if the tiering price should be graduated or volume based. In volume-based tiering, the maximum quantity within a period determines the per unit price. In graduated tiering, pricing can change as the quantity grows.

      One of graduated, or volume.

    • getTransformQuantity

      public Price.TransformQuantity getTransformQuantity()
      Apply a transformation to the reported usage or set quantity before computing the amount billed. Cannot be combined with tiers.
    • getType

      public String getType()
      One of one_time or recurring depending on whether the price is for a one-time purchase or a recurring (subscription) purchase.
    • getUnitAmount

      public Long getUnitAmount()
      The unit amount in %s to be charged, represented as a whole integer if possible. Only set if billing_scheme=per_unit.
    • getUnitAmountDecimal

      public BigDecimal getUnitAmountDecimal()
      The unit amount in %s to be charged, represented as a decimal string with at most 12 decimal places. Only set if billing_scheme=per_unit.
    • setActive

      public void setActive(Boolean active)
      Whether the price can be used for new purchases.
    • setBillingScheme

      public void setBillingScheme(String billingScheme)
      Describes how to compute the price per period. Either per_unit or tiered. per_unit indicates that the fixed amount (specified in unit_amount or unit_amount_decimal) will be charged per unit in quantity (for prices with usage_type=licensed), or per unit of total usage (for prices with usage_type=metered). tiered indicates that the unit pricing will be computed using a tiering strategy as defined using the tiers and tiers_mode attributes.

      One of per_unit, or tiered.

    • setCreated

      public void setCreated(Long created)
      Time at which the object was created. Measured in seconds since the Unix epoch.
    • setCurrency

      public void setCurrency(String currency)
      Three-letter ISO currency code, in lowercase. Must be a supported currency.
    • setCurrencyOptions

      public void setCurrencyOptions(Map<String,Price.CurrencyOption> currencyOptions)
      Prices defined in each available currency option. Each key must be a three-letter ISO currency code and a supported currency.
    • setCustomUnitAmount

      public void setCustomUnitAmount(Price.CustomUnitAmount customUnitAmount)
      When set, provides configuration for the amount to be adjusted by the customer during Checkout Sessions and Payment Links.
    • setDeleted

      public void setDeleted(Boolean deleted)
      Always true for a deleted object.
    • setId

      public void setId(String id)
      Unique identifier for the object.
    • setLivemode

      public void setLivemode(Boolean livemode)
      Has the value true if the object exists in live mode or the value false if the object exists in test mode.
    • setLookupKey

      public void setLookupKey(String lookupKey)
      A lookup key used to retrieve prices dynamically from a static string. This may be up to 200 characters.
    • setMetadata

      public void setMetadata(Map<String,String> 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.
    • setMigrateTo

      public void setMigrateTo(Price.MigrateTo migrateTo)
      Subscriptions using this price will be migrated to use the new referenced price.
    • setNickname

      public void setNickname(String nickname)
      A brief description of the price, hidden from customers.
    • setObject

      public void setObject(String object)
      String representing the object's type. Objects of the same type share the same value.

      Equal to price.

    • setRecurring

      public void setRecurring(Price.Recurring recurring)
      The recurring components of a price such as interval and usage_type.
    • setTaxBehavior

      public void setTaxBehavior(String taxBehavior)
      Specifies whether the price is considered inclusive of taxes or exclusive of taxes. One of inclusive, exclusive, or unspecified. Once specified as either inclusive or exclusive, it cannot be changed.
    • setTiers

      public void setTiers(List<Price.Tier> tiers)
      Each element represents a pricing tier. This parameter requires billing_scheme to be set to tiered. See also the documentation for billing_scheme.
    • setTiersMode

      public void setTiersMode(String tiersMode)
      Defines if the tiering price should be graduated or volume based. In volume-based tiering, the maximum quantity within a period determines the per unit price. In graduated tiering, pricing can change as the quantity grows.

      One of graduated, or volume.

    • setTransformQuantity

      public void setTransformQuantity(Price.TransformQuantity transformQuantity)
      Apply a transformation to the reported usage or set quantity before computing the amount billed. Cannot be combined with tiers.
    • setType

      public void setType(String type)
      One of one_time or recurring depending on whether the price is for a one-time purchase or a recurring (subscription) purchase.
    • setUnitAmount

      public void setUnitAmount(Long unitAmount)
      The unit amount in %s to be charged, represented as a whole integer if possible. Only set if billing_scheme=per_unit.
    • setUnitAmountDecimal

      public void setUnitAmountDecimal(BigDecimal unitAmountDecimal)
      The unit amount in %s to be charged, represented as a decimal string with at most 12 decimal places. Only set if billing_scheme=per_unit.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getId

      public String getId()
      Unique identifier for the object.
      Specified by:
      getId in interface HasId
    • getMetadata

      public Map<String,String> 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 interface MetadataStore<Price>