Stripe.PromotionCode (stripity_stripe v2.17.3) View Source
Work with Stripe promotion code objects.
You can:
- Create a promotion code
- Retrieve a promotion code
- Update a promotion code
- list all promotion codes
Stripe API reference: https://stripe.com/docs/api/promotion_codes
Link to this section Summary
Functions
Create a promotion code.
List all promotion codes.
Retrieve a promotion code.
Updates the metadata of a promotion code. Other promotion code details (coupon, customer, expires_at, max_redemptions, restrictions) are, by design, not editable.
Link to this section Types
Specs
restrictions() :: %{ optional(:first_time_transaction) => boolean(), optional(:minimum_amount) => pos_integer(), optional(:minimum_amount_currency) => String.t() }
Specs
t() :: %Stripe.PromotionCode{ active: boolean(), code: String.t() | nil, coupon: Stripe.Coupon.t(), created: Stripe.timestamp(), customer: String.t() | nil, deleted: boolean() | nil, expires_at: Stripe.timestamp() | nil, id: Stripe.id(), livemode: boolean(), max_redemptions: pos_integer() | nil, metadata: Stripe.Types.metadata(), object: String.t(), restrictions: restrictions(), 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: %{ :coupon => Stripe.id(), optional(:code) => String.t(), optional(:active) => boolean(), optional(:customer) => Stripe.id(), optional(:expires_at) => Stripe.timestamp(), optional(:max_redemptions) => pos_integer(), optional(:metadata) => Stripe.Types.metadata(), optional(:restrictions) => restrictions() }
Create a promotion code.
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(:code) => String.t(), optional(:coupon) => Stripe.id(), optional(:customer) => Stripe.id(), optional(:ending_before) => t() | Stripe.id(), optional(:limit) => 1..100, optional(:starting_after) => t() | Stripe.id() }
List all promotion codes.
Specs
retrieve(Stripe.id() | t(), Stripe.options()) :: {:ok, t()} | {:error, Stripe.Error.t()}
Retrieve a promotion code.
Specs
update(Stripe.id() | t(), params, Stripe.options()) :: {:ok, t()} | {:error, Stripe.Error.t()} when params: %{ optional(:metadata) => Stripe.Types.metadata(), optional(:active) => boolean() } | %{}
Updates the metadata of a promotion code. Other promotion code details (coupon, customer, expires_at, max_redemptions, restrictions) are, by design, not editable.
Takes the id
and a map of changes.