View Source ExOAPI.Stripe.Schemas.Coupon (exoapi_stripe v0.1.4)

description: A coupon contains information about a percent-off or amount-off discount you might want to apply to a customer. Coupons may be applied to invoices or orders. Coupons do not work with conventional one-off charges.

:amount_off :: :integer

Amount (in the currency specified) that will be taken off the subtotal of any invoices for this customer.

:applies_to :: ExOAPI.Stripe.Schemas.CouponAppliesTo

:created :: :integer

Time at which the object was created. Measured in seconds since the Unix epoch.

:currency :: :string

If amount_off has been set, the three-letter ISO code for the currency of the amount to take off.

:duration :: :string

One of forever, once, and repeating. Describes how long a customer who applies this coupon will get the discount.

:duration_in_months :: :integer

If duration is repeating, the number of months the coupon applies. Null if coupon duration is forever or once.

:id :: :string

Unique identifier for the object.

:livemode :: :boolean

Has the value true if the object exists in live mode or the value false if the object exists in test mode.

:max_redemptions :: :integer

Maximum number of times this coupon can be redeemed, in total, across all customers, before it is no longer valid.

:metadata :: :map

Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.

:name :: :string

Name of the coupon displayed to customers on for instance invoices or receipts.

:object :: :string

String representing the object's type. Objects of the same type share the same value.

:percent_off :: :number

Percent that will be taken off the subtotal of any invoices for this customer for the duration of the coupon. For example, a coupon with percent_off of 50 will make a %s100 invoice %s50 instead.

:redeem_by :: :integer

Date after which the coupon can no longer be redeemed.

:times_redeemed :: :integer

Number of times this coupon has been applied to a customer.

:valid :: :boolean

Taking account of the above properties, whether this coupon can still be applied to a customer.

Link to this section Summary

Link to this section Types

@type params() :: map()
@type t() :: %ExOAPI.Stripe.Schemas.Coupon{
  amount_off: integer() | nil,
  applies_to: ExOAPI.Stripe.Schemas.CouponAppliesTo.t() | nil,
  created: integer() | nil,
  currency: String.t() | nil,
  duration: (:repeating | :once | :forever) | nil,
  duration_in_months: integer() | nil,
  id: String.t() | nil,
  livemode: boolean() | nil,
  max_redemptions: integer() | nil,
  metadata: map() | nil,
  name: String.t() | nil,
  object: :coupon | nil,
  percent_off: float() | nil,
  redeem_by: integer() | nil,
  times_redeemed: integer() | nil,
  valid: boolean() | nil
}

Link to this section Functions

Link to this function

changeset(struct \\ %__MODULE__{}, params)

View Source
@spec changeset(t(), params()) :: Ecto.Changeset.t()