Skip to content

Print API

Method Endpoint Description
POST /api/document/print Print document which is waiting to be printed
POST /api/print Print string

POST /api/document/print

If document wasn't printed normally (while being created) due to a printer error (e.g. due to printer without paper), this method must be called to print the original receipt. Without it, eKasa won't accept any request which stores data to CHDU.

Request Body

Printer properties.

Schema: Printer

Examples

No parameters are required.

{}

Responses

200 — Success response

Schema: GenericResponse

The document was printed successfully

Successful response doesn't return any additional data.

{
  "resultCode": 0
}

404 — Document to print was not found

Schema: ErrorResponse

Everything printed

No document is waiting to be printed.

{
  "resultCode": 505,
  "error": "No unprinted document found."
}
Electronic document

If the last document was electronic, only the error text changes.

{
  "resultCode": 505,
  "error": "Last document was electronic."
}

500 — An error occurred (for example printer or CHDU got disconnected)

Schema: ErrorResponse


POST /api/print

Print custom string data. These data will be stored in the CHDU memory.

Request Body

Data to print

Schema: PrintStringRequest

Examples

Simple text print

Simple print request

{
  "printData": "Print data"
}
Complex print

Since the eKasa client doesn't allow formatting the text yet, the text must be formatted manually. Please call the Printer endpoint first to discover the printer parameters (characters per line). This example is for 32 characters per line.

{
  "printData": "        Daily statement         \n--------------------------------\n                                \nTotal sales:                  37\nTotal item count:             70\nTotal cost:           468.50 EUR\n--------------------------------"
}

Responses

200 — Standard response

Schema: RawResponse

500 — An error occurred...