Stripe.Coupon (stripity_stripe v2.17.2) View Source
Work with Stripe coupon objects.
You can:
- Create a coupon
- Retrieve a coupon
- Update a coupon
- Delete a coupon
- list all coupons
Stripe API reference: https://stripe.com/docs/api#coupons
Link to this section Summary
Functions
Create a coupon.
Delete a coupon.
List all coupons.
Retrieve a coupon.
Updates the metadata of a coupon. Other coupon details (currency, duration, amount_off) are, by design, not editable.
Link to this section Types
Specs
t() :: %Stripe.Coupon{ amount_off: pos_integer() | nil, applies_to: map() | nil, created: Stripe.timestamp(), currency: String.t() | nil, deleted: boolean() | nil, duration: String.t(), duration_in_months: pos_integer() | nil, id: Stripe.id(), livemode: boolean(), max_redemptions: pos_integer() | nil, metadata: Stripe.Types.metadata(), name: String.t() | nil, object: String.t(), percent_off: number() | nil, redeem_by: Stripe.timestamp() | nil, times_redeemed: non_neg_integer(), valid: boolean() }
Link to this section Functions
Specs
create(params, Stripe.options()) :: {:ok, t()} | {:error, Stripe.Error.t()} when params: %{ optional(:id) => String.t(), :duration => String.t(), optional(:amount_off) => pos_integer(), optional(:duration_in_months) => pos_integer(), optional(:currency) => String.t(), optional(:max_redemptions) => pos_integer(), optional(:metadata) => Stripe.Types.metadata(), optional(:name) => String.t(), optional(:percent_off) => number(), optional(:redeem_by) => Stripe.timestamp() }
Create a coupon.
Specs
delete(Stripe.id() | t(), Stripe.options()) :: {:ok, t()} | {:error, Stripe.Error.t()}
Delete a coupon.
Specs
list(params, Stripe.options()) :: {:ok, Stripe.List.t(t())} | {:error, Stripe.Error.t()} when params: %{ optional(:created) => Stripe.date_query(), optional(:ending_before) => t() | Stripe.id(), optional(:limit) => 1..100, optional(:starting_after) => t() | Stripe.id() }
List all coupons.
Specs
retrieve(Stripe.id() | t(), Stripe.options()) :: {:ok, t()} | {:error, Stripe.Error.t()}
Retrieve a coupon.
Specs
update(Stripe.id() | t(), params, Stripe.options()) :: {:ok, t()} | {:error, Stripe.Error.t()} when params: %{ optional(:metadata) => Stripe.Types.metadata(), optional(:name) => String.t() } | %{}
Updates the metadata of a coupon. Other coupon details (currency, duration, amount_off) are, by design, not editable.
Takes the id
and a map of changes.