REST API

Documentation


Statuses

Print API distinguishes four order statuses. If you use our payment screen, there is also a separate payment status. Both the order status as the payment status can be requested from the API. Print API also has webhooks to automatically notify your server of status changes.

Example

To obtain the latest order or payment status from the API, you need the ID of the associated order. Simply send an HTTP get to the URL of the order: v2/orders/{id}. Replace {id} by the ID of the order.

$order = $api->get('/orders/' . $id);

echo $order->status . '<br />';
echo isset($order->checkout) ? $order->checkout->status : 'Payment screen not used';

Print API distinguishes the following order statuses:

Created Order created but is awaiting files and/or payment.
Processing Order is being processed.
Shipped Order has been shipped to the recipient.
Cancelled Order has been cancelled.

In addition, Print API distinguishes the following payment statuses:

Open Payment incomplete. The paymentUrl remains available for up to 24 hours.
Successful Payment successfully completed.
Cancelled The paymentUrl has expired and the order has been cancelled.
Webhooks

You can use our webhooks to let Print API automatically notify your server when the status of an order or payment changes. It's essentially a push notification over HTTP. You can configure the URLs of your application's webhooks in your settings. We never send sensitive data to your webhook URLs, so HTTPS is optional.

Webhook call:
POST /your-webhook-url HTTP/1.1
Content-Type: application/x-www-form-urlencoded

orderId=59802395

The request body only contains an order ID. You can use this order ID to request the latest status from the API, as explained previously. This intermediate step may seem a little cumbersome, but it prevents random people from calling your webhook with false information.

Example webhook script:
$id = urlencode($_POST['orderId']);
$order = $api->get('/orders/' . $id);

// ...process $order->status...

Your webhook only has to return the HTTP status code 200 OK. This lets Print API know the call was processed successfully. If your webhook returns another status code, like 503 Service Unavailable, Print API will try again up to 9 times:

  • First failure: new attempt after ± 2 minutes
  • Second failure: new attempt after ± 5 minutes
  • Subsequently: new attempt after ± 60 minutes, up to 7 times

You will automatically be notified per e-mail when a call to your webhook fails for the first time. You'll be notified again if the request failed ten times in succession and won't be attempted again.

Next