The order item object

Data model description

Order Items are always specified within the order object. They can be related either to products or SKUs.

Product/SKU details sent within an order item will be used on top of Product/SKU already stored in the system during the Redeem Voucher, Validate Voucher, Validate Promotions and Redeem Promotion requests - details in the table below.

Attributes

Description

Example

product_id
string

prod_anJ03RZZq74z4v

sku_id
string

sku_0KtP4rvwEECQ2U

related_object
string

Used along source_id property, can be set either to sku or product

product

source_id
string

The merchant’s product/SKU ID (if it is different from the Voucherify product/SKU ID). It is really useful in case of integration between multiple systems. It can be an ID from an eCommerce, a database or a 3rd party service.

product_1234

quantity
integer

2

price
integer

1000

amount
integer

Represents a total amount of order item (price * quantity).

You should provide it to retrieve discount_amount if the discount is applied only to this item.

2000

discount_amount

Defines the amount of discount applied to the particular order line item

1000

product
object

An object containing details of related product. Those details will be used for validation and redemption processes on top of details already stored in system.

  • name: string
  • metadata: object
  • override: true / false

The override is used once the product should be stored in system. If product does not exists it will be created with the use of source_id

"product": {
  "override": true,
  "name": "Apple iPhone 8",
  "metadata": {
    "shop": "citycenter"
  }
}

sku
object

An object containing details of related SKU. Those details will be used for validation and redemption processes on top of details already stored in system.

  • sku: string
  • override: true / false

The override is used once the product should be stored in system. If sku does not exists it will be created with the use of source_id. If sku does not exists it's required to set product_id that it belongs to.

"sku": {
  "override": true,
  "sku": "Apple iPhone 8 Silver 64GB"
}

metadata
object

Gathers custom attributes in key/value pairs assigned to order item as metadata.

"metadata":{
   "test": true
}
{
    "id": "ord_Rm1hlzO0jUyci39LoowoJqND",
    "source_id": null,
    "object": "order",
    "created_at": "2017-05-24T15:27:41.008Z",
    "updated_at": null,
    "status": "CREATED",
    "amount": 20050,
    "items": [
        {
            "sku_id": null,
            "quantity": 2,
            "product_id": "prod_anJ03RZZq74z4v",
            "product": {
                "override": true,
                "name": "Apple iPhone 8",
                "metadata": {
                    "shop": "citycenter"
                }
            },
            "metadata": {
                "series": "2022-783CV"
            }
        },
        {
            "sku_id": "sku_0KtP4rvwEECQ2U",
            "quantity": 1,
            "product_id": null,
            "sku": {
                "override": true,
                "sku": "Apple iPhone 8 Silver 64GB"
            }
        }
    ],
    "customer": {
        "object": "customer",
        "id": "cust_54euyQiFb4UYIP9wEOw7FgUA"
    },
    "metadata": null
}