How to auto-print Wix order tickets
Print a Wix order ticket from a backend you control. Wix Velo should not hold the API key in page code. No PrintBase Wix app is included.
For Small Wix shops that need a ticket on a counter printer
Overview
Wix stores can send an order into Wix Automations or into a backend HTTP endpoint. The visitor's browser is the wrong place to print, because the API key would ship to every customer. PrintBase has no Wix app.
From a backend you own — an automation that calls your server, or Welo backend code that reads a secret — build a small PDF or ESC/POS ticket and POST /v1/print-jobs. The agent runs on the shop PC, not inside Wix.
Idempotency-Key wix-{orderId}. If Wix retries the automation, the same key prevents a second ticket.
Integration steps
- 01
Send the order to your server
Use an automation HTTP call or a backend event. Do not put the Bearer token in public Velo front-end code.
- 02
Format a short ticket
PDF if the counter printer is a normal driver printer. ESC/POS raw if it is a thermal receipt printer.
- 03
POST with printer_code
The code comes from the agent on the shop computer. Use POST /v1/print-jobs with Authorization: Bearer and the printer_code from GET /v1/printers.
- 04
Ignore storefront page loads
Only paid or created orders should print. Use POST /v1/print-jobs with Authorization: Bearer and the printer_code from GET /v1/printers.
- 05
Check the job before you tell staff it printed
201 means queued. Read the job until completed or a failure reason.
Node.js
// Backend receiving a Wix order: PDF ticket
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': `wix:${orderId}`,
},
body: JSON.stringify({
printer_code: Number(process.env.PRINTER_CODE),
content_type: 'pdf',
content: ticketPdf.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
PDF path for a Wix order ticket
Use content_type pdf and exactly one of content (standard base64) or content_url (an http or https URL the agent can download). A private file must be fetched by your server and sent as base64, or exposed as a short-lived URL. On Windows the agent asks a PDF app to print to the named queue; if none is registered, the failure text names Adobe Reader or SumatraPDF as examples. macOS and Linux use lp.
Secrets in Wix
If you use Wix Secrets, read the key from the backend web module. Front-end code runs in the shopper's browser.
Questions
Can Wix Automations post straight to PrintBase?
Only if the HTTP action can attach the Authorization header and you accept the key living in that automation. Prefer calling your own server, which then calls PrintBase.
Is there a Wix app market listing?
No. The call is still POST /v1/print-jobs with a Bearer API key, and HTTP 201 means queued rather than printed.
The shop PC is off in the morning.
Jobs fail or wait with AGENT_OFFLINE. Start the agent with the computer, then reprint with a new key if the original job failed.
Can I print labels and tickets?
Yes. Two jobs, two printer codes if they are different devices.
Free plan: 100 jobs a month on one computer, no card.