Stripe.Product (stripity_stripe v2.17.3) View Source

Work with Stripe product objects.

You can:

  • Create a product
  • Retrieve a product
  • Update a product
  • Delete a product
  • List products

Stripe API reference: https://stripe.com/docs/api#service_products

Link to this section Summary

Functions

Create a product.

Delete a product.

List all products.

Retrieve a product.

Update a product.

Link to this section Types

Specs

t() :: %Stripe.Product{
  active: boolean() | nil,
  attributes: list() | nil,
  caption: String.t() | nil,
  created: Stripe.timestamp(),
  deactivate_on: list(),
  default_price: Stripe.id() | Stripe.Price.t() | nil,
  deleted: boolean() | nil,
  description: String.t() | nil,
  id: Stripe.id(),
  images: list(),
  livemode: boolean(),
  metadata: Stripe.Types.metadata(),
  name: String.t(),
  object: String.t(),
  package_dimensions: map() | nil,
  shippable: boolean() | nil,
  statement_descriptor: String.t() | nil,
  type: String.t() | nil,
  unit_label: String.t() | nil,
  updated: Stripe.timestamp(),
  url: String.t() | nil
}

Link to this section Functions

Link to this function

create(params, opts \\ [])

View Source

Specs

create(params, Stripe.options()) :: {:ok, t()} | {:error, Stripe.Error.t()}
when params:
       %{
         optional(:id) => String.t(),
         optional(:attributes) => list(),
         :name => String.t(),
         :type => String.t(),
         optional(:metadata) => Stripe.Types.metadata(),
         optional(:statement_descriptor) => String.t(),
         optional(:unit_label) => String.t()
       }
       | %{}

Create a product.

Specs

delete(Stripe.id() | t(), Stripe.options()) ::
  {:ok, t()} | {:error, Stripe.Error.t()}

Delete a product.

Link to this function

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

View Source

Specs

list(params, Stripe.options()) ::
  {:ok, Stripe.List.t(t())} | {:error, Stripe.Error.t()}
when params:
       %{
         optional(:active) => boolean(),
         optional(:created) => Stripe.date_query(),
         optional(:ending_before) => t() | Stripe.id(),
         optional(:limit) => 1..100,
         optional(:shippable) => boolean(),
         optional(:starting_after) => t() | Stripe.id(),
         optional(:type) => String.t(),
         optional(:url) => String.t()
       }
       | %{}

List all products.

Link to this function

retrieve(id, opts \\ [])

View Source

Specs

retrieve(Stripe.id() | t(), Stripe.options()) ::
  {:ok, t()} | {:error, Stripe.Error.t()}

Retrieve a product.

Link to this function

update(id, params, opts \\ [])

View Source

Specs

update(Stripe.id() | t(), params, Stripe.options()) ::
  {:ok, t()} | {:error, Stripe.Error.t()}
when params:
       %{
         optional(:active) => boolean(),
         optional(:attributes) => list(),
         optional(:description) => String.t(),
         optional(:images) => [String.t()],
         optional(:metadata) => Stripe.Types.metadata(),
         optional(:name) => String.t(),
         optional(:package_dimensions) => map(),
         optional(:shippable) => boolean(),
         optional(:statement_descriptor) => String.t(),
         optional(:tax_code) => String.t(),
         optional(:unit_label) => String.t(),
         optional(:url) => String.t()
       }
       | %{}

Update a product.

Takes the id and a map of changes.