REST API

Documentation


Payment

Print API offers two different ways to pay for orders. If you have your own payment system, you can choose to periodically receive an invoice. In that case, you can skip this step.

Read more about the payment methods in our FAQ.
Optional Payment links

To generate a payment link for an order, simply POST the payment details to the set-up URL of the order. You can obtain this set-up URL in the HTTP response when placing the order, from the field checkout.setupUrl. Pricing can be configured per product from your account.

Request:
POST /v2/checkout/5L2zKMnOqp6A15GoP909Z HTTP/1.1
Authorization: Bearer TOKEN
Accept: application/json
Content-Type: application/json

{
  "returnUrl": "http://localhost/example?order_id=83432183",                 
  "billing": {
    "address": {
      "name": "John Doe",
      "line1": "Osloweg 75",
      "postCode": "9700 GE",
      "city": "Groningen",
      "country": "NL"
    }
  }
}
Special fields:
Name Details
"returnUrl" The URL where your user will return after payment
address["country"] A ISO 3166-1 alpha 2 country code

The API response contains a field named paymentUrl. Redirect your user to this URL: this is the payment screen of the order. In the test environment you'll be directed to the test payment screen, where you can skip the actual payment and simply choose between success and failure.

Response:
HTTP/1.1 201 Created                 
Content-Type: application/json;charset=UTF-8
Content-Length: 508
Location: https://test.printapi.nl/v2/checkout/5L2zKMnOqp6A15GoP909Z
            
{                               
  "status": "Open",
  "amount": 22.49,   
  "paymentUrl": "https://test.printapi.nl/v2/payments/0WIqo9FoUv2xwMI6Bzuo/start",
  "returnUrl": "http://localhost/voorbeeld?order_id=83432183",
  "billing": {
    "address": {
      "email": "info@printapi.nl",
      "name": "Print API",
      "line1": "Osloweg 75",
      "postCode": "9700 GE",
      "city": "Groningen",
      "country": "NL"
    }
  }
}

If your user completes or cancels the payment, they will be redirected to the returnUrl you supplied in the POST. On that page, you can request the payment status from the API, as shown in the example below. If the payment was not completed, the paymentUrl remains available for up to 24 hours.

Request:
GET /v2/orders/83432183 HTTP/1.1
Authorization: Bearer TOKEN
Accept: application/json

The payment status is found in the field checkout.status of the API response. This is also where the paymentUrl can be found again, at checkout.paymentUrl. Refer to the API reference for the full list of fields. The following payment statuses may occur:

Statussen:
"Open" The payment is pending. Its paymentUrl remains valid for up to 24 hours.
"Successful" The payment has been completed.
"Cancelled" The paymentUrl has expired and/or the order has been cancelled.
Print API also has webhooks to automatically notify your server of status changes. More on that in the next step!
Next