stripity_stripe v2.2.0 Stripe.Coupon 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
Link to this type
t()
View Source
t() :: %Stripe.Coupon{ amount_off: pos_integer() | nil, created: Stripe.timestamp(), currency: String.t() | 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: pos_integer() | nil, redeem_by: Stripe.timestamp() | nil, times_redeemed: non_neg_integer(), valid: boolean() }
Link to this section Functions
Link to this function
create(params, opts \\ [])
View Source
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) => pos_integer(), optional(:redeem_by) => Stripe.timestamp() }
Create a coupon.
Link to this function
delete(id, opts \\ [])
View Source
delete(Stripe.id() | t(), Stripe.options()) :: {:ok, t()} | {:error, Stripe.Error.t()}
Delete a coupon.
Link to this function
list(params \\ %{}, opts \\ [])
View Source
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.
Link to this function
retrieve(id, opts \\ [])
View Source
retrieve(Stripe.id() | t(), Stripe.options()) :: {:ok, t()} | {:error, Stripe.Error.t()}
Retrieve a coupon.
Link to this function
update(id, params, opts \\ [])
View Source
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.