Create a new coupon for the given product or a checkout
Coupons are great. Whether they’re underpinning your marketing campaigns, giving your customers a little extra discount at the checkout, or smoothing things out when things go awry, they can be really versatile tools.
Our coupon API provides you with:
https://vendors.paddle.com/api/2.1/product/create_coupon
vendor_id
(int) - Vendor ID (required)vendor_auth_code
(string) - Vendor API Auth Code (required) - Docs: https://paddle.com/docs/api-authenticationcoupon_code
(string) - Coupon Code. (optional) - Will be randomised if not given.coupon_prefix
(string) - Coupon Prefix. (optional) - Prefix of coupon code to use if generating a batch of coupons. Not valid if coupon_code parameter is specified.num_coupons
(int) - Number of Coupons to generate. (optional) - Number of coupons to generate at once. Not valid if coupon_code
parameter is specified (as that implies a single coupon).description
(string) - Description of the coupon for internal use. (optional)coupon_type
(string) - Either product
or checkout
. (required)product_ids
(string) - Comma separated list of products e.g. 499531,1234,123546
. (required if coupon_type
is product
, else optional)discount_type
(string) - Either flat
or percentage
. (required)discount_amount
(decimal) - A currency amount (eg. 10.00
) if discount_type
is flat
, or a percentage amount (eg. 10
for 10%
) if discount_type
is percentage
. (required)currency
(string) - Currency of the discount_amount
. (required - if discount_type
is flat
)allowed_uses
(int) - Number of times each coupon can be used. (required)expires
(string) - Date the coupon is valid until, in the format YYYY-MM-DD
. Coupon will expire at the start of this date (eg. YYYY-MM-DD 00:00:00
). (optional)recurring
(bool) - Either 0
or 1
. If the coupon contains subscription products, this indicates if the discount should apply to intervals after the initial purchase. (optional)minimum_threshold
- The minimum threshold (total in cart) that needs to be exceeded for the coupon to work. If blank or 0
then threshold is removed. (optional - unless changing currency when a minimum threshold is already set.)group
(string) - The name of the coupon group this coupon belongs to; groups that do not exist will be created automatically. (optional)Example Request
curl -X POST \
-d 'vendor_id=12345' \
-d 'vendor_auth_code=abc1234...' \
-d 'coupon_prefix=TEST-' \
-d 'num_coupons=5' \
-d 'description=Coupons created via the API.' \
-d 'coupon_type=product' \
-d 'product_ids=510509,511520,508649' \
-d 'discount_type=percentage' \
-d 'discount_amount=25' \
-d 'allowed_uses=1' \
-d 'group=My-Test-Group' \
https://vendors.paddle.com/api/2.1/product/create_coupon
Example Response
{
"success": true,
"response": {
"coupon_codes": [
"TEST-03C532BD",
"TEST-491AC84D",
"TEST-899202BB",
"TEST-96518CAF",
"TEST-2A2A7594"
]
}
}