Stripe.Relay.Product (stripity_stripe v2.17.3) View Source

Work with Stripe products.

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

Link to this section Summary

Functions

Create a product.

Delete a product.

Retrieve a product.

Search products

Update a product.

Link to this section Types

Specs

t() :: %Stripe.Relay.Product{
  active: boolean(),
  attributes: %{optional(String.t()) => String.t()},
  caption: String.t(),
  created: Stripe.timestamp(),
  deactivate_on: [Stripe.id()],
  deleted: boolean() | nil,
  description: String.t(),
  id: Stripe.id(),
  images: [String.t()],
  livemode: boolean(),
  metadata: Stripe.Types.metadata(),
  name: String.t(),
  object: String.t(),
  package_dimensions:
    nil | %{height: float(), length: float(), weight: float(), width: float()},
  shippable: boolean(),
  statement_descriptor: String.t(),
  unit_label: String.t(),
  updated: Stripe.timestamp(),
  url: String.t()
}

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(:caption) => String.t(),
         optional(:deactive_on) => [Stripe.id()],
         optional(:description) => String.t(),
         optional(:id) => String.t(),
         optional(:images) => [Stripe.id()],
         optional(:description) => String.t(),
         optional(:attributes) => list(),
         :name => String.t(),
         :type => String.t(),
         optional(:metadata) => Stripe.Types.metadata(),
         optional(:package_dimensions) => map(),
         optional(:shippable) => boolean(),
         optional(:url) => 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(:ids) => Stripe.List.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 product.

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

search(params, opts \\ [])

View Source

Specs

search(params, Stripe.options()) ::
  {:ok, Stripe.SearchResult.t(t())} | {:error, Stripe.Error.t()}
when params: %{
       :query => Stripe.search_query(),
       optional(:limit) => 1..100,
       optional(:page) => String.t()
     }

Search products

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(:caption) => String.t(),
         optional(:deactive_on) => [Stripe.id()],
         optional(:description) => String.t(),
         optional(:images) => [Stripe.id()],
         optional(:metadata) => Stripe.Types.metadata(),
         optional(:name) => String.t(),
         optional(:package_dimensions) => map(),
         optional(:shippable) => boolean(),
         optional(:url) => String.t()
       }
       | %{}

Update a product.

Takes the id and a map of changes.