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 |
|
|
id |
| The line item unique identifier |
links.self |
| The line item endpoint URL |
attributes.sku_code |
| The code of the associated SKU. |
attributes.bundle_code |
| The code of the associated bundle. |
attributes.quantity |
| The line item quantity. |
attributes._external_price |
| 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 |
| 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 |
| 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 |
| The international 3-letter currency code as defined by the ISO 4217 standard, automatically inherited from the order's market. |
attributes.unit_amount_cents |
| 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 |
| 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 |
| 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 |
| The compared price amount, in cents. Useful to display a percentage discount. |
attributes.compare_at_amount_float |
| The compared price amount, float. |
attributes.formatted_compare_at_amount |
| The compared price amount, formatted. |
attributes.options_amount_cents |
| The options amount of the line item, in cents. Cannot be passed by sales channels. |
attributes.options_amount_float |
| The options amount of the line item, float. |
attributes.formatted_options_amount |
| The options amount of the line item, formatted. |
attributes.discount_cents |
| 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 |
| 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 |
| 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 |
| Calculated as unit amount x quantity + options amount, in cents. |
attributes.total_amount_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 |
| 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 |
| The collected tax amount, otherwise calculated as total amount cents - discount cent * tax rate, in cents. |
attributes.tax_amount_float |
| The collected tax amount, otherwise calculated as total amount cents - discount cent * tax rate, float. |
attributes.formatted_tax_amount |
| The collected tax amount, otherwise calculated as total amount cents - discount cent * tax rate, formatted. |
attributes.name |
| The name of the line item. When blank, it gets populated with the name of the associated item (if present). |
attributes.image_url |
| 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 |
| The discount breakdown for this line item (if calculated). |
attributes.tax_rate |
| The tax rate for this line item (if calculated). |
attributes.tax_breakdown |
| The tax breakdown for this line item (if calculated). |
attributes.item_type |
| 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 |
| The frequency which generates a subscription. Must be supported by existing associated subscription_model. |
attributes.coupon_code |
| 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 |
| 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 |
| 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 |
| 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 |
| Time at which the resource was created. |
attributes.updated_at |
| Time at which the resource was last updated. |
attributes.reference |
| 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 |
| Any identifier of the third party system that defines the reference code. |
attributes.metadata |
| 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 |
| The associated order. |
relationships.item |
| 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 |
| The associated sku item. |
relationships.bundle |
| The associated bundle item. |
relationships.adjustment |
| The associated adjustment item. |
relationships.gift_card |
| The associated gift card item. |
relationships.shipment |
| The associated shipment item. |
relationships.payment_method |
| The associated payment method item. |
relationships.line_item_options |
| The associated line item options. |
relationships.return_line_items |
| The associated return line items. |
relationships.stock_reservations |
| The associated stock reservations. |
relationships.stock_line_items |
| The associated stock line items. |
relationships.stock_transfers |
| The associated stock transfers. |
relationships.notifications |
| The associated notifications. |
relationships.events |
| The associated events. |
relationships.tags |
| The associated tags. Cannot be passed by sales channels. |
meta.mode |
| The resource environment (can be one of |
Last updated