Stripe.SubscriptionSchedule (stripity_stripe v2.17.3) View Source
Work with Stripe subscription schedule objects.
Link to this section Summary
Functions
Cancels a subscription schedule and its associated subscription immediately (if the subscription schedule has an active subscription). A subscription schedule can only be canceled if its status is not_started or active.
Create a subscription schedule.
Retrieves the list of your subscription schedules.
Releases a subscription schedule
Retrieve a subscription schedule.
Update a subscription schedule.
Takes the id
and a map of changes.
Link to this section Types
Specs
default_settings() :: %{ billing_thresholds: Stripe.Types.collection_method_thresholds() | nil, collection_method: String.t(), default_payment_method: Stripe.id() | Stripe.PaymentMethod.t(), invoice_settings: %{days_until_due: integer()} }
Specs
items() :: %{ billing_thresholds: Stripe.Types.collection_method_thresholds(), price: String.t(), quantity: pos_integer(), tax_rates: [Stripe.TaxRate.t()] }
Specs
phases() :: %{ collection_method: String.t() | nil, collection_method: String.t() | nil, coupon: String.t() | nil, default_payment_method: String.t() | nil, default_tax_rates: float() | nil, application_fee_percent: float() | nil, end_date: Stripe.timestamp(), start_date: Stripe.timestamp(), trial_end: Stripe.timestamp(), items: [items()] }
Specs
t() :: %Stripe.SubscriptionSchedule{ canceled_at: Stripe.timestamp() | nil, completed_at: Stripe.timestamp() | nil, created: Stripe.timestamp(), current_phase: %{start_date: Stripe.timestamp(), end_date: Stripe.timestamp()}, customer: Stripe.id() | Stripe.Customer.t(), default_settings: default_settings(), end_behavior: String.t(), id: Stripe.id(), livemode: boolean(), metadata: Stripe.Types.metadata(), object: String.t(), phases: [phases()], released_at: Stripe.timestamp() | nil, released_subscription: Stripe.id() | Stripe.Subscription.t() | nil, revision: String.t(), status: String.t(), subscription: Stripe.id() | Stripe.Subscription.t(), test_clock: Stripe.id() | Stripe.Subscription.t() }
Link to this section Functions
Specs
cancel(Stripe.id() | t(), Stripe.options()) :: {:ok, t()} | {:error, Stripe.Error.t()}
Cancels a subscription schedule and its associated subscription immediately (if the subscription schedule has an active subscription). A subscription schedule can only be canceled if its status is not_started or active.
Takes the subscription schedule id
.
Specs
create(params, Stripe.options()) :: {:ok, t()} | {:error, Stripe.Error.t()} when params: %{ optional(:customer) => Stripe.id(), optional(:from_subscription) => Stripe.id(), optional(:default_settings) => %{ optional(:collection_method) => String.t(), optional(:default_payment_method) => Stripe.id(), optional(:invoice_settings) => %{ optional(:days_until_due) => non_neg_integer() } }, optional(:phases) => [ %{ :items => [ %{ optional(:billing_thresholds) => Stripe.Types.collection_method_thresholds(), optional(:price) => Stripe.id() | Stripe.Price.t(), optional(:quantity) => non_neg_integer(), optional(:tax_rates) => [Stripe.TaxRate.t()] } ], optional(:application_fee_percent) => non_neg_integer(), optional(:coupon) => String.t(), optional(:end_date) => Stripe.timestamp(), optional(:iterations) => non_neg_integer(), optional(:start_date) => Stripe.timestamp(), optional(:trial) => boolean(), optional(:trial_end) => Stripe.timestamp() } ], optional(:end_behavior) => String.t(), optional(:start_date) => Stripe.timestamp() }
Create a subscription schedule.
Examples
Create subscription schedule from existing subscription
Stripe.SubscriptionSchedule.create(%{from_subscription: "sub_1234"})
Specs
list(params, Stripe.options()) :: {:ok, Stripe.List.t(t())} | {:error, Stripe.Error.t()} when params: %{ optional(:canceled_at) => Stripe.date_query(), optional(:completed_at) => Stripe.date_query(), optional(:created) => Stripe.date_query(), optional(:customer) => Stripe.Customer.t() | Stripe.id(), optional(:ending_before) => t() | Stripe.id(), optional(:limit) => 1..100, optional(:released_at) => Stripe.date_query(), optional(:scheduled) => boolean(), optional(:starting_after) => t() | Stripe.id() }
Retrieves the list of your subscription schedules.
Specs
release(Stripe.id() | t(), Stripe.options()) :: {:ok, t()} | {:error, Stripe.Error.t()}
Releases a subscription schedule
Takes the subscription schedule id
.
Specs
retrieve(Stripe.id() | t(), Stripe.options()) :: {:ok, t()} | {:error, Stripe.Error.t()}
Retrieve a subscription schedule.
Specs
update(Stripe.id() | t(), params, Stripe.options()) :: {:ok, t()} | {:error, Stripe.Error.t()} when params: %{ optional(:default_settings) => %{ optional(:collection_method) => String.t(), optional(:default_payment_method) => Stripe.id(), optional(:invoice_settings) => %{ optional(:days_until_due) => non_neg_integer() } }, optional(:phases) => [ %{ :items => [ %{ optional(:billing_thresholds) => Stripe.Types.collection_method_thresholds(), optional(:price) => Stripe.id() | Stripe.Price.t(), optional(:quantity) => non_neg_integer(), optional(:tax_rates) => [Stripe.TaxRate.t()] } ], optional(:application_fee_percent) => non_neg_integer(), optional(:coupon) => String.t(), optional(:end_date) => Stripe.timestamp(), optional(:iterations) => non_neg_integer(), optional(:start_date) => Stripe.timestamp(), optional(:trial) => boolean(), optional(:trial_end) => Stripe.timestamp() } ], optional(:end_behavior) => String.t(), optional(:prorate) => boolean() }
Update a subscription schedule.
Takes the id
and a map of changes.