Retrieving order information

To retrieve order information, send a GET request to /api/orders/{orderId} or /api/orders/{orderUuid}. The response will be a JSON object with order information.

Note that this information is slightly different from the way you send it to create the order:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
{
  "id": 1234567,
  "number": "DDB1234567",
  "status": "in-progress",
  "date": "2017-08-23T16:24:23+02:00",
  "lines": [
    {
      "id": 5178124,
      "description": "Accessoires buitenreclame, Spinhaken 25cm (10 stuks), 1 stuk",
      "price": 100,
      "deliveryMethod": "Standard",
      "deliveryDate": "2017-08-23T16:28:14+02:00",
      "revisedDeliveryDate": "2017-08-29T16:28:14+02:00",
      "productCode": "CS:92.1-B:35.40.183.217.527.1256.1920.2009",
      "beforeDelivery": null,
      "vatAmount": 21,
      "vatPercentage": 21,
      "quantity": 1,
      "addressInfo": 123456,
      "status": "in-progress",
      "shipmentInfo": null,
      "customerDiscount": {
        "discountAmount": 7,
        "discountTaxAmount": 1.47
      },
      "shippingCost": 0
    },
    {
      "id": 5178125,
      "description": "Accessoires buitenreclame, Rakel, 1 stuk",
      "price": 104.75,
      "deliveryMethod": "Standard",
      "deliveryDate": "2017-08-23T16:28:14+02:00",
      "revisedDeliveryDate": "2017-08-29T16:28:14+02:00",
      "productCode": "CS:92.1-B:35.40.183.217.527.1255.1905.2009",
      "beforeDelivery": null,
      "vatAmount": 22,
      "vatPercentage": 21,
      "quantity": 1000,
      "addressInfo": 123456,
      "status": "shipped",
      "shipmentInfo": [
        {
          "labelName": "Your Name Here",
          "street": "Dorpsstraat",
          "houseNumber": "123",
          "houseNumberAddition": "a",
          "zipCode": "1234AB",
          "city": "City",
          "country": "NL",
          "shippingCost": 0,
          "trackAndTraceUrl": [
            {
              "http://www.example.com/track-and-trace"
            }
          ]
        }
      ],
      "customerDiscount": {
        "discountAmount": 7.33,
        "discountTaxAmount": 1.54
      }
    },
    {
      "id": "10004274-3",
      "description": "Hybrid merch name",
      "price": 30.6,
      "deliveryMethod": "Standard",
      "deliveryDate": "2020-09-07T00:00:00+02:00",
      "revisedDeliveryDate": "2020-09-29T16:28:14+02:00",
      "productCode": "CS:92.1-B:35.40.183.217.527.1255.1905.2009",
      "beforeDelivery": null,
      "vatAmount": 6.43,
      "vatPercentage": 21,
      "quantity": 100,
      "addressInfo": 1234,
      "status": "shipped",
      "shipmentInfo": [],
      "customerDiscount": {
        "discountAmount": 2.14,
        "discountTaxAmount": 0.45
      },
      "shippingCost": 0,
      "externalId": null
    }
  ],
  "deliveryAddress": 13245,
  "reference": "reference",
  "poNumber": "poNumber",
  "vatAmount": 45.97,
  "uuid": null,
  "total": 218.88
}

VAT amounts and total

Each orderline contains a vatAmount field with the VAT for that product. There is also a vatAmount field for the entire order. This total VAT amount also includes VAT for shipping costs and payment costs. This is why the value is different from the sum of VAT per order line. Please note that this total VAT amount is calculated after customer discounts have been subtracted, if applicable.

The total field contains the total amount for the order, including VAT, payment costs, shipping costs, customer discounts and coupons if used.

Customer Discount

Each orderline contains a customer discount field which will show how much discount is applied on order line. In case of customer discount is not present then it will be null.

How it gets calculated -

For example orderLine price is 100 and vatAmount is 21 as per 21% vatAmountPercentage.

So if customer have 7% of discount then customerDiscount will show discountAmount & discountTaxAmount.

discountAmount will be 7 on price so final price will be 93. (100 - 7 = 93)

discountTaxAmount will be 1.47 on vatAmount so final vatAmount will be 19.53. (21 - 1.47 = 19.53)

Order has failed

The Printdeal API was updated at 21 December 2018 around 13:00, after this time, when an order creation failed, you now receive an 404 result, with an error message that the order creation has failed. Orders that failed before this date and time will have a 404 not found response.

Delivery date get revised

In some cases delivery date may get revised. So in such case for each orderline have revisedDeliveryDate which shows revised delivery date for orderline. If no change in delivery date then it will be null.

Example request for retrieving order information

The following PHP code can be used for retrieve order information. Make sure you replace the values YOUR_USER_ID_HERE and YOUR_SECRET_HERE with the User-ID and secret you received on the API-credentials page, and{orderId} with the corresponding orderId or orderUuid.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => "https://api.printdeal.com/api/orders/{orderId}",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => array(
        "User-ID: YOUR_USER_ID_HERE",
        "API-Secret: YOUR_SECRET_HERE",
        "Accept: application/vnd.printdeal-api.v2"
    )
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
    echo "cURL Error #:" . $err;
} else {
    echo $response;
}