The line item object

A comprehensive list of the line item resource's attributes and relationships

A line item object is returned as part of the response body of each successful list, retrieve, create or update API call to the /api/line_items endpoint.

Fields

Field
Type
Description

type

string

line_items

id

string

The line item unique identifier

links.self

string

The line item endpoint URL

attributes.sku_code

string

The code of the associated SKU.

attributes.bundle_code

string

The code of the associated bundle.

attributes.quantity

integer

The line item quantity.

attributes._external_price

boolean

When creating or updating a new line item, set this attribute to '1' if you want to inject the unit_amount_cents price from an external source. Any successive price computation will be done externally, until the attribute is reset to '0'.

attributes._update_quantity

boolean

When creating a new line item, set this attribute to '1' if you want to update the line item quantity (if present) instead of creating a new line item for the same SKU.

attributes._reserve_stock

boolean

Send this attribute if you want to reserve the stock for the line item's SKUs quantity. Stock reservations expiration depends on the inventory model's cutoff. When used on update the existing active stock reservations are renewed. Cannot be passed by sales channels.

attributes.currency_code

string

The international 3-letter currency code as defined by the ISO 4217 standard, automatically inherited from the order's market.

attributes.unit_amount_cents

integer

The unit amount of the line item, in cents. Can be specified only via an integration application, or when the item is missing, otherwise is automatically computed by using one of the available methods. Cannot be passed by sales channels.

attributes.unit_amount_float

float

The unit amount of the line item, float. This can be useful to track the purchase on thrid party systems, e.g Google Analyitcs Enhanced Ecommerce.

attributes.formatted_unit_amount

string

The unit amount of the line item, formatted. This can be useful to display the amount with currency in you views.

attributes.compare_at_amount_cents

integer

The compared price amount, in cents. Useful to display a percentage discount.

attributes.compare_at_amount_float

float

The compared price amount, float.

attributes.formatted_compare_at_amount

string

The compared price amount, formatted.

attributes.options_amount_cents

integer

The options amount of the line item, in cents. Cannot be passed by sales channels.

attributes.options_amount_float

float

The options amount of the line item, float.

attributes.formatted_options_amount

string

The options amount of the line item, formatted.

attributes.discount_cents

integer

The discount applied to the line item, in cents. When you apply a discount to an order, this is automatically calculated basing on the line item total_amount_cents value.

attributes.discount_float

float

The discount applied to the line item, float. When you apply a discount to an order, this is automatically calculated basing on the line item total_amount_cents value.

attributes.formatted_discount

string

The discount applied to the line item, fromatted. When you apply a discount to an order, this is automatically calculated basing on the line item total_amount_cents value.

attributes.total_amount_cents

integer

Calculated as unit amount x quantity + options amount, in cents.

attributes.total_amount_float

float

Calculated as unit amount x quantity + options amount, float. This can be useful to track the purchase on thrid party systems, e.g Google Analyitcs Enhanced Ecommerce.

attributes.formatted_total_amount

string

Calculated as unit amount x quantity + options amount, formatted. This can be useful to display the amount with currency in you views.

attributes.tax_amount_cents

integer

The collected tax amount, otherwise calculated as total amount cents - discount cent * tax rate, in cents.

attributes.tax_amount_float

float

The collected tax amount, otherwise calculated as total amount cents - discount cent * tax rate, float.

attributes.formatted_tax_amount

string

The collected tax amount, otherwise calculated as total amount cents - discount cent * tax rate, formatted.

attributes.name

string

The name of the line item. When blank, it gets populated with the name of the associated item (if present).

attributes.image_url

string

The image_url of the line item. When blank, it gets populated with the image_url of the associated item (if present, SKU only).

attributes.discount_breakdown

object

The discount breakdown for this line item (if calculated).

attributes.tax_rate

float

The tax rate for this line item (if calculated).

attributes.tax_breakdown

object

The tax breakdown for this line item (if calculated).

attributes.item_type

string

The type of the associated item. One of 'skus', 'bundles', 'gift_cards', 'shipments', 'payment_methods', 'adjustments', 'discount_engine_items', 'percentage_discount_promotions', 'free_shipping_promotions', 'buy_x_pay_y_promotions', 'free_gift_promotions', 'fixed_price_promotions', 'external_promotions', 'fixed_amount_promotions', or 'flex_promotions'.

attributes.frequency

string

The frequency which generates a subscription. Must be supported by existing associated subscription_model.

attributes.coupon_code

string

The coupon code, if any, used to trigger this promotion line item. null for other line item types or if the promotion line item wasn't triggered by a coupon.

attributes.circuit_state

string

The circuit breaker state, by default it is 'closed'. It can become 'open' once the number of consecutive failures overlaps the specified threshold, in such case no further calls to the failing callback are made.

attributes.circuit_failure_count

integer

The number of consecutive failures recorded by the circuit breaker associated to this resource, will be reset on first successful call to callback.

attributes._reset_circuit

boolean

Send this attribute if you want to reset the circuit breaker associated to this resource to 'closed' state and zero failures count. Cannot be passed by sales channels.

attributes.created_at

datetime

Time at which the resource was created.

attributes.updated_at

datetime

Time at which the resource was last updated.

attributes.reference

string

A string that you can use to add any external identifier to the resource. This can be useful for integrating the resource to an external system, like an ERP, a marketing tool, a CRM, or whatever.

attributes.reference_origin

string

Any identifier of the third party system that defines the reference code.

attributes.metadata

object

Set of key-value pairs that you can attach to the resource. This can be useful for storing additional information about the resource in a structured format.

relationships.order

object

The associated order.

relationships.item

object

The polymorphic item associated to the line item. One of 'skus', 'bundles', 'gift_cards', 'shipments', 'payment_methods', 'adjustments', 'discount_engine_items', 'percentage_discount_promotions', 'free_shipping_promotions', 'buy_x_pay_y_promotions', 'free_gift_promotions', 'fixed_price_promotions', 'external_promotions', 'fixed_amount_promotions', or 'flex_promotions'.

relationships.sku

object

The associated sku item.

relationships.bundle

object

The associated bundle item.

relationships.adjustment

object

The associated adjustment item.

relationships.gift_card

object

The associated gift card item.

relationships.shipment

object

The associated shipment item.

relationships.payment_method

object

The associated payment method item.

relationships.line_item_options

array

The associated line item options.

relationships.return_line_items

array

The associated return line items.

relationships.stock_reservations

array

The associated stock reservations.

relationships.stock_line_items

array

The associated stock line items.

relationships.stock_transfers

array

The associated stock transfers.

relationships.notifications

array

The associated notifications.

relationships.events

array

The associated events.

relationships.tags

array

The associated tags. Cannot be passed by sales channels.

meta.mode

string

The resource environment (can be one of test or live)

Last updated