StripeElixir.Services.SubscriptionScheduleService (stripe_elixir v0.1.0)

Copy Markdown View Source

SubscriptionSchedule

A subscription schedule allows you to create and manage the lifecycle of a subscription by predefining expected changes.

Related guide: Subscription schedules

Summary

Functions

cancel(client, schedule, params \\ %{}, opts \\ [])

@spec cancel(StripeElixir.Client.t(), String.t(), map(), keyword()) ::
  {:ok, term()} | {:error, StripeElixir.Error.t()}

Cancel a schedule

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(client, params \\ %{}, opts \\ [])

@spec create(StripeElixir.Client.t(), map(), keyword()) ::
  {:ok, term()} | {:error, StripeElixir.Error.t()}

Create a schedule

Creates a new subscription schedule object. Each customer can have up to 500 active or scheduled subscriptions.

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

@spec list(StripeElixir.Client.t(), map(), keyword()) ::
  {:ok, term()} | {:error, StripeElixir.Error.t()}

List all schedules

Retrieves the list of your subscription schedules.

release(client, schedule, params \\ %{}, opts \\ [])

@spec release(StripeElixir.Client.t(), String.t(), map(), keyword()) ::
  {:ok, term()} | {:error, StripeElixir.Error.t()}

Release a schedule

Releases the subscription schedule immediately, which will stop scheduling of its phases, but leave any existing subscription in place. A schedule can only be released if its status is not_started or active. If the subscription schedule is currently associated with a subscription, releasing it will remove its subscription property and set the subscription’s ID to the released_subscription property.

retrieve(client, schedule, params \\ %{}, opts \\ [])

@spec retrieve(StripeElixir.Client.t(), String.t(), map(), keyword()) ::
  {:ok, term()} | {:error, StripeElixir.Error.t()}

Retrieve a schedule

Retrieves the details of an existing subscription schedule. You only need to supply the unique subscription schedule identifier that was returned upon subscription schedule creation.

update(client, schedule, params \\ %{}, opts \\ [])

@spec update(StripeElixir.Client.t(), String.t(), map(), keyword()) ::
  {:ok, term()} | {:error, StripeElixir.Error.t()}

Update a schedule

Updates an existing subscription schedule.