# Tracking Order Changes

Whenever you create and place an order, you need to be aware of potential changes to the order. These can range from the order moving throughout different fulfillment-states to potential price changes on the line items of your order. Here you will learn about two different methods on how you can always stay up to date on your orders.

There are two primary means of tracking changes to your order, both will be explained more in detail below:

  • Listening to change events using the Loom event system - This is the preferrred solution
  • Polling your orders in regular intervals

# When will an order change?

Below you will find a list of all potential factors that might cause an order or any order related entities (OrderLineItems, Deliveries, DeliveryLineItems) to change.

Cause Description
Order is moved into another state Whenever the order is moved into a new state
OrderLineItems become unavailable Whenever an order line item attached to a draft order will become unavailable, it will be automatically removed by us.
OrderLineItem prices change Whenever the price of an order line item attached to a draft order will change, it will be automatically changed by us.

Prices might also changed on order confirmation by the Supplier.
OrderLineItem attributes change Whenever any of the attributes of an order line item attached to a draft order will change, the OrderLineItem will be automatically changed by us.

# Listening to order events

The easiest way to track changes to your orders will be to use the Loom Event System (opens new window).

Whenever you receive an event regarding your orders, it will include the order_id as a reference that you can use to fetch the order details afterwards using the GET /orders/{order_id} endpoint (opens new window).

A full list of all events that will be send by the Procurement Application regarding Orders and OrderLineItems can be found here: Order Events (opens new window) & Order Line Item Events (opens new window)

# Example

The following event would be send to your webhook API endpoint in case the Supplier confirms your order with the id ffc75c94-aa79-450a-becc-2e398c079d93 for the Consumer with the id 2b271d51-e447-4a16-810f-5abdc596700a.

{
  "id": "62abcc92-e17e-4db0-b78e-13369251474b",
  "name": "procurement_consumer.order_confirmed",
  "subject": "Org/2b271d51-e447-4a16-810f-5abdc596700a",
  "timestamp": "2019-11-26T10:58:09.664Z",
  "version": "1.0",
  "payload": {
    "order_id": "ffc75c94-aa79-450a-becc-2e398c079d93" // The Order that was confirmed
  },
  "received_at": "2019-11-26T10:58:09.664Z"
}

# Polling your orders in regular intervals

The alternative to the method described above would be to regularly request your open orders and update them in your system accordingly.

You do not have to worry about potential performance impacts on the Zaikio Procurement Platform, we ensure that we are able to handle the extra load this might cause.