Orders
In Lemon Squeezy, an order is created when a customer purchases a product.
An order belongs to a Store, is associated with a Customer and can have many Order Items, Subscriptions, License Keys and Discount Redemptions.
The order object
Attributes
store_id
The ID of the store this order belongs to.
customer_id
The ID of the customer 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. USD
, GBP
, 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.
setup_fee
A positive integer in cents representing the setup fee 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.
refunded_amount
A positive integer in cents representing the refunded amount of the order in the order currency.
subtotal_usd
A positive integer in cents representing the subtotal of the order in USD.
setup_fee_usd
A positive integer in cents representing the setup fee 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.
refunded_amount_usd
A positive integer in cents representing the refunded amount of the order in USD.
tax_name
The name of the tax rate (e.g. VAT
, Sales Tax
, etc) applied to the order. Will be null
if no tax was applied.
tax_rate
If tax is applied to the order, this will be the rate of tax as a decimal percentage.
tax_inclusive
A boolean indicating if the order was created with tax inclusive or exclusive pricing.
status
The status of the order. One of
pending
failed
paid
refunded
partial_refund
status_formatted
The formatted status of the order.
refunded
Has the value true
if the order has been fully refunded.
refunded_at
If the order has been fully refunded, this will be an ISO 8601 formatted date-time string indicating when the order was refunded.
subtotal_formatted
A human-readable string representing the subtotal of the order in the order currency (e.g. $9.99).
setup_fee_formatted
A human-readable string representing the setup fee of the order in the order currency (e.g. $9.99).
discount_total_formatted
A human-readable string representing the total discount value applied to the order in the order currency (e.g. $9.99).
tax_formatted
A human-readable string representing the tax applied to the order in the order currency (e.g. $9.99).
total_formatted
A human-readable string representing the total cost of the order in the order currency (e.g. $9.99).
refunded_amount_formatted
A human-readable string representing the refunded amount of the order in the order currency (e.g. $9.99).
first_order_item
An object representing the first order item belonging to this order.
id
- The ID of the order item.order_id
- The ID of the order.product_id
- The ID of the product.variant_id
- The ID of the product variant.product_name
- The name of the product.variant_name
- The name of the product variant.price
- A positive integer in cents representing the price of the order item in the order currency.created_at
- An ISO 8601 formatted date-time string indicating when the order item was created.updated_at
- An ISO 8601 formatted date-time string indicating when the order item was last updated.test_mode
- A boolean indicating if the order was made in test mode.
urls
An object of customer-facing URLs for this order. It contains:
receipt
- A pre-signed URL for viewing the order in the customer's My Orders page.
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.
test_mode
A boolean indicating if the object was created within test mode.
Order object
Retrieve an order
Retrieves the order with the given ID.
GET /v1/orders/:id
Returns
Returns an order object.
Response
List all orders
Returns a paginated list of orders.
Parameters
store_id
Only return orders belonging to the store with this ID.
user_email
Only return orders where the user_email
field is equal to this email address.
GET /v1/orders
Returns
Returns a paginated list of order objects ordered by created_at
(descending).
Response
Generate order invoice
Generates a new invoice for the given order with given parameters.
Attributes
name
Optional. The full name of the customer.
address
Optional. The street address of the customer.
city
Optional. The city of the customer.
state
Optional. The state of the customer.
zip_code
Optional. The ZIP code of the customer.
country
Optional. The country of the customer.
notes
Optional. Any additional notes to include on the invoice.
POST /v1/orders/:id/generate-invoice
Returns
Returns a link to download the generated invoice.
Response
Issue a refund
Issues a partial refund for an order.
Attributes
amount
Required. The amount that you want to refund for an order.
POST /v1/orders/:id/refund
Returns
Returns an order object.