Remote integration

Place a job in the queue and receive it on Android.

The device registers with a linkcode. Your server sends content to the remote service and the app retrieves it for the main printer.

Updated:

Test printing over the Internet

Enter the Link code shown by PosPrinterDriver. The terminal must have the web service enabled and printer number 1 configured and available.

CLOUD CAFE--------------------------------1 Coffee without cables  1.50 EUR1 Cloud-shaped croissant 2.00 EUR1 Extra smile       0.00 EUR--------------------------------TOTAL           3.50 EURFrom the web to your printer.If you can read this on paper,your receipt has landed!Thank you for testing PosPrinterDriver.
Also notify my server (optional)

Click to send this receipt to your terminal. While the job is pending, you can check its status without printing again.

The response will appear here after you send the receipt.

Complete workflow

  1. 01

    1. Configure and test printer 1

    The documented remote queue prints to the main printer. Confirm its built-in test works.

  2. 02

    2. Enable the web service

    Enable the corresponding service in PosPrinterDriver and allow it to run in the background.

  3. 03

    3. Register the device

    Obtain or enter the linkcode displayed by the app. Treat it as a credential.

  4. 04

    4. Send from your backend

    Make an HTTPS GET or POST request with linkcode and data to the documented endpoint.

  5. 05

    5. Receive the notification and print

    The server stores the ticket and notifies the terminal through Action Cable. Android retrieves the job, reports its status and sends it to printer number 1. An OK response means the server accepted the job; also check the physical paper output.

Recommended POST example

bash
curl -X POST 'https://gestion.posprinterdriver.com/api/v1/api/senddatatoprinter' \ --data-urlencode 'linkcode=YOUR_LINKCODE' \ --data-urlencode 'data=Order #123Total: 12,50 €'
  • For automated integration, make the call from your server. This page's test uses a POST form with the code you enter.
  • Do not record the full linkcode in logs, analytics or error reporting tools.

GET example

Use only if your environment does not support POST, and encode every parameter.

text
https://gestion.posprinterdriver.com/api/v1/api/senddatatoprinter ?linkcode=YOUR_LINKCODE &data=ENCODED_CONTENT

Per-job tracking

The tracking API returns job_id, status_token, status_url, status and expires_at when accepting a ticket. The test checks that reference automatically for about two minutes and lets you check again without reprinting.

Available after updating the server and Android to a tracking-enabled version (20.31). Older terminals can only report removal from the queue, not confirmed delivery to the printer.

Check status without changing the queue

bash
curl 'https://gestion.posprinterdriver.com/api/v1/api/jobs/JOB_ID'  -H 'Authorization: Bearer STATUS_TOKEN'
  • Use the status_token returned when creating the job. You do not need to expose the Link code in the URL.
  • A 404 means the job does not exist or has expired. Checking status never prints again.

What each status means

StatusMeaning
queuedThe server has stored the ticket.
dispatchedThe server reserved the job; Android receipt confirmation is still pending.
receivedAndroid has retrieved the job.
sendingAndroid is starting delivery to the printer.
retry_waitWaiting for printer: the connection failed before writing. Android 20.33 or later retries automatically when connectivity returns, until the job expires.
sent_to_printerData delivery finished without a detected error; this does not confirm physical paper output.
failedA failure was detected. Partial output is possible; check before sending again.
unknownConfirmation is missing. The job is not reprinted automatically.
legacy_completedAn older app removed the job from the queue without detailed confirmation.

Receive status updates in your backend

Include returned_url in the request to receive a JSON POST for each change. The URL must use HTTPS and be reachable over the Internet.

json
{ "job_id": "job-identifier", "event_id": "event-identifier", "status": "sent_to_printer", "error_code": null, "physical_print_confirmed": false}
  • Respond with HTTP 2xx. Notifications are retried: deduplicate using event_id and use occurred_at because they can arrive out of order.
  • returned_url receives status updates; callbackurl preserves the legacy posprintedriver=ok notification when the queue item is removed or delivery completes.
  • Protect your receiver with a secret URL and validate its parameters. If a domain allowlist is configured, request that the receiver's domain be included.

Expiry and duplicates

History and pending jobs expire after 7 days by default, configurable by the administrator. expires_at gives each job's deadline. Ticket content is deleted when the job ends successfully, fails or has an unknown result. Expired history is removed by the next automatic cleanup, which runs every five minutes.

Send idempotency_key to identify an attempt. Repeating the same key and data returns the same job_id during retention. Reusing it with different content creates a conflict. Deduplication is not guaranteed after expiry.

If terminal confirmation does not arrive within ten minutes, maintenance marks the result unknown. If the printer connection fails before writing, Android 20.33 or later reports retry_wait and tries again. If delivery may already have started, it is not repeated. A callback failure only retries that notification.

Verified parameters

ParameterRequiredPurpose
linkcodeYesIdentifies the registered device; keep it private
dataYesText and commands, up to 60,000 bytes
returned_urlNoHTTPS URL for receiving status changes
idempotency_keyRecommendedAttempt key, up to 128 characters, to prevent duplicates
pnDo not use for selectionThe reviewed backend does not apply it; the remote queue uses printer 1

Reliable operation

  • Add your own job identifier to prevent duplicates in your system.
  • Apply size limits and sanitise content before sending it.
  • Distinguish request acceptance from confirmed physical printing.
  • If Android is offline, check pending jobs before manually sending again.
  • Keep the device charged and exempt the app from battery restrictions where appropriate.