In Lemon Squeezy, a discount contains information about a percentage or amount discount that can be applied to an order at checkout via a code.
A discount belongs to a Store.
The ID of the store this discount belongs to.
The name of the discount.
The discount code that can be used at checkout.
The amount of discount to apply to the order. Either a fixed amount or a percentage depending on the value of amount_type
.
The type of the amount. Either percent
or fixed
.
Has the value true
if the discount can only be applied to certain products/variants.
Has the value true
if the discount can only be redeemed a limited number of times.
If is_limited_redemptions
is true
, this is the maximum number of redemptions.
An ISO-8601 formatted date-time string indicating when the discount is valid from. Can be null
if no start date is specified.
An ISO-8601 formatted date-time string indicating when the discount expires. Can be null
if no expiration date is specified.
If the discount is applied to a subscription, this specifies how often the discount should be applied. One of once
, repeating
, forever
.
If duration
is repeating
, this specifies how many months the discount should apply.
The status of the discount. Either draft
or published
.
The formatted status of the discount.
An ISO-8601 formatted date-time string indicating when the object was created.
An ISO-8601 formatted date-time string indicating when the object was last updated.
{
"type": "discounts",
"id": "1",
"attributes": {
"store_id": 1,
"name": "10%",
"code": "10PERC",
"amount": 10,
"amount_type": "percent",
"is_limited_to_products": false,
"is_limited_redemptions": false,
"max_redemptions": 0,
"starts_at": null,
"expires_at": null,
"duration": "once",
"duration_in_months": 1,
"status": "published",
"status_formatted": "Published",
"created_at": "2021-05-24T14:15:06.000000Z",
"updated_at": "2021-05-24T14:15:06.000000Z"
}
}
Retrieves the discount with the given ID.
Returns a discount object.
curl "https://api.lemonsqueezy.com/v1/discounts/1" \
-H 'Accept: application/vnd.api+json' \
-H 'Content-Type: application/vnd.api+json' \
-H 'Authorization: Bearer {api_key}'
{
"jsonapi": {
"version": "1.0"
},
"links": {
"self": "https:\/\/api.lemonsqueezy.com\/v1\/discounts\/1"
},
"data": {
"type": "discounts",
"id": "1",
"attributes": {
"store_id": 1,
"name": "10%",
"code": "10PERC",
"amount": 10,
"amount_type": "percent",
"is_limited_to_products": false,
"is_limited_redemptions": false,
"max_redemptions": 0,
"starts_at": null,
"expires_at": null,
"duration": "once",
"duration_in_months": 1,
"status": "published",
"status_formatted": "Published",
"created_at": "2021-05-24T14:15:06.000000Z",
"updated_at": "2021-05-24T14:15:06.000000Z"
},
"relationships": {
"store": {
"links": {
"related": "https:\/\/api.lemonsqueezy.com\/v1\/discounts\/1\/store",
"self": "https:\/\/api.lemonsqueezy.com\/v1\/discounts\/1\/relationships\/store"
}
}
},
"links": {
"self": "https:\/\/api.lemonsqueezy.com\/v1\/discounts\/1"
}
}
}
Returns a paginated list of discounts.
Only return discounts belonging to the store with this ID.
Returns a paginated list of discount objects ordered by created_at
.
curl "https://api.lemonsqueezy.com/v1/discounts" \
-H 'Accept: application/vnd.api+json' \
-H 'Content-Type: application/vnd.api+json' \
-H 'Authorization: Bearer {api_key}'
{
"meta": {
"page": {
"currentPage": 1,
"from": 1,
"lastPage": 1,
"perPage": 10,
"to": 10,
"total": 10
}
},
"jsonapi": {
"version": "1.0"
},
"links": {
"first": "https:\/\/api.lemonsqueezy.com\/v1\/discounts?page%5Bnumber%5D=1&page%5Bsize%5D=10&sort=createdAt",
"last": "https:\/\/api.lemonsqueezy.com\/v1\/discounts?page%5Bnumber%5D=1&page%5Bsize%5D=10&sort=createdAt"
},
"data": [
{
"type": "discounts",
"id": "1",
"attributes": {
"store_id": 1,
"name": "10%",
"code": "10PERC",
"amount": 10,
"amount_type": "percent",
"is_limited_to_products": false,
"is_limited_redemptions": false,
"max_redemptions": 0,
"starts_at": null,
"expires_at": null,
"duration": "once",
"duration_in_months": 1,
"status": "published",
"status_formatted": "Published",
"created_at": "2021-05-24T14:15:06.000000Z",
"updated_at": "2021-05-24T14:15:06.000000Z"
},
"relationships": {
"store": {
"links": {
"related": "https:\/\/api.lemonsqueezy.com\/v1\/discounts\/1\/store",
"self": "https:\/\/api.lemonsqueezy.com\/v1\/discounts\/1\/relationships\/store"
}
}
},
"links": {
"self": "https:\/\/api.lemonsqueezy.com\/v1\/discounts\/1"
}
},
{...},
{...},
]
}