Line items describe purchasable items and are used in cart and order-related interactions.
| Field Name | Field Type | Description |
|---|---|---|
attributes |
object | A dictionary of user-supplied key-value pairs that to add more detail, such as {"color": "blue"} |
catalogObjectType |
string | Required. A type name representing the catalog object referenced in the line item. For example, Product, and SKU. |
catalogObjectId |
string | Required. A unique ID representing the catalog object referenced in the line item. |
currency |
string | The currency for the price field. For example, USD, and GBP. |
price |
number | The price of the catalog object referenced in the line item. |
quantity |
number | Required. The number of catalog objects in this line item. |
Line Item Attribute Example for iOS
Here's an example of a LineItem for iOS.
LineItem(
catalogObjectType: "Product",
catalogObjectId: "product-11",
quantity: 1,
price: 20.0,
currency: "USD",
attributes: [
"gift_wrap: true
]
)
Line Item Attribute Example for Android
Here's an example of a LineItem for Android.
LineItem(
catalogObjectId = "product-1",
catalogObjectType = "Product",
quantity = 1,
price = 20.0,
currency = "USD",
attributes = mapOf(
"gift_wrap" to true
)
)