The order object

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 all of them. Orders are identified by a unique ID.

Orders are automatically created during the redeem voucher and redeem promotion call.

Attributes

Description

Example

id
string

ord_iMsIlXpjfQwMWFJPEPJFeJ4h

object
string

String representing the object’s type. Objects of the same type share the same value. Value is order.

source_id
string

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_at
string, ISO 8601 date format

2016-11-16T14:14:31Z

updated_at
string, ISO 8601 date format

customer
object

The customer used for the order.

  "customer": {
    "object": "customer",
    "id": "cust_54euyQiFb4UYIP9wEOw7FgUA"
  }

status
string

Current order status. One of CREATED, PAID, CANCELED, FULFILLED, PROCESSING.

amount
integer

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_amount
integer

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_amount
integer

Summarize all discounts applied to the order inlcuding 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_amount
integer

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.

items
list

A list of Order Items that have been applied to the order. An item stores:

  • product_id
  • sku_id
  • 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 more
    • discount_amount defines the discount applied to the particular order line item
"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
    }
  ]

metadata
object

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"
}

referrer
object

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
}