API Reference
- Getting started
- Add-ons
- Analytics
- Billable metrics
- Coupons
- Credit notes
- Customer usage
- Customers
- Events
- Fees
- Invoices
- Organizations
- Payment requests
- Plans
- Resources
- Subscriptions
- Taxes
- Wallets
- Webhook endpoints
- Webhooks
Create a coupon
This endpoint is used to create a coupon that can be then attached to a customer to create a discount.
Bearer authentication header of the form Bearer <token>
, where <token>
is your auth token.
The name of the coupon.
Unique code used to identify the coupon.
Description of the coupon.
The type of the coupon. It can have two possible values: fixed_amount
or percentage
.
- If set to
fixed_amount
, the coupon represents a fixed amount discount. - If set to
percentage
, the coupon represents a percentage-based discount.
The amount of the coupon in cents. This field is required only for coupon with fixed_amount
type.
The currency of the coupon. This field is required only for coupon with fixed_amount
type.
Indicates whether the coupon can be reused or not. If set to true
, the coupon is reusable, meaning it can be applied multiple times to the same customer. If set to false
, the coupon can only be used once and is not reusable. If not specified, this field is set to true
by default.
The percentage rate of the coupon. This field is required only for coupons with a percentage
coupon type.
The type of frequency for the coupon. It can have three possible values: once
, recurring
or forever
.
- If set to
once
, the coupon is applicable only for a single use. - If set to
recurring
, the coupon can be used multiple times for recurring billing periods. - If set to
forever
, the coupon has unlimited usage and can be applied indefinitely.
Specifies the number of billing periods to which the coupon applies. This field is required only for coupons with a recurring
frequency type
Specifies the type of expiration for the coupon. It can have two possible values: time_limit
or no_expiration
.
- If set to
time_limit
, the coupon has an expiration based on a specified time limit. - If set to
no_expiration
, the coupon does not have an expiration date and remains valid indefinitely.
The expiration date and time of the coupon. This field is required only for coupons with expiration
set to time_limit
. The expiration date and time should be specified in UTC format according to the ISO 8601 datetime standard. It indicates the exact moment when the coupon will expire and is no longer valid.
Set coupon limitations to plans or specific metrics.
An array of plan codes to which the coupon is applicable. By specifying the plan codes in this field, you can restrict the coupon's usage to specific plans only.
An array of billable metric codes to which the coupon is applicable. By specifying the billable metric codes in this field, you can restrict the coupon's usage to specific metrics only.
Authorizations
Bearer authentication header of the form Bearer <token>
, where <token>
is your auth token.
Body
The name of the coupon.
Unique code used to identify the coupon.
Description of the coupon.
The type of the coupon. It can have two possible values: fixed_amount
or percentage
.
- If set to
fixed_amount
, the coupon represents a fixed amount discount. - If set to
percentage
, the coupon represents a percentage-based discount.
fixed_amount
, percentage
The amount of the coupon in cents. This field is required only for coupon with fixed_amount
type.
The currency of the coupon. This field is required only for coupon with fixed_amount
type.
AED
, AFN
, ALL
, AMD
, ANG
, AOA
, ARS
, AUD
, AWG
, AZN
, BAM
, BBD
, BDT
, BGN
, BIF
, BMD
, BND
, BOB
, BRL
, BSD
, BWP
, BYN
, BZD
, CAD
, CDF
, CHF
, CLF
, CLP
, CNY
, COP
, CRC
, CVE
, CZK
, DJF
, DKK
, DOP
, DZD
, EGP
, ETB
, EUR
, FJD
, FKP
, GBP
, GEL
, GIP
, GMD
, GNF
, GTQ
, GYD
, HKD
, HNL
, HRK
, HTG
, HUF
, IDR
, ILS
, INR
, ISK
, JMD
, JPY
, KES
, KGS
, KHR
, KMF
, KRW
, KYD
, KZT
, LAK
, LBP
, LKR
, LRD
, LSL
, MAD
, MDL
, MGA
, MKD
, MMK
, MNT
, MOP
, MRO
, MUR
, MVR
, MWK
, MXN
, MYR
, MZN
, NAD
, NGN
, NIO
, NOK
, NPR
, NZD
, PAB
, PEN
, PGK
, PHP
, PKR
, PLN
, PYG
, QAR
, RON
, RSD
, RUB
, RWF
, SAR
, SBD
, SCR
, SEK
, SGD
, SHP
, SLL
, SOS
, SRD
, STD
, SZL
, THB
, TJS
, TOP
, TRY
, TTD
, TWD
, TZS
, UAH
, UGX
, USD
, UYU
, UZS
, VND
, VUV
, WST
, XAF
, XCD
, XOF
, XPF
, YER
, ZAR
, ZMW
Indicates whether the coupon can be reused or not. If set to true
, the coupon is reusable, meaning it can be applied multiple times to the same customer. If set to false
, the coupon can only be used once and is not reusable. If not specified, this field is set to true
by default.
The percentage rate of the coupon. This field is required only for coupons with a percentage
coupon type.
The type of frequency for the coupon. It can have three possible values: once
, recurring
or forever
.
- If set to
once
, the coupon is applicable only for a single use. - If set to
recurring
, the coupon can be used multiple times for recurring billing periods. - If set to
forever
, the coupon has unlimited usage and can be applied indefinitely.
once
, recurring
, forever
Specifies the number of billing periods to which the coupon applies. This field is required only for coupons with a recurring
frequency type
Specifies the type of expiration for the coupon. It can have two possible values: time_limit
or no_expiration
.
- If set to
time_limit
, the coupon has an expiration based on a specified time limit. - If set to
no_expiration
, the coupon does not have an expiration date and remains valid indefinitely.
no_expiration
, time_limit
The expiration date and time of the coupon. This field is required only for coupons with expiration
set to time_limit
. The expiration date and time should be specified in UTC format according to the ISO 8601 datetime standard. It indicates the exact moment when the coupon will expire and is no longer valid.
Set coupon limitations to plans or specific metrics.
An array of plan codes to which the coupon is applicable. By specifying the plan codes in this field, you can restrict the coupon's usage to specific plans only.
An array of billable metric codes to which the coupon is applicable. By specifying the billable metric codes in this field, you can restrict the coupon's usage to specific metrics only.
Response
Unique identifier of the coupon, created by Lago.
The name of the coupon.
Unique code used to identify the coupon.
The type of the coupon. It can have two possible values: fixed_amount
or percentage
.
- If set to
fixed_amount
, the coupon represents a fixed amount discount. - If set to
percentage
, the coupon represents a percentage-based discount.
fixed_amount
, percentage
Indicates whether the coupon can be reused or not. If set to true
, the coupon is reusable, meaning it can be applied multiple times to the same customer. If set to false
, the coupon can only be used once and is not reusable. If not specified, this field is set to true
by default.
The coupon is limited to specific plans. The possible values can be true
or false
.
The coupon is limited to specific billable metrics. The possible values can be true
or false
.
The type of frequency for the coupon. It can have three possible values: once
, recurring
, or forever
.
- If set to
once
, the coupon is applicable only for a single use. - If set to
recurring
, the coupon can be used multiple times for recurring billing periods. - If set to
forever
, the coupon has unlimited usage and can be applied indefinitely.
once
, recurring
, forever
Specifies the type of expiration for the coupon. It can have two possible values: time_limit
or no_expiration
.
- If set to
time_limit
, the coupon has an expiration based on a specified time limit. - If set to
no_expiration
, the coupon does not have an expiration date and remains valid indefinitely.
no_expiration
, time_limit
The date and time when the coupon was created. It is expressed in UTC format according to the ISO 8601 datetime standard. This field provides the timestamp for the exact moment when the coupon was initially created.
Description of the coupon.
The amount of the coupon in cents. This field is required only for coupon with fixed_amount
type.
The currency of the coupon. This field is required only for coupon with fixed_amount
type.
AED
, AFN
, ALL
, AMD
, ANG
, AOA
, ARS
, AUD
, AWG
, AZN
, BAM
, BBD
, BDT
, BGN
, BIF
, BMD
, BND
, BOB
, BRL
, BSD
, BWP
, BYN
, BZD
, CAD
, CDF
, CHF
, CLF
, CLP
, CNY
, COP
, CRC
, CVE
, CZK
, DJF
, DKK
, DOP
, DZD
, EGP
, ETB
, EUR
, FJD
, FKP
, GBP
, GEL
, GIP
, GMD
, GNF
, GTQ
, GYD
, HKD
, HNL
, HRK
, HTG
, HUF
, IDR
, ILS
, INR
, ISK
, JMD
, JPY
, KES
, KGS
, KHR
, KMF
, KRW
, KYD
, KZT
, LAK
, LBP
, LKR
, LRD
, LSL
, MAD
, MDL
, MGA
, MKD
, MMK
, MNT
, MOP
, MRO
, MUR
, MVR
, MWK
, MXN
, MYR
, MZN
, NAD
, NGN
, NIO
, NOK
, NPR
, NZD
, PAB
, PEN
, PGK
, PHP
, PKR
, PLN
, PYG
, QAR
, RON
, RSD
, RUB
, RWF
, SAR
, SBD
, SCR
, SEK
, SGD
, SHP
, SLL
, SOS
, SRD
, STD
, SZL
, THB
, TJS
, TOP
, TRY
, TTD
, TWD
, TZS
, UAH
, UGX
, USD
, UYU
, UZS
, VND
, VUV
, WST
, XAF
, XCD
, XOF
, XPF
, YER
, ZAR
, ZMW
An array of plan codes to which the coupon is applicable. By specifying the plan codes in this field, you can restrict the coupon's usage to specific plans only.
An array of billable metric codes to which the coupon is applicable. By specifying the billable metric codes in this field, you can restrict the coupon's usage to specific metrics only.
The percentage rate of the coupon. This field is required only for coupons with a percentage
coupon type.
Specifies the number of billing periods to which the coupon applies. This field is required only for coupons with a recurring
frequency type
The expiration date and time of the coupon. This field is required only for coupons with expiration
set to time_limit
. The expiration date and time should be specified in UTC format according to the ISO 8601 datetime standard. It indicates the exact moment when the coupon will expire and is no longer valid.
This field indicates if the coupon has been terminated and is no longer usable. If it's not null, it won't be removed for existing customers using it, but it prevents the coupon from being applied in the future.
Was this page helpful?