StripeElixir.Services.PriceService (stripe_elixir v0.1.0)

Copy Markdown View Source

Price

Prices define the unit cost, currency, and (optional) billing cycle for both recurring and one-time purchases of products. Products help you track inventory or provisioning, and prices help you track payment terms. Different physical goods or levels of service should be represented by products, and pricing options should be represented by prices. This approach lets you change prices without having to change your provisioning scheme.

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

Related guides: Set up a subscription, create an invoice, and more about products and prices.

Summary

Functions

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

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

Create a price

Creates a new Price for an existing Product. The Price can be recurring or one-time.

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

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

List all prices

Returns a list of your active prices, excluding inline prices. For the list of inactive prices, set active to false.

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

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

Retrieve a price

Retrieves the price with the given ID.

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

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

Search prices

Search for prices you’ve previously created using Stripe’s Search Query Language. Don’t use search in read-after-write flows where strict consistency is necessary. Under normal operating conditions, data is searchable in less than a minute. Occasionally, propagation of new or updated data can be up to an hour behind during outages. Search functionality is not available to merchants in India.

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

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

Update a price

Updates the specified price by setting the values of the parameters passed. Any parameters not provided are left unchanged.