Paddle.Coupon.create

You're seeing just the function create, go back to Paddle.Coupon module for more information.
Link to this function

create(params, opts \\ [])

View Source

Specs

create(params, keyword()) :: {:ok, map()} | {:error, Paddle.Error.t()}
when params: %{
       optional(:coupon_code) => String.t(),
       optional(:coupon_prefix) => String.t(),
       optional(:num_coupons) => integer(),
       optional(:description) => String.t(),
       :coupon_type => String.t(),
       optional(:product_ids) => [number()],
       :discount_type => String.t(),
       :discount_amount => number(),
       optional(:currency) => String.t(),
       optional(:allowed_uses) => integer(),
       optional(:expires) => String.t(),
       optional(:recurring) => boolean(),
       optional(:group) => String.t()
     }

Create a new coupon for the given product or a checkout

Examples

params = %{
  coupon_prefix: "TEST",
  num_coupons: 5,
  description: "Test Coupon",
  coupon_type: "checkout",
  discount_type: "percentage",
  discount_amount: 10
}
Paddle.Coupon.create(params)  
{:ok, %{
    coupon_codes: [
      "TEST-03C532BD",
      "TEST-491AC84D",
      "TEST-899202BB",
      "TEST-96518CAF",
      "TEST-2A2A7594"
    ]
}}