Data model description
The purchase transactions can be tracked in Voucherify by the creation of an order object. You can create, retrieve, and pay individual orders, as well as list and export all of them in a CSV format. Orders are identified by a unique ID.
Orders are automatically created during the redeem voucher and redeem promotion call.
Attributes | Description | Example |
---|---|---|
idstring | ord_iMsIlXpjfQwMWFJPEPJFeJ4h | |
objectstring | String representing the object’s type. Objects of the same type share the same value. Value is order . | |
source_idstring | The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service. | |
created_atstring , ISO 8601 date format | 2016-11-16T14:14:31Z | |
updated_atstring , ISO 8601 date format | ||
customerobject | The customer used for the order. | "customer": { "object": "customer", "id": "cust_54euyQiFb4UYIP9wEOw7FgUA" } |
statusstring | Current order status. One of CREATED , PAID , CANCELED , FULFILLED , PROCESSING . | |
amountinteger | Represents a total amount of order items (sum of item.amount )Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000. | |
items_discount_amountinteger | Represents total amount of the discount applied to order line items Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000. | |
total_discount_amountinteger | Summarize all discounts applied to the order including discounts applied to particular order line items and discounts applied to the whole cart. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000. | |
total_amountinteger | Total order amount after applying all discounts. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000. | |
itemslist | A list of Order Items that have been applied to the order. An item stores:product_id sku_id quantity initial_quantity discount_quantity price amount (quantity price ) - you should provide it to retrieve discount_amount for a particular order item if the discount is applied only to this item learn morediscount_amount defines the discount applied to the particular order line iteminitial_amount * subtotal_amount | "items": [ { "sku_id": null, "quantity": 2, "product_id": "prod_anJ03RZZq74z4v", "price": 2000, "amount": 4000 }, { "sku_id": "sku_0KtP4rvwEECQ2U", "quantity": 1, "product_id": null, "price": 5000, "amount": 5000 } ] |
metadataobject | A set of key/value pairs that you can attach to an order object. It can be useful for storing additional information about the order in a structured format. | "metadata": { "test": true, "locale": "pl-en", "channel": "mobile_app" } |
referrerobject | The person who referred the customer to make the order. | "referrer": { "id": "cust_YOTqNoppN6sC1yepfElDL50S", "object": "customer" } |
{
"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"
},
{
"sku_id": "sku_0KtP4rvwEECQ2U",
"quantity": 1,
"product_id": null
}
],
"customer": {
"object": "customer",
"id": "cust_54euyQiFb4UYIP9wEOw7FgUA"
},
"metadata": null
}
order.id and order session
If you use the same order.id in more than one redemption request, all valid discounts provided in the redemption payload will be applied to the given order.
Each time you use particular order in your requests, the API will automatically trigger a new session linked to the order.id. The session is active during the request and ends asynchronously after the request is completed. The session mechanism ensures that the particular order.id can be used in one API request at once.