View Source Stripe.Product (Striped v0.5.0) (generated)

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

Link to this section Summary

Types

Data used to generate a new Price object. This Price will be set as the default price for this product.

The dimensions of this product for shipping purposes.

The recurring components of a price such as interval and interval_count.

t()

The product type.

Functions

Creates a new product object.

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.

Returns a list of your products. The products are returned sorted by creation date, with the most recently created products appearing first.

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.

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.

Updates the specific product by setting the values of the parameters passed. Any parameters not provided will be left unchanged.

Link to this section Types

@type created() :: %{
  optional(:gt) => integer(),
  optional(:gte) => integer(),
  optional(:lt) => integer(),
  optional(:lte) => integer()
}
@type default_price_data() :: %{
  optional(:currency) => binary(),
  optional(:currency_options) => map(),
  optional(:recurring) => recurring(),
  optional(:tax_behavior) => :exclusive | :inclusive | :unspecified,
  optional(:unit_amount) => integer(),
  optional(:unit_amount_decimal) => binary()
}

Data used to generate a new Price object. This Price will be set as the default price for this product.

@type package_dimensions() :: %{
  optional(:height) => number(),
  optional(:length) => number(),
  optional(:weight) => number(),
  optional(:width) => number()
}

The dimensions of this product for shipping purposes.

@type recurring() :: %{
  optional(:interval) => :day | :month | :week | :year,
  optional(:interval_count) => integer()
}

The recurring components of a price such as interval and interval_count.

@type t() :: %Stripe.Product{
  active: boolean(),
  attributes: term() | nil,
  caption: binary() | nil,
  created: integer(),
  deactivate_on: term(),
  default_price: (binary() | Stripe.Price.t()) | nil,
  description: binary() | nil,
  id: binary(),
  images: term(),
  livemode: boolean(),
  metadata: term(),
  name: binary(),
  object: binary(),
  package_dimensions: term() | nil,
  shippable: boolean() | nil,
  statement_descriptor: binary() | nil,
  tax_code: (binary() | Stripe.TaxCode.t()) | nil,
  type: binary(),
  unit_label: binary() | nil,
  updated: integer(),
  url: binary() | nil
}

The product type.

  • active Whether the product is currently available for purchase.
  • attributes A list of up to 5 attributes that each SKU can provide values for (e.g., ["color", "size"]).
  • caption A short one-line description of the product, meant to be displayable to the customer. Only applicable to products of type=good.
  • created Time at which the object was created. Measured in seconds since the Unix epoch.
  • deactivate_on An array of connect application identifiers that cannot purchase this product. Only applicable to products of type=good.
  • default_price The ID of the Price object that is the default price for this product.
  • 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.
  • id Unique identifier for the object.
  • images A list of up to 8 URLs of images for this product, meant to be displayable to the customer.
  • livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode.
  • 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.
  • name The product's name, meant to be displayable to the customer.
  • object String representing the object's type. Objects of the same type share the same value.
  • package_dimensions The dimensions of this product for shipping purposes.
  • shippable Whether this product is shipped (i.e., physical goods).
  • statement_descriptor 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.
  • tax_code A tax code ID.
  • 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.
  • unit_label A label that represents units of this product in Stripe and on customers’ receipts and invoices. When set, this will be included in associated invoice line item descriptions.
  • updated Time at which the object was last updated. Measured in seconds since the Unix epoch.
  • url A URL of a publicly-accessible webpage for this product.

Link to this section Functions

Link to this function

create(client, params \\ %{}, opts \\ [])

View Source
@spec create(
  client :: Stripe.t(),
  params :: %{
    optional(:active) => boolean(),
    optional(:attributes) => [binary()],
    optional(:caption) => binary(),
    optional(:deactivate_on) => [binary()],
    optional(:default_price_data) => default_price_data(),
    optional(:description) => binary(),
    optional(:expand) => [binary()],
    optional(:id) => binary(),
    optional(:images) => [binary()],
    optional(:metadata) => %{optional(binary()) => binary()},
    optional(:name) => binary(),
    optional(:package_dimensions) => package_dimensions(),
    optional(:shippable) => boolean(),
    optional(:statement_descriptor) => binary(),
    optional(:tax_code) => binary(),
    optional(:type) => :good | :service,
    optional(:unit_label) => binary(),
    optional(:url) => binary()
  },
  opts :: Keyword.t()
) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}

Creates a new product object.

Details

  • Method: post
  • Path: /v1/products
Link to this function

delete(client, id, opts \\ [])

View Source
@spec delete(client :: Stripe.t(), id :: binary(), opts :: Keyword.t()) ::
  {:ok, Stripe.DeletedProduct.t()}
  | {:error, Stripe.ApiErrors.t()}
  | {:error, term()}

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.

Details

  • Method: delete
  • Path: /v1/products/{id}
Link to this function

list(client, params \\ %{}, opts \\ [])

View Source
@spec list(
  client :: Stripe.t(),
  params :: %{
    optional(:active) => boolean(),
    optional(:created) => created() | integer(),
    optional(:ending_before) => binary(),
    optional(:expand) => [binary()],
    optional(:ids) => [binary()],
    optional(:limit) => integer(),
    optional(:shippable) => boolean(),
    optional(:starting_after) => binary(),
    optional(:type) => :good | :service,
    optional(:url) => binary()
  },
  opts :: Keyword.t()
) ::
  {:ok, Stripe.List.t(t())} | {:error, Stripe.ApiErrors.t()} | {:error, term()}

Returns a list of your products. The products are returned sorted by creation date, with the most recently created products appearing first.

Details

  • Method: get
  • Path: /v1/products
Link to this function

retrieve(client, id, params \\ %{}, opts \\ [])

View Source
@spec retrieve(
  client :: Stripe.t(),
  id :: binary(),
  params :: %{optional(:expand) => [binary()]},
  opts :: Keyword.t()
) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}

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.

Details

  • Method: get
  • Path: /v1/products/{id}
Link to this function

search(client, params \\ %{}, opts \\ [])

View Source
@spec search(
  client :: Stripe.t(),
  params :: %{
    optional(:expand) => [binary()],
    optional(:limit) => integer(),
    optional(:page) => binary(),
    optional(:query) => binary()
  },
  opts :: Keyword.t()
) ::
  {:ok, Stripe.SearchResult.t(t())}
  | {:error, Stripe.ApiErrors.t()}
  | {:error, term()}

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.

Details

  • Method: get
  • Path: /v1/products/search
Link to this function

update(client, id, params \\ %{}, opts \\ [])

View Source
@spec update(
  client :: Stripe.t(),
  id :: binary(),
  params :: %{
    optional(:active) => boolean(),
    optional(:attributes) => [binary()] | binary(),
    optional(:caption) => binary(),
    optional(:deactivate_on) => [binary()],
    optional(:default_price) => binary(),
    optional(:description) => binary(),
    optional(:expand) => [binary()],
    optional(:images) => [binary()] | binary(),
    optional(:metadata) => %{optional(binary()) => binary()} | binary(),
    optional(:name) => binary(),
    optional(:package_dimensions) => package_dimensions() | binary(),
    optional(:shippable) => boolean(),
    optional(:statement_descriptor) => binary(),
    optional(:tax_code) => binary() | binary(),
    optional(:unit_label) => binary(),
    optional(:url) => binary() | binary()
  },
  opts :: Keyword.t()
) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}

Updates the specific product by setting the values of the parameters passed. Any parameters not provided will be left unchanged.

Details

  • Method: post
  • Path: /v1/products/{id}