Sends a POST request to the Paddle API to create a new discount.

paddle_create_discount(
  amount,
  description,
  type,
  enabled_for_checkout = NULL,
  code = NULL,
  mode = NULL,
  currency_code = NULL,
  recur = NULL,
  maximum_recurring_intervals = NULL,
  usage_limit = NULL,
  restrict_to = NULL,
  expires_at = NULL,
  custom_data = NULL
)

Arguments

amount

Character. Amount to discount by. Required.

description

Character. Internal description of the discount. Required.

type

Character. Type of discount (`"percentage"`, `"flat"`, or `"flat_per_seat"`). Required.

enabled_for_checkout

Logical. Can be used at checkout? Optional.

code

Character. Optional promo code (letters/numbers, max 32 characters).

mode

Character. Filter discounts by mode (one of `"standard"`, `"custom"`). Optional.

currency_code

Character. Required for `"flat"` or `"flat_per_seat"`. Optional.

recur

Logical. Should it recur for subscriptions? Optional.

maximum_recurring_intervals

Integer. Number of times to recur. Optional.

usage_limit

Integer. Maximum redemptions. Optional.

restrict_to

Character vector of product or price IDs. Optional.

expires_at

Character. RFC 3339 datetime string. Optional.

custom_data

Named list. Custom metadata. Optional.

Value

A list containing the created discount and metadata.

Examples

if (FALSE) { # paddle_has_token()
set_paddle_mode("sandbox")
result <- paddle_create_discount(
 amount = "10.00",
 description = "10% off",
 type = "percentage")
}