Class Product

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

public class Product extends ApiResource implements HasId, MetadataStore<Product>
Products describe the specific goods or services you offer to your customers. For example, you might offer a Standard and Premium version of your goods or service; each version would be a separate Product. They can be used in conjunction with Prices to configure pricing in Payment Links, Checkout, and Subscriptions.

Related guides: Set up a subscription, share a Payment Link, accept payments with Checkout, and more about Products and Prices

  • Constructor Details

    • Product

      public Product()
  • Method Details

    • getDefaultPrice

      public String getDefaultPrice()
      Get ID of expandable defaultPrice object.
    • setDefaultPrice

      public void setDefaultPrice(String id)
    • getDefaultPriceObject

      public Price getDefaultPriceObject()
      Get expanded defaultPrice.
    • setDefaultPriceObject

      public void setDefaultPriceObject(Price expandableObject)
    • getTaxCode

      public String getTaxCode()
      Get ID of expandable taxCode object.
    • setTaxCode

      public void setTaxCode(String id)
    • getTaxCodeObject

      public TaxCode getTaxCodeObject()
      Get expanded taxCode.
    • setTaxCodeObject

      public void setTaxCodeObject(TaxCode expandableObject)
    • create

      public static Product create(Map<String,Object> params) throws StripeException
      Creates a new product object.
      Throws:
      StripeException
    • create

      public static Product create(Map<String,Object> params, RequestOptions options) throws StripeException
      Creates a new product object.
      Throws:
      StripeException
    • create

      public static Product create(ProductCreateParams params) throws StripeException
      Creates a new product object.
      Throws:
      StripeException
    • create

      public static Product create(ProductCreateParams params, RequestOptions options) throws StripeException
      Creates a new product object.
      Throws:
      StripeException
    • delete

      public Product delete() throws StripeException
      Delete a product. Deleting a product is only possible if it has no prices associated with it. Additionally, deleting a product with type=good is only possible if it has no SKUs associated with it.
      Throws:
      StripeException
    • delete

      public Product delete(RequestOptions options) throws StripeException
      Delete a product. Deleting a product is only possible if it has no prices associated with it. Additionally, deleting a product with type=good is only possible if it has no SKUs associated with it.
      Throws:
      StripeException
    • delete

      public Product delete(Map<String,Object> params) throws StripeException
      Delete a product. Deleting a product is only possible if it has no prices associated with it. Additionally, deleting a product with type=good is only possible if it has no SKUs associated with it.
      Throws:
      StripeException
    • delete

      public Product delete(Map<String,Object> params, RequestOptions options) throws StripeException
      Delete a product. Deleting a product is only possible if it has no prices associated with it. Additionally, deleting a product with type=good is only possible if it has no SKUs associated with it.
      Throws:
      StripeException
    • list

      public static ProductCollection list(Map<String,Object> params) throws StripeException
      Returns a list of your products. The products are returned sorted by creation date, with the most recently created products appearing first.
      Throws:
      StripeException
    • list

      public static ProductCollection list(Map<String,Object> params, RequestOptions options) throws StripeException
      Returns a list of your products. The products are returned sorted by creation date, with the most recently created products appearing first.
      Throws:
      StripeException
    • list

      public static ProductCollection list(ProductListParams params) throws StripeException
      Returns a list of your products. The products are returned sorted by creation date, with the most recently created products appearing first.
      Throws:
      StripeException
    • list

      public static ProductCollection list(ProductListParams params, RequestOptions options) throws StripeException
      Returns a list of your products. The products are returned sorted by creation date, with the most recently created products appearing first.
      Throws:
      StripeException
    • retrieve

      public static Product retrieve(String id) throws StripeException
      Retrieves the details of an existing product. Supply the unique product ID from either a product creation request or the product list, and Stripe will return the corresponding product information.
      Throws:
      StripeException
    • retrieve

      public static Product retrieve(String id, RequestOptions options) throws StripeException
      Retrieves the details of an existing product. Supply the unique product ID from either a product creation request or the product list, and Stripe will return the corresponding product information.
      Throws:
      StripeException
    • retrieve

      public static Product retrieve(String id, Map<String,Object> params, RequestOptions options) throws StripeException
      Retrieves the details of an existing product. Supply the unique product ID from either a product creation request or the product list, and Stripe will return the corresponding product information.
      Throws:
      StripeException
    • retrieve

      public static Product retrieve(String id, ProductRetrieveParams params, RequestOptions options) throws StripeException
      Retrieves the details of an existing product. Supply the unique product ID from either a product creation request or the product list, and Stripe will return the corresponding product information.
      Throws:
      StripeException
    • search

      public static ProductSearchResult search(Map<String,Object> params) throws StripeException
      Search for products 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 ProductSearchResult search(Map<String,Object> params, RequestOptions options) throws StripeException
      Search for products 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 ProductSearchResult search(ProductSearchParams params) throws StripeException
      Search for products 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 ProductSearchResult search(ProductSearchParams params, RequestOptions options) throws StripeException
      Search for products 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 Product update(Map<String,Object> params) throws StripeException
      Updates the specific product by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
      Specified by:
      update in interface MetadataStore<Product>
      Throws:
      StripeException
    • update

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

      public Product update(ProductUpdateParams params) throws StripeException
      Updates the specific product by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
      Throws:
      StripeException
    • update

      public Product update(ProductUpdateParams params, RequestOptions options) throws StripeException
      Updates the specific product by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
      Throws:
      StripeException
    • getActive

      public Boolean getActive()
      Whether the product is currently available for purchase.
    • getAttributes

      public List<String> getAttributes()
      A list of up to 5 attributes that each SKU can provide values for (e.g., ["color", "size"]).
    • getCaption

      public String getCaption()
      A short one-line description of the product, meant to be displayable to the customer. Only applicable to products of type=good.
    • getCreated

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

      public List<String> getDeactivateOn()
      An array of connect application identifiers that cannot purchase this product. Only applicable to products of type=good.
    • getDeleted

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

      public String getDescription()
      The product's description, meant to be displayable to the customer. Use this field to optionally store a long form explanation of the product being sold for your own rendering purposes.
    • getImages

      public List<String> getImages()
      A list of up to 8 URLs of images for this product, meant to be displayable to the customer.
    • 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.
    • getName

      public String getName()
      The product's name, meant to be displayable to the customer.
    • getObject

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

      Equal to product.

    • getPackageDimensions

      public Product.PackageDimensions getPackageDimensions()
      The dimensions of this product for shipping purposes.
    • getProvisioning

      public Product.Provisioning getProvisioning()
      Provisioning configuration for this product.
    • getShippable

      public Boolean getShippable()
      Whether this product is shipped (i.e., physical goods).
    • getStatementDescriptor

      public String getStatementDescriptor()
      Extra information about a product which will appear on your customer's credit card statement. In the case that multiple products are billed at once, the first statement descriptor will be used.
    • getType

      public String getType()
      The type of the product. The product is either of type good, which is eligible for use with Orders and SKUs, or service, which is eligible for use with Subscriptions and Plans.

      One of good, or service.

    • getUnitLabel

      public String getUnitLabel()
      A label that represents units of this product. When set, this will be included in customers' receipts, invoices, Checkout, and the customer portal.
    • getUpdated

      public Long getUpdated()
      Time at which the object was last updated. Measured in seconds since the Unix epoch.
    • getUrl

      public String getUrl()
      A URL of a publicly-accessible webpage for this product.
    • setActive

      public void setActive(Boolean active)
      Whether the product is currently available for purchase.
    • setAttributes

      public void setAttributes(List<String> attributes)
      A list of up to 5 attributes that each SKU can provide values for (e.g., ["color", "size"]).
    • setCaption

      public void setCaption(String caption)
      A short one-line description of the product, meant to be displayable to the customer. Only applicable to products of type=good.
    • setCreated

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

      public void setDeactivateOn(List<String> deactivateOn)
      An array of connect application identifiers that cannot purchase this product. Only applicable to products of type=good.
    • setDeleted

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

      public void setDescription(String description)
      The product's description, meant to be displayable to the customer. Use this field to optionally store a long form explanation of the product being sold for your own rendering purposes.
    • setId

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

      public void setImages(List<String> images)
      A list of up to 8 URLs of images for this product, meant to be displayable to the customer.
    • 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.
    • 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.
    • setName

      public void setName(String name)
      The product's name, meant to be displayable to the customer.
    • setObject

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

      Equal to product.

    • setPackageDimensions

      public void setPackageDimensions(Product.PackageDimensions packageDimensions)
      The dimensions of this product for shipping purposes.
    • setProvisioning

      public void setProvisioning(Product.Provisioning provisioning)
      Provisioning configuration for this product.
    • setShippable

      public void setShippable(Boolean shippable)
      Whether this product is shipped (i.e., physical goods).
    • setStatementDescriptor

      public void setStatementDescriptor(String statementDescriptor)
      Extra information about a product which will appear on your customer's credit card statement. In the case that multiple products are billed at once, the first statement descriptor will be used.
    • setType

      public void setType(String type)
      The type of the product. The product is either of type good, which is eligible for use with Orders and SKUs, or service, which is eligible for use with Subscriptions and Plans.

      One of good, or service.

    • setUnitLabel

      public void setUnitLabel(String unitLabel)
      A label that represents units of this product. When set, this will be included in customers' receipts, invoices, Checkout, and the customer portal.
    • setUpdated

      public void setUpdated(Long updated)
      Time at which the object was last updated. Measured in seconds since the Unix epoch.
    • setUrl

      public void setUrl(String url)
      A URL of a publicly-accessible webpage for this product.
    • 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<Product>