Stripe.Sku (stripity_stripe v2.17.3) View Source

Work with Stripe Sku objects.

Stripe API reference: https://stripe.com/docs/api/skus

Link to this section Summary

Link to this section Types

Specs

t() :: %Stripe.Sku{
  active: boolean(),
  attributes: %{optional(String.t()) => String.t()},
  created: Stripe.timestamp(),
  currency: String.t(),
  deleted: boolean() | nil,
  id: Stripe.id(),
  image: String.t(),
  inventory: %{
    quantity: non_neg_integer() | nil,
    type: String.t(),
    value: String.t() | nil
  },
  livemode: boolean(),
  metadata: Stripe.Types.metadata(),
  object: String.t(),
  package_dimensions:
    %{height: float(), length: float(), weight: float(), width: float()} | nil,
  price: non_neg_integer(),
  product: Stripe.id() | Stripe.Relay.Product.t(),
  updated: Stripe.timestamp()
}

Link to this section Functions

Link to this function

create(params, opts \\ [])

View Source

Specs

create(params, Keyword.t()) :: {:ok, t()} | {:error, Stripe.Error.t()}
when params: %{
       :currency => String.t(),
       :inventory => map(),
       :price => non_neg_integer(),
       :product => Stripe.id() | Stripe.Relay.Product.t(),
       optional(:active) => boolean(),
       optional(:attributes) => map(),
       optional(:image) => String.t(),
       optional(:metadata) => Stripe.Types.metadata(),
       optional(:package_dimensions) => map()
     }

Create a sku.

Specs

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

delete a sku.

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(:attributes) => map(),
       optional(:ending_before) => t() | Stripe.id(),
       optional(:ids) => Stripe.List.t(Stripe.id()),
       optional(:in_stock) => boolean(),
       optional(:limit) => 1..100,
       optional(:product) => Stripe.id() | Stripe.Relay.Product.t(),
       optional(:starting_after) => t() | Stripe.id()
     }

List all skus.

Link to this function

retrieve(id, opts \\ [])

View Source

Specs

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

Retrieve a sku.

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) => map(),
       optional(:currency) => String.t(),
       optional(:image) => String.t(),
       optional(:inventory) => map(),
       optional(:metadata) => Stripe.Types.metadata(),
       optional(:package_dimensions) => map(),
       optional(:price) => non_neg_integer(),
       optional(:product) => Stripe.id() | Stripe.Relay.Product.t()
     }

Update a sku.

Takes the id and a map of changes