Discount Redemptions

In Lemon Squeezy, a discount redemption is a record of a discount being applied to an order.

A discount redemption belongs to a Discount and an Order.


The discount redemption object

Attributes


discount_id

The ID of the discount this redemption belongs to.


order_id

The ID of the order this redemption belongs to.


discount_name

The name of the discount.


discount_code

The discount code that was used at checkout.


discount_amount

The amount of the discount. Either a fixed amount in cents or a percentage depending on the value of discount_amount_type.


discount_amount_type

The type of the discount_amount. Either percent or fixed.


amount

A positive integer in cents representing the amount of the discount that was applied to the order (in the order currency).


created_at

An ISO 8601 formatted date-time string indicating when the object was created.


updated_at

An ISO 8601 formatted date-time string indicating when the object was last updated.

Discount object

{ "type": "discount-redemptions", "id": "1", "attributes": { "discount_id": 1, "order_id": 1, "discount_name": "10%", "discount_code": "10PERC", "discount_amount": 10, "discount_amount_type": "percent", "amount": 999, "created_at": "2023-02-07T10:30:01.000000Z", "updated_at": "2023-02-07T10:30:01.000000Z" } }

Retrieve a discount redemption

Retrieves the discount redemption with the given ID.

Tip: to retrieve a discount code for a certain order, you can include related resources or use a nested query.

GET /v1/discount-redemptions/:id

curl "https://api.lemonsqueezy.com/v1/discount-redemptions/1" -H 'Accept: application/vnd.api+json' -H 'Content-Type: application/vnd.api+json' -H 'Authorization: Bearer {api_key}'

Returns

Returns a discount redemption object.

Response

{ "jsonapi": { "version": "1.0" }, "links": { "self": "https://api.lemonsqueezy.com/v1/discount-redemptions/1" }, "data": { "type": "discount-redemptions", "id": "1", "attributes": { "discount_id": 1, "order_id": 1, "discount_name": "10%", "discount_code": "10PERC", "discount_amount": 10, "discount_amount_type": "percent", "amount": 999, "created_at": "2023-02-07T10:30:01.000000Z", "updated_at": "2023-02-07T10:30:01.000000Z" }, "relationships": { "discount": { "links": { "related": "https://api.lemonsqueezy.com/v1/discount-redemptions/1/discount", "self": "https://api.lemonsqueezy.com/v1/discount-redemptions/1/relationships/discount" } }, "order": { "links": { "related": "https://api.lemonsqueezy.com/v1/discount-redemptions/1/order", "self": "https://api.lemonsqueezy.com/v1/discount-redemptions/1/relationships/order" } } }, "links": { "self": "https://api.lemonsqueezy.com/v1/discount-redemptions/1" } } }

List all discount redemptions

Returns a paginated list of discount redemptions.

Parameters


discount_id

Only return discount redemptions belonging to the discount with this ID.


order_id

Only return discount redemptions belonging to the order with this ID.

GET /v1/discount-redemptions

curl "https://api.lemonsqueezy.com/v1/discount-redemptions" -H 'Accept: application/vnd.api+json' -H 'Content-Type: application/vnd.api+json' -H 'Authorization: Bearer {api_key}'
curl "https://api.lemonsqueezy.com/v1/discount-redemptions?filter[discount_id]=11" -H 'Accept: application/vnd.api+json' -H 'Content-Type: application/vnd.api+json' -H 'Authorization: Bearer {api_key}'

Returns

Returns a paginated list of discount redemption objects ordered by created_at (descending).

Response

{ "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/discount-redemptions?page%5Bnumber%5D=1&page%5Bsize%5D=10&sort=-createdAt", "last": "https://api.lemonsqueezy.com/v1/discount-redemptions?page%5Bnumber%5D=1339&page%5Bsize%5D=10&sort=-createdAt", "next": "https://api.lemonsqueezy.com/v1/discount-redemptions?page%5Bnumber%5D=2&page%5Bsize%5D=10&sort=-createdAt" }, "data": [ { "type": "discount-redemptions", "id": "1", "attributes": { "discount_id": 1, "order_id": 1, "discount_name": "10%", "discount_code": "10PERC", "discount_amount": 10, "discount_amount_type": "percent", "amount": 999, "created_at": "2023-02-07T10:30:01.000000Z", "updated_at": "2023-02-07T10:30:01.000000Z" }, "relationships": { "discount": { "links": { "related": "https://api.lemonsqueezy.com/v1/discount-redemptions/1/discount", "self": "https://api.lemonsqueezy.com/v1/discount-redemptions/1/relationships/discount" } }, "order": { "links": { "related": "https://api.lemonsqueezy.com/v1/discount-redemptions/1/order", "self": "https://api.lemonsqueezy.com/v1/discount-redemptions/1/relationships/order" } } }, "links": { "self": "https://api.lemonsqueezy.com/v1/discount-redemptions/1" } }, {...}, {...}, ] }