Print receipts on a Star mC-Print3
The mC-Print3 can do CloudPRNT, but this path uses the OS queue. Send PDF or tested raw bytes. You do not host a poll URL.
For Counters with an mC-Print3
Overview
Star's mC-Print3 is an 80 mm printer that supports CloudPRNT, where the device polls your server. You do not have to host that poll endpoint. Install the printer on the agent computer and send a PDF, or raw bytes you have verified against that firmware.
PrintBase does not ship a driver for this model. The agent prints to a queue the operating system already lists. Raw bytes go straight through: from memory into the Windows spooler, or via lp -o raw on macOS and Linux. PDF jobs go through the OS driver. A PDF marked as raw is rejected with INVALID_CONTENT.
Star's CloudPRNT manual lists a default poll of a few seconds for the mC-Print3 when that feature is used. This API does not set that timer. Leave CloudPRNT disabled if you are printing only through the OS queue, so the printer is not also polling an old URL.
Integration steps
- 01
Install the printer in the OS
Use the vendor driver or a raw port until a test page works. The agent cannot see a device the operating system does not list.
- 02
Read the numeric code
GET /v1/printers returns code. That integer is printer_code on POST /v1/print-jobs. The name is for humans.
- 03
Match content_type to the payload
ZPL, EPL, TSPL, and ESC/POS are content_type raw, standard base64. Office documents and driver labels are content_type pdf.
- 04
Key the job to the business id
Reuse one Idempotency-Key per label. A reprint uses a new key. The same key with a different body returns HTTP 409.
- 05
Wait for completed
HTTP 201 means status queued. Poll GET /v1/print-jobs/{id}. Paid plans can subscribe to print_job.completed and print_job.failed only.
Node.js
// mC-Print3 receipt 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': idempotencyKey,
},
body: JSON.stringify({
printer_code: Number(process.env.PRINTER_CODE),
content_type: 'pdf',
content: receiptPdf.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
Model notes
Star's CloudPRNT manual lists a default poll of a few seconds for the mC-Print3 when that feature is used. This API does not set that timer. Leave CloudPRNT disabled if you are printing only through the OS queue, so the printer is not also polling an old URL.
Raw versus PDF on this queue
Raw is not reflowed. On Windows a PDF needs an application that handles PrintTo; the agent error text names Adobe Reader or SumatraPDF as examples. macOS and Linux use lp.
Questions
Do I have to implement CloudPRNT?
No. The agent prints the queue. CloudPRNT remains available if you want it for other systems.
USB and LAN?
Both can be an OS printer. The agent does not open the printer's web configuration page.
Peripheral barcode scanner on the mC-Print3?
CloudPRNT can report peripherals. This print API does not. It only prints.
Cut command?
In a PDF path the driver cuts according to its settings. In a tested raw path you include the Star or ESC/POS cut you verified.
Free plan: 100 jobs a month on one computer, no card.