Printer Setup & Installation Tutorials

 

We go over the basics and show you the necessary steps needed after signing up. We’ll explore other areas from sending a test order (to ensure everything is in working order), to setting up our plugin extensions.

Use the table of contents below to select your topic of interest.

Understand The PrinterCo API In 6 Steps

Where we differ from other cloud print servers is our unique combination to manage your printers. Some of the tools we provide for our users is the ability to monitor the printer status (whether it’s currently online or offline), and to also send an email notification whenever the status changes.

To use a PrinterCo terminal you need to have a valid subscription. Check out which subscription plan is best suited for your needs.

We also provide some tools to operate the printer remotely. This becomes very handy for having to make adjustments to the printer settings for your clients who are already in the live field.

Some other tools include user management, reports, watchdog and more.

We’ve worked relentlessly to deliver a system for maximum user flexibility, and at the same time keeping things easy to use – even for the less tech-savvy. See below how we’ve broken down our powerful but simple to understand API in just 6 simple steps.

PrinterCo API

1. Send Order To API

The first step is to send your order to our API. How? It depends on whether you’re using one of our WordPress plugin extensions or you’re doing the API integration yourself. For the former method, you don’t need to do much as we’ve taken care of the code for you. All you need to do is just install the plugin, punch in your API and Printer ID details, and you’re ready to go! For a more in-depth tutorial (with screenshots), be sure to check out WooCommerce Extension or WP-Pizza Extension.

For the latter method, where you’re not using an open-source platform (such as WordPress), you’ll need to first format your order content so that it can be read as an HTTP POST. For more details on how to do this, along with a list of available order parameters that you can use (i.e. order ID, order type, currency etc), see our sample PHP file. Enter your email to get your copy. And yes…don’t worry…it’s free!

Once you’ve formatted your order correctly, you’ll need to send it to our API through our API URL – https://mypanel.printerco.net/submitorderext.php

2. Probe Server Every 30 Sec

If your order was sent successfully, it’ll be sitting in the Transaction List with a pending status. Orders with a pending status are picked up by the printers and are printed. If you don’t see your order in the Transaction List, then chances are it’s in the WatchDog. All orders that fail to follow protocol are dumped here, with details on how you can possibly fix the issue. More information on our WatchDog can be found on our forum.

Once you’ve subscribed to our print server and connected your first printer, it’s programmed to probe our servers every 30 seconds to search for any new orders (or orders with a pending status).

Although in most cases you won’t need to, you have the option to reduce this frequency to a longer gap (i.e. 60 seconds). A feature if you’re on a tight budget with data costs. To change this setting, you’ll need to navigate through the printer menus – Tutorials for this and other settings can be found here.

3. New Order

When an order with a pending status is picked up, the printer will stop probing the server. The contents of the order are then pulled for a quick print job, that usually takes a couple of seconds. Orders with a pending status are highlighted in yellow, accepted orders are green and rejected orders are red.

Once the order is printed, the printer will resume probing the servers after another 30-second break.

4. Print Order

We understand that businesses operate differently, so we’ve adapted our system to give them more flexibility to our users when printing their orders. You can set up how you want your orders to print beforehand. Meaning, you can set the printer to initially ring to grab your attention. And then, after a short user interaction have the order printed. Or you set it to print the order immediately, and then ring while waiting for you to accept or reject the order. You can even set up the printer to view your order on the screen before deciding to print it. So play around with the different combinations to so see what works for your business.

5. Update Order Status

If enabled, after the order is printed, you’ll be required to accept or reject the order. What follows after, is the option to enter an estimated time for completion, or a reason for the rejection. This information is then sent to our print servers and saved for further processing.

Coming soon are more advanced features that involve an SMS notification of the updated order status and live order tracking.

6. Customer Acknowledgement

After the order status is changed from the printer (i.e. when the order has been accepted or rejected), the information is passed into a page referred to as the Notify URL. You’ll need to create this page for your website and include the URL in your code when submitting the order to our API. From this page, you can extract the new order status and then take the next appropriate actions to notify the customer.

Here’s another reason that makes us one of the best cloud printing service providers.

To avoid any disappointments, we encourage you to use our demo account to do your integration. There, you’ll find a virtual printer. It won’t print anything out for you, but you can use it as a guide to test if your setup works correctly. Once you’re able to send orders to the virtual test printer and see them in the transaction list, you can then commit to subscribing and buying your own printer.

Order Submit URL

URL  https://mypanel.printerco.net/submitorderext.php
Note Submit your order details according to API guideline to this URL using post method including API key, API password, Printer ID etc. from your website to our API. For more details please check our API documentation.
Also please note that you should do URL encoding before sending it to API.

 

Implementation Guideline

Field Importance Format Details
api_key Mandatory String API key of client account
api_password Mandatory String API password of client account
notify_url Mandatory String URL to where you want to be notified about order accept/reject from the printer
receipt_header Mandatory String The header for print receipt
receipt_footer Mandatory String The footer for print receipt
printer_id Mandatory Integer Printer ID to where you want to send the order
order_id Mandatory Integer Order ID to track order (must be unique, must not contain any space )
currency Mandatory String Your currency
order_type Mandatory Integer Order type:
1 – Delivery
2 – Collection
3 – Reservation
payment_status Mandatory Integer Status of the payment:
6 – paid
7 – not paid
payment_method Mandatory String Payment method name.
Ex. Cash, paypal etc.
order_time Optional Date and Time Time and date when order placed.
e.g- 18:30 17-09-10 (h:m dd-mm-yy)
delivery_time Mandatory Date and Time Time and date of delivery.
e.g- 18:30 17-09-10 (h:m dd-mm-yy)
auth_code Optional String Authentication code of payment method
-> cat_1(string)
-> item_1(string)
-> desc_1(string)
-> qnt_1(integer)
-> price_1(number)
Mandatory at least one   cat_(item number) – it is the item category name
item_(item number) – it is item name
desc_(item number) – it is item description (ex. Selection or toppings)
qnt_(item number) – it is item quantity
price_(item number) – quantity X unit priceAll post variables for the item must be passed to API even if any field needs to be kept blank. ex. “desc_”
deliverycost Mandatory Number Zero or greater
card_fee Mandatory Number Zero or greater
extra_fee Optional Number Zero or greater
total_discount Optional Number Zero or greater
total_amount Mandatory Number Zero or greater (must be calculated total including item price and other fees and discount)
cust_name Mandatory String Customer name
cust_address Mandatory String Customer address
cust_phone Mandatory String Customer phone number
cust_instruction Optional String Customer instruction about order
isVarified Mandatory Integer Customer verification status
4 – verified
5 – not verified
num_prev_order Optional Integer Total number of orders of this customer

 

 

POST Example

<form method="post" action="https://mypanel.printerco.net/submitorderext.php">
<input name="api_key" value="Your API Key" />
<input name="api_password" value="Your API Password" />
<input name="notify_url" value="Notify URL" /> <!-Notify url is your websites url where you would like to get notification from isynctel api -->
<input name="receipt_header" value="Header Line1@@123 Street Address, City, Zip Code" />
<input name="receipt_footer" value="Thanks for your custom..." />
<input name="printer_id" value="Your printer ID" />
<input name="order_id" value="OrderID" />
<input name="currency" value="Currency" /><!--ex. USD/GBP -->
<input name="order_type" value="1" /><!--Delivery=1, Pick up=2, Reservation=3-->
<input name="payment_status" value="6" /><!--Paid=6, Not Paid=7-->
<input name="payment_method" value="Payment Method" />
<input name="delivery_time" value="18:30 17-09-10 " /><!--Format=HH:MM DD-MM-YY-->
<input name="auth_code" value="Payment authorization code" />

<input name="cat_1" value="Category 1" />
<input name="item_1" value="Item Name 1" />
<input name="desc_1" value="Item description 1" />
<input name="qnt_1" value="1" />
<input name="price_1" value="10.50" />

<input name="cat_2" value="" />
<input name="item_2" value="Item Name 2" />
<input name="desc_2" value="Item description 2" />
<input name="qnt_2" value="1" />
<input name="price_2" value="10.50" />

<input name="cat_3" value="Category 2" />
<input name="item_3" value="Item Name 3" />
<input name="desc_3" value="Item description 3" />
<input name="qnt_3" value="1" />
<input name="price_3" value="10.50" />

---------
You can place more items here using above format.
Please note that you don't need to send category name for the items after first item if the category name is same and if you put all same category items consecutively.
---------
<input name="deliverycost" value="3.50" />
<input name="card_fee" value="0.50" />
<input name="extra_fee" value="1.50" />
<input name="total_discount" value="4.50" />
<input name="total_amount" value="56.50" /><!--Grand Total -->
<input name="cust_name" value="Customer Name" />
<input name="cust_address" value="Customer address" />
<input name="cust_phone" value="Phone number" />
<input name="cust_instruction" value="Special instruction" />
<input name="isVarified" value="4" /><!-Verified=4, Not verified=5 -->
<input name="num_prev_order" value="Number of previous order" />
<input type="submit" value="Submit" />
</form>

 

Error Response

<response>
   <status>FAILED</status>
   <details>
      <error>	Authentication failed	</error>
      <error>	Other errors...</error>
   </details>
</response>

 

 

Success Response

<response>
   <status>OK</status>
   <details>
      <msg>Order has been stored successfully</msg>
   </details>
</response>

 

 

Order Updates Notification

When printer sends a callback response to API the API sends a notification to the Provided Notify URL with order
In your notification URL, you will get notification regarding the status of the order, all the information will be submitted via post method which will allow you to grab information easily. 

Post variables:

“printer_id”   = Printer ID
“order_id”  = Order ID
“status”   = 1 -> accepted | 2 -> rejected
“msg”  = message from the printer (this variable will not be present for manual order update from MyPanel)
“delivery_time”  = confirmed delivery time from the printer (this variable will not be present for manual order update from MyPanel)
“manual_update”  = 1 -> manual update identifier
“booking”   =  1 -> manage booking identifier

Please note that you will not get the notification while you are sending the order to API even if the notify URL is the same as where you are sending the order to API. API will send response later automatically when the order will be accepted/rejected from printer to that Notify URL you provided with order. So we recommend you to use separate URL/file to send the order to API and receive notification from API to avoid confusion.

Example in PHP:

Let’s say you are sending the order the URL of your site www.example.com/sendorder.php to API
So you need to write necessary code on sendorder.php to send order information from your site to API. I am not telling you the details here how to send the order to API. Please check our example HTML form above to send order information to API.

Lets say you have used the value of notification URL field www.example.com/receivenotification.php in orders sending form like <input name=”notify_url” value=”www.example.com/receivenotification.php” /> then MyPanel API will send a notification to www.example.com/receivenotification.php as soon as API get a response from the printer when an order will be accepted/rejected after printing. Here is the example code to grab the information from API notification need to be placed on receivenotification.php file.

<?php 
$printer_id = $_REQUEST['printer_id']; 
$order_id = $_REQUEST['order_id']; 
$order_status = $_REQUEST['status']; 
$message = $_REQUEST['msg']; 
$delivery_time = $_REQUEST['delivery_time']; 

if($order_status==1)
{
   //order has been accepted from the printer
   //do your necessary task for accepted order like update database, send email to the customer to inform him that his order has been accepted and will be delivered on the returned delivery time (variable $delivery_time).
}
else
{
   //order has been rejected from printer
   //do your necessary task for rejected order like update databse, send email to customer to inform him that his order has been rejected for the returned reason (variable $message).
} 
?>

 

 

Get Printer Status

You can get printer status programmatically through API.
API URL – https://mypanel.printerco.net/get_status.php 

Field Importance Format Details
api_key Mandatory String API key of client account
api_password Mandatory String API password of client account
printer_id Mandatory Integer Printer ID for which you want to get the status

 
Success response:

<response>
   <status>OK</status>
   <details>
      <printer_id>Printer ID</printer_id>
      <printer_status>active or inactive</printer_status>
      <shop_status>open or closed</shop_status>
      <last_connected>last connection time(YYYY-MM-DD HH:MM:SS) or NA</last_connected>
      <connection_status>connected or not connected</connection_status>
   </details>
</response>

Please note that you can use the connection status that is calculated by the offline time settings of your MyPanel account or you need to decide whether the printer is connected or not by the last connection time. Because it’s up to you how long you want to allow to calculate the connection status. Just to inform you that only if the printer is Idle then printer connects to MyPanel in each 30 seconds period to check for new orders. It’s(30 seconds) sometimes may vary due to a network issue. And also if printer user is busy in navigating other section like menu or other feature then printer only connects to the MyPanel after user back to Idle mode. So please keep it in mind when you calculate connection status.
 
Failed response:

<response>
   <status>FAILED</status>
   <details>
      <error>	Authentication failed	</error>
      <error>	Other errors...</error>
   </details>
</response>

 

 

Get Order Status

You can get order status programmatically through API.
API URL –  https://mypanel.printerco.net/get_order_status.php

Field Importance Format Details
api_key Mandatory String API key of client account
api_password Mandatory String API password of client account
printer_id Mandatory Integer Associated Printer ID
order_id Mandatory Integer Order ID for which you want to get the status

 
Success response:

   <response>
   <status>OK</status>
   <details>
      <printer_id>Printer ID</printer_id>
      <order_id>Order ID</order_id>
      <order_status>pending or accepted or rejected</order_status>
      <accepted_for>agreed delivery/pickup time if the order is accepted</accepted_for>
      <rejected_for>rejected reason if order is rejected</rejected_for>
   </details>
</response>

Please note that if the order status is accepted then the rejected_for field will contain NA value and if the order status is rejected then the accepted_for field will contain NA value.
 
Failed response:

<response>
   <status>FAILED</status>
   <details>
      <error>	Authentication failed	</error>
      <error>	Other errors...</error>
   </details>
</response>

 

 

Get Shop Status (iconnect printers only)

Once the shop status is changed via the printer, a notification is sent to our server to update our records. And once this is updated, the website in question is notified of the new shop status through the notify URL. You can check the ‘status’ or ‘update_shop_status’ variables to see if your eCommerce store should be opened or closed for business.

 

Field Importance Format Details
printer_ID Mandatory String Associated Printer ID
status Mandatory Integer 0 for shop is closed; 1 for shop is open
update_shop_status Mandatory Integer 1 for a change is needed; 0 not needed

 

Below is a template PHP script that you can use to send orders from your website to the PrinterCo API. To alter the font settings and printer behaviour, you can use either your printer or your MyPanel dashboard.

To change the fonts, you can refer to the article Optimize receipt fonts for the best layout

To change the printer behaviour, you can refer to the section Printer Functions

After integrating with our API, if you find that your orders are still not printing out from your printer, head over to the Watchdog to see if any errors were found with your order submission. Check out the article Troubleshooting with Watchdog for more help.

 

<?php

// ======================================================
// PART 1. Set-up required variables from a typical order - You can find more details for the post fields in your MyPanel dashboard. Visit mypanel.printerco.net
// ======================================================
$order_id = '32001';
$currency = 'USD';

$order_type = 'delivery';
$payment_status = 'paid'; 
$payment_method = 'creditcard';
$auth_code = '443AD453454'; //identification code of payment

$order_time = '18:30 14-08-14'; //h:m dd-mm-yy
$delivery_time = '18:45 14-08-14'; //h:m dd-mm-yy

$deliverycost = 3.50;
$card_fee = 2.50;
$extra_fee = 0.00;
$total_discount = 1.50;
$total_amount = 15.00;

$cust_name = 'Jhon Smith';
$cust_address = 'Address line1%%address line2%%...';
$cust_phone = '44034343434';
$isVarified = 'verified'; 
$cust_instruction = 'Make it spicy';
$num_prev_order = 10;


// ===================================================
// Part 2. Additional options for the printer settings - These can also be changed from your MyPanel dashboard
// ===================================================
$apply_settings = 0; //0=settings NOT applied, 1=settings applied
$auto_print = 0;
$auto_accept = 0;
$enter_delivery_time = 1;
$time_input_method = 1;
$time_list = '0-5-10-15-20-25-30-35-40-45-50-55-60';
$extra_line_feed = 3;


// =============================================
// Part 3. Save the items ordered into an array
// =============================================
$menu_item = array(
  array(
    'category'=>'item category 1', 
    'name'=>'item name 1', 
    'description'=>'item description 1', 
    'quantity'=>'1', 
    'price'=>'3.50'
  ),
  array(
    'category'=>'item category 2', 
    'name'=>'item name 2', 
    'description'=>'item description 2', 
    'quantity'=>'3', 
    'price'=>'6.00'
  )
);


// =============================
// PART 4. API access credential - Find this in your MyPanel dashboard under My account > Edit Information.
// =============================
$api_key = 'apikey';
$api_password = 'secretapipassword'


// ============================
// PART 5. PrinterCo printer ID - visit your MyPanel dashboard and then the Printer List page to find the printer ID.
// ============================
$printer_id = 2501;


// =====================================
// PART 6. Set receipt header and footer
// =====================================
$receipt_header = "PrinterCo Restaurant%%Kemp House, 160 City Road%%London, EC1V 2NX%%0800 689 5326";
$receipt_footer = "Thank you";


// ==========================
// PART 7. Notification URL - When an order is either accepted or rejected on the printer, this info will be sent to this URL.
// ==========================
$notify_url = 'http://yourwebsite.com/notify.php';
// Even if this will not be used, this is a mandatory field needed to send orders to the API


// =========================================
// PART 8. Preparing post fields as an array 
// before sending to the PrinterCo API
// =========================================
$post_array = array();

$post_array['api_key'] = $api_key;
$post_array['api_password'] = $api_password;

$post_array['receipt_header'] = $receipt_header;
$post_array['receipt_footer'] = $receipt_footer;

$post_array['notify_url'] = $notify_url;
$post_array['printer_id'] = $printer_id;

$post_array['order_id'] = $order_id;
$post_array['currency'] = $currency;

//1=Delivery, 2=Collection/Pickup, 3=Reservation
if($order_type=='delivery'){
  $post_array['order_type'] = 1;
}
else if($order_type=='collection' || $order_type=='pickup'){
  $post_array['order_type'] = 2;
}
else if($order_type=='reservation'){
  $post_array['order_type'] = 3;
}

//6=paid, 7=not paid
if($payment_status=='paid'){
  $post_array['payment_status'] = 6;
}
else{
  $post_array['payment_status'] = 7;
}
$post_array['payment_method'] = $payment_method;
$post_array['auth_code'] = $auth_code;

$post_array['order_time'] = $order_time;
$post_array['delivery_time'] = $delivery_time;

$post_array['deliverycost'] = $deliverycost;
$post_array['card_fee'] = $card_fee;
$post_array['extra_fee'] = $extra_fee;
$post_array['total_discount'] = $total_discount;
$post_array['total_amount'] = $total_amount;

$post_array['cust_name'] = $cust_name;
$post_array['cust_address'] = $cust_address;
$post_array['cust_phone'] = $cust_phone;

//4=verified, 5=not verified
if($isVarified=='verified'){
  $post_array['isVarified'] = 4;
}
else{
  $post_array['isVarified'] = 5;
}
$post_array['cust_instruction'] = $cust_instruction;
$post_array['num_prev_order'] = $num_prev_order;

$post_array['apply_settings'] = $apply_settings;
$post_array['auto_print'] = $auto_print;
$post_array['auto_accept'] = $auto_accept;
$post_array['enter_delivery_time'] = $enter_delivery_time;
$post_array['time_input_method'] = $time_input_method;
$post_array['time_list'] = $time_list;
$post_array['extra_line_feed'] = $extra_line_feed;

$cnt = 1;
foreach($menu_item as $val){
  $post_array['cat_'.$cnt] = $val['category'];
  $post_array['item_'.$cnt] = $val['name'];
  $post_array['desc_'.$cnt] = $val['description'];
  $post_array['qnt_'.$cnt] = $val['quantity'];
  $post_array['price_'.$cnt] = $val['price'];
  
  $cnt++;
}


// ========================================
// Part 8. Post order data to PrinterCo API
// ========================================
$printerco_api_url = 'https://mypanel.printerco.net/submitorderext.php';
$response = post_to_api($printerco_api_url,$post_array);


//do your necessary things here based on the response status
if($response['status']=='OK'){
  //order submitted successfully
}	
else{
  //order submission failed because of the following reason
}



// ===================================
// Part 9. Post data to API using CURL
// ===================================
function post_to_api($url, $post_data) {
    
  set_time_limit(60);
  $output = array();
      
  $fields = "";
  $i = 0;
  foreach ($post_data as $key => $value) {
    $fields .= ($i > 0) ? "&" . "$key=" . urlencode($value) : "$key=" . urlencode($value);
    $i++;
  };
        
  $curlSession = curl_init();
  curl_setopt($curlSession, CURLOPT_URL, $url);
  curl_setopt($curlSession, CURLOPT_HEADER, 0);
  curl_setopt($curlSession, CURLOPT_POST, 1);
  curl_setopt($curlSession, CURLOPT_POSTFIELDS, $fields);
  curl_setopt($curlSession, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt($curlSession, CURLOPT_TIMEOUT, 30);
  curl_setopt($curlSession, CURLOPT_SSL_VERIFYPEER, FALSE);
  curl_setopt($curlSession, CURLOPT_SSL_VERIFYHOST, 1);
      
  $rawresponse = curl_exec($curlSession);
  
  $response_array = simplexml_load_string($rawresponse);
  
  if($response_array->status == 'OK'){
    $output['status'] = 'OK';
    $output['details'] = (string)$response_array->details->msg;
  }
  else{
    $output['status'] = 'FAILED';
    $output['error'] = array();
    
    
    foreach($response_array->details->error as $val){
      
      $output['error'][] = (string)$val;
    }
  }
      
  curl_close($curlSession);
  
  return $output;
}
?>

Leave a comment

Enter your keyword