Stripe.Plan (stripity_stripe v2.17.3) View Source
Work with Stripe plan objects.
You can:
- Create a plan
- Retrieve a plan
- Update a plan
- Delete a plan
Does not yet render lists or take options.
Stripe API reference: https://stripe.com/docs/api#plan
Example:
{
"id": "ivory-extended-580",
"object": "plan",
"active": true,
"aggregate_usage": null,
"amount": 999,
"billing_scheme": "per_unit",
"created": 1531234812,
"currency": "usd",
"interval": "month",
"interval_count": 1,
"livemode": false,
"metadata": {
},
"nickname": null,
"product": "prod_DCmtkptv7qHXGE",
"tiers": null,
"tiers_mode": null,
"transform_usage": null,
"trial_period_days": null,
"usage_type": "licensed"
}
Link to this section Summary
Link to this section Types
Specs
t() :: %Stripe.Plan{ active: boolean(), aggregate_usage: String.t() | nil, amount: non_neg_integer() | nil, amount_decimal: String.t() | nil, billing_scheme: String.t() | nil, created: Stripe.timestamp(), currency: String.t(), deleted: boolean() | nil, id: Stripe.id(), interval: String.t(), interval_count: pos_integer(), livemode: boolean(), metadata: Stripe.Types.metadata(), name: String.t(), nickname: String.t() | nil, object: String.t(), product: Stripe.id() | Stripe.Product.t(), tiers: Stripe.List.t(map()) | nil, tiers_mode: boolean() | nil, transform_usage: map() | nil, trial_period_days: non_neg_integer() | nil, usage_type: String.t() | nil }
Link to this section Functions
Specs
create(params, Stripe.options()) :: {:ok, t()} | {:error, Stripe.Error.t()} when params: %{ :currency => String.t(), :interval => String.t(), :product => Stripe.id() | Stripe.Product.t(), optional(:id) => String.t(), optional(:amount) => non_neg_integer(), optional(:amount_decimal) => String.t(), optional(:active) => boolean(), optional(:billing_scheme) => String.t(), optional(:interval_count) => pos_integer(), optional(:metadata) => Stripe.Types.metadata(), optional(:nickname) => String.t(), optional(:tiers) => Stripe.List.t(map()), optional(:tiers_mode) => String.t(), optional(:transform_usage) => map(), optional(:trial_period_days) => non_neg_integer(), optional(:usage_type) => String.t() } | %{}
Create a plan.
Specs
delete(Stripe.id() | t(), Stripe.options()) :: {:ok, t()} | {:error, Stripe.Error.t()}
Delete a plan.
Specs
list(params, Stripe.options()) :: {:ok, Stripe.List.t(t())} | {:error, Stripe.Error.t()} when params: %{ optional(:active) => boolean(), optional(:created) => Stripe.date_query(), optional(:ending_before) => t() | Stripe.id(), optional(:limit) => 1..100, optional(:product) => Stripe.Product.t() | Stripe.id(), optional(:starting_after) => t() | Stripe.id() } | %{}
List all plans.
Specs
retrieve(Stripe.id() | t(), Stripe.options()) :: {:ok, t()} | {:error, Stripe.Error.t()}
Retrieve a plan.
Specs
update(Stripe.id() | t(), params, Stripe.options()) :: {:ok, t()} | {:error, Stripe.Error.t()} when params: %{ optional(:active) => boolean(), optional(:metadata) => Stripe.Types.metadata(), optional(:nickname) => String.t(), optional(:product) => Stripe.id() | Stripe.Product.t(), optional(:trial_period_days) => non_neg_integer() } | %{}
Update a plan.
Takes the id
and a map of changes.