Search documentation of tiger_stripe

# Stripe.Services.PlanService (tiger_stripe v0.1.1)

Copy Markdown View Source

Plan

You can now model subscriptions more flexibly using the Prices API. It replaces the Plans API and is backwards compatible to simplify your migration.

Plans define the base price, currency, and billing cycle for recurring purchases of products. Products help you track inventory or provisioning, and plans help you track pricing. Different physical goods or levels of service should be represented by products, and pricing options should be represented by plans. This approach lets you change prices without having to change your provisioning scheme.

For example, you might have a single "gold" product that has plans for $10/month, $100/year, €9/month, and €90/year.

Related guides: Set up a subscription and more about products and prices.

## Summary

### Functions

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

Create a plan

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

Delete a plan

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

List all plans

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

Retrieve a plan

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

Update a plan

## Functions

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

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

Create a plan

You can now model subscriptions more flexibly using the Prices API. It replaces the Plans API and is backwards compatible to simplify your migration.

# delete(client, plan, params \\ %{}, opts \\ [])

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

Delete a plan

Deleting plans means new subscribers can’t be added. Existing subscribers aren’t affected.

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

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

List all plans

Returns a list of your plans.

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

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

Retrieve a plan

Retrieves the plan with the given ID.

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

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

Update a plan

Updates the specified plan by setting the values of the parameters passed. Any parameters not provided are left unchanged. By design, you cannot change a plan’s ID, amount, currency, or billing cycle.