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_idstring | prod_anJ03RZZq74z4v | |
sku_idstring | sku_0KtP4rvwEECQ2U | |
related_objectstring | Used along source_id property, can be set either to sku or product | product |
source_idstring | 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 |
quantityinteger | 2 | |
initial_quantityinteger | initial quantity of the item in cart before the applied discount (i.e. excludes free items) | 1 |
discount_quantityinteger | number of items being discounted | 1 |
priceinteger | 1000 | |
amountinteger | 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 |
initial_amountinteger | initial amount spent on item prior to applying discount | 10 |
subtotal_amountinteger | final item amount (price*quantity) after applied discount that will be added to the total order amount | 5 |
productobject | 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 : stringmetadata : object* override : true / falseThe 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" } } |
skuobject | 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 : stringoverride : true / falseThe 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" } |
metadataobject | 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
}