Skip to main content

Create coupon

Route

POST
/api/v1/coupons

Usage

LAGO_URL="https://api.getlago.com"
API_KEY="__YOUR_API_KEY__"

curl --location --request POST "$LAGO_URL/api/v1/coupons" \
--header "Authorization: Bearer $API_KEY" \
--header 'Content-Type: application/json' \
--data-raw '{
"coupon": {
"name": "coupon_name",
"code": "coupon_code",
"amount_cents": 5000,
"amount_currency": "USD",
"coupon_type": "fixed_amount",
"reusable": true,
"frequency": "recurring",
"frequency_duration": 3,
"expiration": "time_limit",
"expiration_at": "2022-08-08T23:59:59Z",
"applies_to": {
"plan_codes": ["code1"]
}
}
}'

Arguments

{
"coupon": {
"name": "coupon_name",
"code": "coupon_code",
"amount_cents": 5000,
"amount_currency": "USD",
"expiration": "time_limit",
"expiration_at": "2022-08-08T23:59:59Z",
"coupon_type": "fixed_amount",
"reusable": true,
"frequency": "recurring",
"frequency_duration": 3,
"applies_to": {
"plan_codes": ["code1"]
}
}
}
AttributesTypeDescription
nameString      RequiredCoupon name
codeString      RequiredCode identifying the coupon
amount_centsInteger      Optional (required only for fixed_amount type)Amount of the coupon
amount_currencyString      Optional (required only for fixed_amount type)Currency of the amount
reusableBoolean      OptionalField specifying if coupon is reusable or not.
expirationString      RequiredExpiration type.
It can be time_limit or no_expiration
expiration_atString      Optional (required only for time_limit type)
ISO 8601 datetime in UTC
Expiration date and time of the coupon.
coupon_typeString      RequiredCoupon type.
It can be fixed_amount or percentage
frequencyString      RequiredFrequency type.
It can be once or recurring
frequency_durationString      Optional (required only for recurring frequency type)This field determines the number of billing periods to which the coupon applies.
percentage_rateFloat      Optional (required only for percentage coupon type)Rate of the coupon.
applies_toObject      OptionalSettings with coupon limitations

Deprecated attributes

AttributesTypeDescription
expiration_dateString      Optional (required only for time_limit type)Expiration date of the coupon.
Replaced by expiration_at. Value will be converted to "end_of_day"

Responses

The coupon was created

Returns a coupon object.