How to auto-print BigCommerce shipping labels
Print a BigCommerce shipping-label PDF from the app that receives the order webhook. No PrintBase BigCommerce app is included.
For BigCommerce sellers with a local 4×6 printer
Overview
BigCommerce will send an order webhook to a URL you control. It will not drive the USB label printer under the bench. PrintBase does not list a BigCommerce app. Your app verifies the webhook, obtains the label PDF from whatever shipping tool you use, and posts it.
Treat the label as content_type pdf, 4 by 6 inches. If your shipping tool returns ZPL for a Zebra, send raw instead. The printer_code is the bench queue reported by the agent.
Idempotency-Key bc-label-{orderId} absorbs webhook retries. Do not call the API from BigCommerce's storefront script.
Integration steps
- 01
Receive the order webhook
Verify the signature in your app. Ignore unsigned calls. Use POST /v1/print-jobs with Authorization: Bearer and the printer_code from GET /v1/printers.
- 02
Resolve the label file
Fetch it from your shipping integration server-side. Anonymous agent-reachable URLs can be content_url; everything else is base64.
- 03
POST to the bench printer
printer_code from GET /v1/printers, content_type pdf or raw to match the file.
- 04
Stable key per order
Same key and body on retry. New key to reprint. Use POST /v1/print-jobs with Authorization: Bearer and the printer_code from GET /v1/printers.
- 05
Show status in your app
Poll the job id. Paid plans can use print_job.completed and print_job.failed webhooks.
Node.js
// BigCommerce order: print the label PDF
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': `bc-label:${orderId}`,
},
body: JSON.stringify({
printer_code: Number(process.env.PRINTER_CODE),
content_type: 'pdf',
content_url: labelPdfUrl,
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 BigCommerce shipping label
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.
How you know it printed
Create returns id and status queued. The job then moves queued, dispatched, printing, completed. Failures use reason codes such as AGENT_OFFLINE, PRINTER_OFFLINE, DOWNLOAD_FAILED, PRINT_ERROR, and INVALID_CONTENT. Poll GET /v1/print-jobs/{id}. Webhooks exist on paid plans only, and only for print_job.completed and print_job.failed.
Questions
Is there a BigCommerce app?
No PrintBase app is published for BigCommerce in this product.
Can a script in the theme print?
No. The API key would be public. Use a server. The call is still POST /v1/print-jobs with a Bearer API key, and HTTP 201 means queued rather than printed.
Orders with multiple shipments?
One job per label, and put the shipment id in the idempotency key.
What if the webhook arrives before the label exists?
Do not print yet. Trigger on the event that carries the file, or poll your shipping tool until the PDF is ready, then POST once.
Free plan: 100 jobs a month on one computer, no card.