Stripe.SubscriptionItem (stripity_stripe v2.17.3) View Source

Work with Stripe subscription item objects.

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

Link to this section Summary

Functions

Create a subscription item.

Delete a subscription.

List all subscriptions.

Retrieve a subscription.

Update a subscription item.

Link to this section Types

Specs

t() :: %Stripe.SubscriptionItem{
  billing_thresholds: Stripe.Types.collection_method_thresholds() | nil,
  created: Stripe.timestamp(),
  deleted: boolean() | nil,
  id: Stripe.id(),
  metadata: Stripe.Types.metadata(),
  object: String.t(),
  plan: Stripe.Plan.t(),
  price: Stripe.Price.t(),
  quantity: non_neg_integer(),
  subscription: Stripe.id() | Stripe.Subscription.t() | nil,
  tax_rates: [Stripe.TaxRate.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: %{
       :subscription => Stripe.id() | Stripe.Subscription.t(),
       optional(:plan) => Stripe.id() | Stripe.Plan.t(),
       optional(:price) => Stripe.id() | Stripe.Price.t(),
       optional(:metadata) => Stripe.Types.metadata(),
       optional(:prorate) => boolean(),
       optional(:proration_date) => Stripe.timestamp(),
       optional(:quantity) => non_neg_integer(),
       optional(:tax_rates) => [String.t()]
     }

Create a subscription item.

Link to this function

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

View Source

Specs

delete(Stripe.id() | t(), params, Stripe.options()) ::
  {:ok, t()} | {:error, Stripe.Error.t()}
when params: %{
       optional(:clear_usage) => boolean(),
       optional(:prorate) => boolean(),
       optional(:proration_date) => Stripe.timestamp()
     }

Delete a subscription.

Takes the id and an optional map of params.

Link to this function

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

View Source

Specs

list(Stripe.id(), params, Stripe.options()) ::
  {:ok, Stripe.List.t(t())} | {:error, Stripe.Error.t()}
when params: %{
       optional(:ending_before) => t() | Stripe.id(),
       optional(:limit) => 1..100,
       optional(:starting_after) => t() | Stripe.id()
     }

List all subscriptions.

Link to this function

retrieve(id, opts \\ [])

View Source

Specs

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

Retrieve a subscription.

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(:metadata) => Stripe.Types.metadata(),
       optional(:plan) => Stripe.id() | Stripe.Plan.t(),
       optional(:price) => Stripe.id() | Stripe.Price.t(),
       optional(:prorate) => boolean(),
       optional(:proration_date) => Stripe.timestamp(),
       optional(:quantity) => non_neg_integer(),
       optional(:tax_rates) => [String.t()]
     }

Update a subscription item.

Takes the id and a map of changes.