Order Items

In Lemon Squeezy, an order item represents a line item for an order that includes product, variant and price information.

An order item belongs to an Order and is associated with a Product and a Variant.

The order item object

Attributes

order_id

The ID of the order this order item belongs to.

product_id

The ID of the product associated with this order item.

variant_id

The ID of the variant associated with this order item.

product_name

The name of the product.

variant_name

The name of the variant.

price

A positive integer in cents representing the price of this order item (in the order currency).

Note, for “pay what you want” products the price will be whatever the customer entered at checkout.

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.

Order item object

{
  "type": "order-items",
  "id": "1",
  "attributes": {
    "order_id": 1,
    "product_id": 1,
    "variant_id": 1,
    "product_name": "Example Product",
    "variant_name": "Example Variant",
    "price": 999,
    "created_at": "2021-05-24T14:15:06.000000Z",
    "updated_at": "2021-05-24T14:15:06.000000Z"
  }
}

Retrieve an order item

Retrieves the order item with the given ID.

Returns

Returns an order item object.

GET /v1/order-items/:id

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

Response

{
  "jsonapi": {
    "version": "1.0"
  },
  "links": {
    "self": "https:\/\/api.lemonsqueezy.com\/v1\/order-items\/1"
  },
  "data": {
    "type": "order-items",
    "id": "1",
    "attributes": {
      "order_id": 1,
      "product_id": 1,
      "variant_id": 1,
      "product_name": "Example Product",
      "variant_name": "Example Variant",
      "price": 999,
      "created_at": "2021-05-24T14:15:06.000000Z",
      "updated_at": "2021-05-24T14:15:06.000000Z"
    },
    "relationships": {
      "order": {
        "links": {
          "related": "https:\/\/api.lemonsqueezy.com\/v1\/order-items\/1\/order",
          "self": "https:\/\/api.lemonsqueezy.com\/v1\/order-items\/1\/relationships\/order"
        }
      },
      "product": {
        "links": {
          "related": "https:\/\/api.lemonsqueezy.com\/v1\/order-items\/1\/product",
          "self": "https:\/\/api.lemonsqueezy.com\/v1\/order-items\/1\/relationships\/product"
        }
      },
      "variant": {
        "links": {
          "related": "https:\/\/api.lemonsqueezy.com\/v1\/order-items\/1\/variant",
          "self": "https:\/\/api.lemonsqueezy.com\/v1\/order-items\/1\/relationships\/variant"
        }
      }
    },
    "links": {
      "self": "https:\/\/api.lemonsqueezy.com\/v1\/order-items\/1"
    }
  }
}

List all order items

Returns a paginated list of order items.

Parameters

order_id

Only return order items belonging to the order with this ID.

product_id

Only return order items belonging to the product with this ID.

variant_id

Only return order items belonging to the variant with this ID.

Returns

Returns a paginated list of order item objects ordered by id.

GET /v1/order-items

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

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\/order-items?page%5Bnumber%5D=1&page%5Bsize%5D=10&sort=id",
    "last": "https:\/\/api.lemonsqueezy.com\/v1\/order-items?page%5Bnumber%5D=1&page%5Bsize%5D=10&sort=id",
  },
  "data": [
    {
      "type": "order-items",
      "id": "1",
      "attributes": {
        "order_id": 1,
        "product_id": 1,
        "variant_id": 1,
        "product_name": "Example Product",
        "variant_name": "Example Variant",
        "price": 999,
        "created_at": "2021-05-24T14:15:06.000000Z",
        "updated_at": "2021-05-24T14:15:06.000000Z"
      },
      "relationships": {
        "order": {
          "links": {
            "related": "https:\/\/api.lemonsqueezy.com\/v1\/order-items\/1\/order",
            "self": "https:\/\/api.lemonsqueezy.com\/v1\/order-items\/1\/relationships\/order"
          }
        },
        "product": {
          "links": {
            "related": "https:\/\/api.lemonsqueezy.com\/v1\/order-items\/1\/product",
            "self": "https:\/\/api.lemonsqueezy.com\/v1\/order-items\/1\/relationships\/product"
          }
        },
        "variant": {
          "links": {
            "related": "https:\/\/api.lemonsqueezy.com\/v1\/order-items\/1\/variant",
            "self": "https:\/\/api.lemonsqueezy.com\/v1\/order-items\/1\/relationships\/variant"
          }
        }
      },
      "links": {
        "self": "https:\/\/api.lemonsqueezy.com\/v1\/order-items\/1"
      }
    },
    {...},
    {...},
  ]
}