Print online orders to the kitchen
When your site takes an order, the kitchen printer should run without a browser dialog. Your server sends the ticket.
For Restaurants with a website and a pass printer
Overview
The guest's confirmation page is not a kitchen. The order handler that charges the card, or marks the order paid, builds the station tickets and posts them. The pass computer runs the agent.
Split by station if the menu requires it. Each station is a printer_code and its own idempotency key, order id plus station, so a retry does not double the fryer and miss the grill.
ESC/POS is the usual payload. If the only queue you have is a Star TSP100 that wants a driver PDF, send PDF instead of fighting ESC/POS.
Integration steps
- 01
Decide the printer before the click
Map the station, store, or line to a printer_code from GET /v1/printers. Do not ask the operator to pick a dialog.
- 02
Create the document in your system
PDF for driver printers, raw ZPL or ESC/POS when the device speaks that language.
- 03
POST when the business event happens
Pack, pay, check-in, or scan. Not on every autosave. Use the business id as Idempotency-Key.
- 04
Show the job result where the work is
queued is not done. Surface AGENT_OFFLINE and PRINT_ERROR to the person at the bench.
Node.js
// Kitchen ticket for a paid web order
const res = await fetch('https://api.printbase.cloud/v1/print-jobs', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.PRINTBASE_API_KEY}`,
'Content-Type': 'application/json',
'Idempotency-Key': idempotencyKey,
},
body: JSON.stringify({
printer_code: Number(process.env.PRINTER_CODE),
content_type: 'raw',
content: Buffer.from(payload).toString('base64'),
copies: 1,
}),
});
if (!res.ok) throw new Error(`PrintBase ${res.status}: ${await res.text()}`);
const job = await res.json();
// { id: "job_abc", status: "queued" }
Details for this setup
Do not print unpaid carts
Trigger on paid, or on the status your kitchen actually honors. The agent prints only what you send; it does not fetch the document from the platform for you.
Expo screen
Show the reason code when the pass printer is off. A silent 201 is how tickets get lost.
Questions
Can the website call the printer?
No. The website calls you. You call the API. The call is still POST /v1/print-jobs with a Bearer API key, and HTTP 201 means queued rather than printed.
Lunch rush duplicates?
Stable keys per order and station. The call is still POST /v1/print-jobs with a Bearer API key, and HTTP 201 means queued rather than printed.
86 an item after printing?
Send a follow-up ticket with a new key. The API does not recall paper.
Allergen notes?
Put them in the bytes. Nothing is added for you. The call is still POST /v1/print-jobs with a Bearer API key, and HTTP 201 means queued rather than printed.
Free plan: 100 jobs a month on one computer, no card.