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 |
| |
sku_id |
| |
related_object | Used along |
|
source_id | 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. |
|
quantity | 2 | |
initial_quantity | initial quantity of the item in cart before the applied discount (i.e. excludes free items) | 1 |
discount_quantity | number of items being discounted | 1 |
price | 1000 | |
amount | Represents a total amount of order item (price * quantity). You should provide it to retrieve | 2000 |
initial_amount | initial amount spent on item prior to applying discount | 10 |
subtotal_amount | final item amount (price*quantity) after applied discount that will be added to the total order amount | 5 |
product | 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.
The |
|
sku | 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.
The |
|
metadata | Gathers custom attributes in key/value pairs assigned to order item as metadata. |
|
{
"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
}