How to auto-print Shopify invoice PDFs
Send an invoice PDF you generate for a Shopify order to a local office printer through the print-jobs API. No Shopify invoice plugin is included.
For Shops that file a paper invoice with the order or the bookkeeper
Overview
Shopify order notifications are email. A paper invoice is a PDF you compose: seller, buyer, tax lines, totals. Nothing in PrintBase reads the Shopify Admin for you, and there is no invoice app to install.
Generate the PDF in the same service that listens for orders/paid or refunds/create. Send content_type pdf to the office printer's printer_code, which is often a laser queue on a different computer from the warehouse label printer. The agent on that office computer must be online.
Key the job as shopify-invoice:{orderId}. Refunds that need a credit note are a different document and a different key, not a retry of the original invoice.
Integration steps
- 01
Pick the office queue
Install the agent where the invoice printer is plugged in. Copy that printer's code from GET /v1/printers. Do not reuse the warehouse label code.
- 02
Render tax and totals yourself
Build the invoice PDF from the order payload you trust. The print API accepts the file; it does not calculate tax.
- 03
POST content_type pdf
Base64 the PDF into content. Set copies from your filing rule, usually 1. options.duplex is available if that printer should duplex.
- 04
Separate invoice retries from reprints
The Idempotency-Key is the order id for the first invoice. A second copy for the customer is a new key.
- 05
Store the job id on the order
Write the returned job id into your order record so support can open GET /v1/print-jobs/{id} when someone says the invoice never printed.
Node.js
// Invoice PDF for a Shopify order, duplex off
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': `shopify-invoice:${order.id}`,
},
body: JSON.stringify({
printer_code: Number(process.env.PRINTER_CODE),
content_type: 'pdf',
content: invoicePdf.toString('base64'), options: { duplex: false },
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 an invoice
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.
Duplex is a request, not a guarantee
The documented options.duplex field is passed through with the job. Whether the office driver honors it depends on that printer. Check one invoice before you rely on it.
Questions
Will PrintBase pull the invoice from Shopify?
No. You create the PDF. The API prints bytes or a URL you provide.
Can I print a PDF URL from my invoice bucket?
Yes, if the agent can GET it over http or https without cookies. Otherwise send base64.
The office PC is asleep.
The job stays queued and can fail with AGENT_OFFLINE until that agent reconnects. Wake the computer that owns the printer.
Does the free plan include invoices?
The free plan is 100 jobs a month on one computer, card not required. Each invoice is one job. Webhooks need a paid plan; polling does not.
Free plan: 100 jobs a month on one computer, no card.