In this guide you can read how to print a file that is hosted by Peecho. This tutorial takes you through the process of uploading your file on the Peecho servers and then placing print orders from it. With this approach you can print the same document as many times as you like, without uploading the file every time.


Before you can start using Peecho’s print API, you need to do two things:
    • Register

The first step is creating a Peecho account. You can create your Peecho account here.

    • Top up your balance

In order to print your products, first you have to make sure you have some credit on your account. To do this, you have to log in and go to your dashboard. Click on ”Money” in the top menu and then click on ”Deposit” in the drop down menu. When you click on the green ”+ Buy credit” button, you can top-up your balance. You can pay with MasterCard, Visa, iDeal or PayPal.

1. Upload your document

First you have  to upload your document to the Peecho system. You can find all your uploaded files by clicking on ”Publications” in the top menu of your dashboard.

POST /rest/storage/createPublicationFromUpload



sourceUrlYesThe full URL to the source document
applicationApiKeyYesUnique string identifier of the application
curl -v -d "sourceUrl={yourSourceUrl}&applicationApiKey={yourApplicationApiKey}" ""


Service returns publication number


2. Choose product

The next step is to select what kind of product you want to offer in print. Not all available products are valid for each file you uploaded. To see offerings suitable for your document you should call this API method:

GET /rest/offering/list/publication/{publicationId}


publicationIdYesUnique string identifier of the publication.
applicationApiKeyYesUnique string identifier of the application.
curl -v "{yourApplicationApiKey}&numberOfPages=40&fileType=PDF"


The response is exactly the same as the response for accessing an unfiltered offering list.


<?xml version="1.0"?>
         <name>boek a5</name>
            <value amount="1.00" currency="EUR"/>
            <value amount="1.37" currency="USD"/>
            <value amount="0.00" currency="EUR"/>
            <value amount="0.00" currency="USD"/>
            <value amount="0.00" currency="EUR"/>
            <value amount="0.00" currency="USD"/>
            <value amount="0.00" currency="EUR"/>
            <value amount="0.00" currency="USD"/>
            <value amount="0.00" currency="EUR"/>
            <value amount="0.00" currency="USD"/>
         <catalogueItemCode>boek a5</catalogueItemCode>


3. Create an order

Once you decided which product you want to print, it is time to place an order. You can do this by calling this method:

POST /rest/order/create_from_publication


merchantApiKeyYesUnique string identifier of the merchant.
offeringIdYesUnique integer identifier of your offering.
publicationIdYesUnique integer identifier of your publication.
merchantReferenceYesUse your own internal id as a reference to link this order to your internal systems.
paymentReferenceNo Reference for the payment provider, this should be a globally unique identifier. Use a UUID.
titleNoPublication title
curl -v -d "merchantApiKey={yourMerchantApiKey}&offeringId=70&publicationId=1240&merchantReference=12245&title=My publication" ""


An XML representation of the new order including the policy and signature to be used when sending files to the order bucket.


<?xml version="1.0"?>
  <base64EncodedPolicy>encoded-policy </base64EncodedPolicy>


4. Set details

Great! You have placed your order. You can find your orders by clicking on ”Orders” in the top menu of your dashboard. Now you have to provide order details.

POST /rest/order/details

Supply additional details about an order, such as the customer shipping address and quantity.


<?xml version="1.0"?>

curl -v -d "externalOrderId={externalOrderId}&<?xml version='1.0'?><address><firstName>recipientFirstName</firstName><lastName>recipientLastName</lastName><addressLine1>shippingAddressLine1</addressLine1><addressLine2>shippingAddressLine2</addressLine2><zipCode>shippingZipCode</zipCode><city>shippingCity</city><country>Netherlands</country><countryCode>NL</countryCode></address>" ""


If all went well, this service will only respond with the string 'OK'.


5. Confirm payment
The last step is the payment confirmation. Typically, the API method should be called after you received confirmation from the payment provider. The moment you call this API method, we will start processing your order (costs of the print will be substracted from your balance).

POST /rest/order/set_paid

Set an order as paid. This is required if you use your own payment procedure.


curl -v -d "externalOrderId={yourExternalOrderId}&merchantApiKey={yourMerchantApiKey}&secret={generatedSecretHash}" ""
String secretKey = "merchantSecretKey";
String merchantApiKey = "merchantApiKey";
String externalOrderId = "1234";
String data = merchantApiKey + externalOrderId;
Mac m = Mac.getInstance("HmacSHA1");
m.init(new SecretKeySpec(secretKey.getBytes("UTF-8"), "HmacSHA1"));
byte[] hash = m.doFinal(data.getBytes("UTF-8"));
String secret = new String(Base64.encodeBase64(hash));

You get as result: LmzDnZGhdSI3D3aWXrQNcY0GDqI=

(using org.apache.commons.codec.binary for base64 and javax.crypto for Mac).


This service either returns 'ERROR' or 'OK'.


After completing these simple steps, your order will be processed, printed and shipped. Next time you want to print the same file, you can skip first step.

If you need help integrating the Print API, contact