View Source Stripe.SubscriptionItem (stripity_stripe v3.3.1)
Subscription items allow you to create customer subscriptions with more than one plan, making it easy to represent complex billing relationships.
Summary
Types
Data used to generate a new Price object inline.
The recurring components of a price such as interval and interval_count.
The subscription_item type.
Functions
Adds a new item to an existing subscription. No existing items will be changed or replaced.
Deletes an item from the subscription. Removing a subscription item from a subscription will not cancel the subscription.
Returns a list of your subscription items for a given subscription.
Retrieves the subscription item with the given ID.
Updates the plan or quantity of an item on a current subscription.
Types
@type billing_thresholds() :: %{optional(:usage_gte) => integer()}
@type price_data() :: %{ optional(:currency) => binary(), optional(:product) => binary(), 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 inline.
@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.SubscriptionItem{ billing_thresholds: term() | nil, created: integer(), current_period_end: integer(), current_period_start: integer(), discounts: term(), id: binary(), metadata: term(), object: binary(), plan: Stripe.Plan.t(), price: Stripe.Price.t(), quantity: integer(), subscription: binary(), tax_rates: term() | nil }
The subscription_item type.
billing_thresholdsDefine thresholds at which an invoice will be sent, and the related subscription advanced to a new billing periodcreatedTime at which the object was created. Measured in seconds since the Unix epoch.current_period_endThe end time of this subscription item's current billing period.current_period_startThe start time of this subscription item's current billing period.discountsThe discounts applied to the subscription item. Subscription item discounts are applied before subscription discounts. Useexpand[]=discountsto expand each discount.idUnique identifier for the object.metadataSet 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.objectString representing the object's type. Objects of the same type share the same value.planpricequantityThe quantity of the plan to which the customer should be subscribed.subscriptionThesubscriptionthissubscription_itembelongs to.tax_ratesThe tax rates which apply to thissubscription_item. When set, thedefault_tax_rateson the subscription do not apply to thissubscription_item.
Functions
@spec create( params :: %{ optional(:billing_thresholds) => billing_thresholds() | binary(), optional(:discounts) => [discounts()] | binary(), optional(:expand) => [binary()], optional(:metadata) => %{optional(binary()) => binary()}, optional(:payment_behavior) => :allow_incomplete | :default_incomplete | :error_if_incomplete | :pending_if_incomplete, optional(:plan) => binary(), optional(:price) => binary(), optional(:price_data) => price_data(), optional(:proration_behavior) => :always_invoice | :create_prorations | :none, optional(:proration_date) => integer(), optional(:quantity) => integer(), optional(:subscription) => binary(), optional(:tax_rates) => [binary()] | binary() }, opts :: Keyword.t() ) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
Adds a new item to an existing subscription. No existing items will be changed or replaced.
Details
- Method:
post - Path:
/v1/subscription_items
@spec delete( item :: binary(), params :: %{ optional(:clear_usage) => boolean(), optional(:proration_behavior) => :always_invoice | :create_prorations | :none, optional(:proration_date) => integer() }, opts :: Keyword.t() ) :: {:ok, Stripe.DeletedSubscriptionItem.t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
Deletes an item from the subscription. Removing a subscription item from a subscription will not cancel the subscription.
Details
- Method:
delete - Path:
/v1/subscription_items/{item}
@spec list( params :: %{ optional(:ending_before) => binary(), optional(:expand) => [binary()], optional(:limit) => integer(), optional(:starting_after) => binary(), optional(:subscription) => binary() }, opts :: Keyword.t() ) :: {:ok, Stripe.List.t(t())} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
Returns a list of your subscription items for a given subscription.
Details
- Method:
get - Path:
/v1/subscription_items
@spec retrieve( item :: binary(), params :: %{optional(:expand) => [binary()]}, opts :: Keyword.t() ) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
Retrieves the subscription item with the given ID.
Details
- Method:
get - Path:
/v1/subscription_items/{item}
@spec update( item :: binary(), params :: %{ optional(:billing_thresholds) => billing_thresholds() | binary(), optional(:discounts) => [discounts()] | binary(), optional(:expand) => [binary()], optional(:metadata) => %{optional(binary()) => binary()} | binary(), optional(:off_session) => boolean(), optional(:payment_behavior) => :allow_incomplete | :default_incomplete | :error_if_incomplete | :pending_if_incomplete, optional(:plan) => binary(), optional(:price) => binary(), optional(:price_data) => price_data(), optional(:proration_behavior) => :always_invoice | :create_prorations | :none, optional(:proration_date) => integer(), optional(:quantity) => integer(), optional(:tax_rates) => [binary()] | binary() }, opts :: Keyword.t() ) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
Updates the plan or quantity of an item on a current subscription.
Details
- Method:
post - Path:
/v1/subscription_items/{item}