Orders

In Lemon Squeezy, an order is created when a customer purchases a product.

An order belongs to a Store and can have many Order Items, Subscriptions and License Keys.

The order object

Attributes

store_id

The ID of the store this order belongs to.

identifier

The unique identifier (UUID) for this order.

order_number

An integer representing the sequential order number for this store.

user_name

The full name of the customer.

user_email

The email address of the customer.

currency

The ISO 4217 currency code for the order (e.g. USDGBP, etc).

currency_rate

If the order currency is USD, this will always be 1.0. Otherwise, this is the currency conversion rate used to determine the cost of the order in USD at the time of purchase.

subtotal

A positive integer in cents representing the subtotal of the order in the order currency.

discount_total

A positive integer in cents representing the total discount value applied to the order in the order currency.

tax

A positive integer in cents representing the tax applied to the order in the order currency.

total

A positive integer in cents representing the total cost of the order in the order currency.

subtotal_usd

A positive integer in cents representing the subtotal of the order in USD.

discount_total_usd

A positive integer in cents representing the total discount value applied to the order in USD.

tax_usd

A positive integer in cents representing the tax applied to the order in USD.

total_usd

A positive integer in cents representing the total cost of the order in USD.

tax_name

If tax is applied to the order, this will be the name of the tax rate (e.g. VATSales Tax, etc).

tax_rate

If tax is applied to the order, this will be the rate of tax as a decimal percentage.

status

The status of the order. One of pendingfailedpaidrefunded.

status_formatted

The formatted status of the order.

refunded

Has the value true if the order has been refunded.

refunded_at

If the order has been refunded, this will be an ISO-8601 formatted date-time string indicating when the order was refunded.

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 object

{
  "type": "orders",
  "id": "1",
  "attributes": {
    "store_id": 1,
    "identifier": "104e18a2-d755-4d4b-80c4-a6c1dcbe1c10",
    "order_number": 1,
    "user_name": "Darlene Daugherty",
    "user_email": "gernser@yahoo.com",
    "currency": "USD",
    "currency_rate": "1.0000",
    "subtotal": 999,
    "discount_total": 0,
    "tax": 200,
    "total": 1199,
    "subtotal_usd": 999,
    "discount_total_usd": 0,
    "tax_usd": 200,
    "total_usd": 1199,
    "tax_name": "VAT",
    "tax_rate": "20.00",
    "status": "paid",
    "status_formatted": "Paid",
    "refunded": 0,
    "refunded_at": null,
    "created_at": "2021-08-17T09:45:53.000000Z",
    "updated_at": "2021-08-17T09:45:53.000000Z"
  }
}

Retrieve an order

Retrieves the order with the given ID.

Returns

Returns an order object.

GET /v1/orders/:id

curl "https://api.lemonsqueezy.com/v1/orders/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\/orders\/1"
  },
  "data": {
    "type": "orders",
    "id": "1",
    "attributes": {
      "store_id": 1,
      "identifier": "104e18a2-d755-4d4b-80c4-a6c1dcbe1c10",
      "order_number": 1,
      "user_name": "Darlene Daugherty",
      "user_email": "gernser@yahoo.com",
      "currency": "USD",
      "currency_rate": "1.0000",
      "subtotal": 999,
      "discount_total": 0,
      "tax": 200,
      "total": 1199,
      "subtotal_usd": 999,
      "discount_total_usd": 0,
      "tax_usd": 200,
      "total_usd": 1199,
      "tax_name": "VAT",
      "tax_rate": "20.00",
      "status": "paid",
      "status_formatted": "Paid",
      "refunded": 0,
      "refunded_at": null,
      "created_at": "2021-08-17T09:45:53.000000Z",
      "updated_at": "2021-08-17T09:45:53.000000Z"
    },
    "relationships": {
      "store": {
        "links": {
          "related": "https:\/\/api.lemonsqueezy.com\/v1\/orders\/1\/store",
          "self": "https:\/\/api.lemonsqueezy.com\/v1\/orders\/1\/relationships\/store"
        }
      },
      "order-items": {
        "links": {
          "related": "https:\/\/api.lemonsqueezy.com\/v1\/orders\/1\/order-items",
          "self": "https:\/\/api.lemonsqueezy.com\/v1\/orders\/1\/relationships\/order-items"
        }
      },
      "subscriptions": {
        "links": {
          "related": "https:\/\/api.lemonsqueezy.com\/v1\/orders\/1\/subscriptions",
          "self": "https:\/\/api.lemonsqueezy.com\/v1\/orders\/1\/relationships\/subscriptions"
        }
      },
      "license-keys": {
        "links": {
          "related": "https:\/\/api.lemonsqueezy.com\/v1\/orders\/1\/license-keys",
          "self": "https:\/\/api.lemonsqueezy.com\/v1\/orders\/1\/relationships\/license-keys"
        }
      }
    },
    "links": {
      "self": "https:\/\/api.lemonsqueezy.com\/v1\/orders\/1"
    }
  }
}

List all orders

Returns a paginated list of orders.

Parameters

store_id

Only return orders belonging to the store with this ID.

Returns

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

GET /v1/orders

curl "https://api.lemonsqueezy.com/v1/orders" \
     -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\/orders?page%5Bnumber%5D=1&page%5Bsize%5D=10&sort=-createdAt",
    "last": "https:\/\/api.lemonsqueezy.com\/v1\/orders?page%5Bnumber%5D=1&page%5Bsize%5D=10&sort=-createdAt"
  },
  "data": [
    {
      "type": "orders",
      "id": "1",
      "attributes": {
        "store_id": 1,
        "identifier": "104e18a2-d755-4d4b-80c4-a6c1dcbe1c10",
        "order_number": 1,
        "user_name": "Darlene Daugherty",
        "user_email": "gernser@yahoo.com",
        "currency": "USD",
        "currency_rate": "1.0000",
        "subtotal": 999,
        "discount_total": 0,
        "tax": 200,
        "total": 1199,
        "subtotal_usd": 999,
        "discount_total_usd": 0,
        "tax_usd": 200,
        "total_usd": 1199,
        "tax_name": "VAT",
        "tax_rate": "20.00",
        "status": "paid",
        "status_formatted": "Paid",
        "refunded": 0,
        "refunded_at": null,
        "created_at": "2021-08-17T09:45:53.000000Z",
        "updated_at": "2021-08-17T09:45:53.000000Z"
      },
      "relationships": {
        "store": {
          "links": {
            "related": "https:\/\/api.lemonsqueezy.com\/v1\/orders\/1\/store",
            "self": "https:\/\/api.lemonsqueezy.com\/v1\/orders\/1\/relationships\/store"
          }
        },
        "order-items": {
          "links": {
            "related": "https:\/\/api.lemonsqueezy.com\/v1\/orders\/1\/order-items",
            "self": "https:\/\/api.lemonsqueezy.com\/v1\/orders\/1\/relationships\/order-items"
          }
        },
        "subscriptions": {
          "links": {
            "related": "https:\/\/api.lemonsqueezy.com\/v1\/orders\/1\/subscriptions",
            "self": "https:\/\/api.lemonsqueezy.com\/v1\/orders\/1\/relationships\/subscriptions"
          }
        },
        "license-keys": {
          "links": {
            "related": "https:\/\/api.lemonsqueezy.com\/v1\/orders\/1\/license-keys",
            "self": "https:\/\/api.lemonsqueezy.com\/v1\/orders\/1\/relationships\/license-keys"
          }
        }
      },
      "links": {
        "self": "https:\/\/api.lemonsqueezy.com\/v1\/orders\/1"
      }
    },
    {...},
    {...},
  ]
}