View Source ExOAPI.Stripe.SDK.Coupons (exoapi_stripe v0.1.4)

Link to this section Summary

Functions

description: <p>You can delete coupons via the <a href="https://dashboard.stripe.com/coupons">coupon management</a> page of the Stripe dashboard. However, deleting a coupon does not affect any customers who have already applied the coupon; it means that new customers can’t redeem the coupon. You can also delete coupons via the API.</p>

description: <p>Returns a list of your coupons.</p>

description: <p>Retrieves the coupon with the given ID.</p>

description: <p>You can create coupons easily via the <a href="https://dashboard.stripe.com/coupons">coupon management</a> page of the Stripe dashboard. Coupon creation is also accessible via the API if you need to create coupons on the fly.</p>

description: <p>Updates the metadata of a coupon. Other coupon details (currency, duration, amount_off) are, by design, not editable.</p>

Link to this section Types

Link to this type

get_coupons_coupon_opts()

View Source
@type get_coupons_coupon_opts() :: {:expand, String.t()}
@type get_coupons_opts() ::
  {:starting_after, String.t()}
  | {:limit, String.t()}
  | {:expand, String.t()}
  | {:ending_before, String.t()}
  | {:created, String.t()}

Link to this section Functions

Link to this function

delete_coupons_coupon(client, body, coupon)

View Source
@spec delete_coupons_coupon(
  client :: ExOAPI.Client.t(),
  body :: %{} | map(),
  coupon :: String.t()
) ::
  {:ok,
   ExOAPI.Stripe.Schemas.Error.t()
   | ExOAPI.Stripe.Schemas.DeletedCoupon.t()
   | map()}
  | {:error, any()}

description: <p>You can delete coupons via the <a href="https://dashboard.stripe.com/coupons">coupon management</a> page of the Stripe dashboard. However, deleting a coupon does not affect any customers who have already applied the coupon; it means that new customers can’t redeem the coupon. You can also delete coupons via the API.</p>

Link to this function

get_coupons(client, opts \\ [])

View Source
@spec get_coupons(client :: ExOAPI.Client.t(), [get_coupons_opts()]) ::
  {:ok,
   ExOAPI.Stripe.Schemas.Error.t()
   | %{
       url: String.t(),
       object: String.t() | :list,
       has_more: boolean(),
       data: [ExOAPI.Stripe.Schemas.Coupon.t()]
     }
   | map()}
  | {:error, any()}

description: <p>Returns a list of your coupons.</p>

Link to this function

get_coupons_coupon(client, coupon, opts \\ [])

View Source
@spec get_coupons_coupon(
  client :: ExOAPI.Client.t(),
  coupon :: String.t(),
  [get_coupons_coupon_opts()]
) ::
  {:ok,
   ExOAPI.Stripe.Schemas.Error.t() | ExOAPI.Stripe.Schemas.Coupon.t() | map()}
  | {:error, any()}

description: <p>Retrieves the coupon with the given ID.</p>

Link to this function

post_coupons(client, body)

View Source
@spec post_coupons(
  client :: ExOAPI.Client.t(),
  body ::
    %{
      redeem_by: integer(),
      percent_off: number(),
      name: String.t(),
      metadata: String.t() | map(),
      max_redemptions: integer(),
      id: String.t(),
      expand: [String.t()],
      duration_in_months: integer(),
      duration: String.t() | :forever | :once | :repeating,
      currency: String.t(),
      applies_to: %{products: [String.t()]},
      amount_off: integer()
    }
    | map()
) ::
  {:ok,
   ExOAPI.Stripe.Schemas.Error.t() | ExOAPI.Stripe.Schemas.Coupon.t() | map()}
  | {:error, any()}

description: <p>You can create coupons easily via the <a href="https://dashboard.stripe.com/coupons">coupon management</a> page of the Stripe dashboard. Coupon creation is also accessible via the API if you need to create coupons on the fly.</p>

A coupon has either a percent_off or an amount_off and currency. If you set an amount_off, that amount will be subtracted from any invoice’s subtotal. For example, an invoice with a subtotal of 100 will have a final total of 0 if a coupon with an amount_off of 200 is applied to it and an invoice with a subtotal of 300 will have a final total of 100 if a coupon with an amount_off of 200 is applied to it.

Link to this function

post_coupons_coupon(client, body, coupon)

View Source
@spec post_coupons_coupon(
  client :: ExOAPI.Client.t(),
  body ::
    %{name: String.t(), metadata: String.t() | map(), expand: [String.t()]}
    | map(),
  coupon :: String.t()
) ::
  {:ok,
   ExOAPI.Stripe.Schemas.Error.t() | ExOAPI.Stripe.Schemas.Coupon.t() | map()}
  | {:error, any()}

description: <p>Updates the metadata of a coupon. Other coupon details (currency, duration, amount_off) are, by design, not editable.</p>