Device Operations
This section outlines the supported device operations that can be executed via the HTTP API, WebSocket API, or INP files. All operations are strongly-typed and follow a unified structure.
Important: All device operations require a valid device_id (UUID) that corresponds to a configured fiscal device or POS terminal in the system.
Fiscal Device Operations
The following operations are available for fiscal printing devices. All amounts are specified in cents (smallest currency unit).
print_receipt
Description: Prints a fiscal receipt with items, payments, and optional buyer information. This is the most complex and important operation in the system.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
lines | Array<ReceiptLine> | Yes | Array of receipt lines (items, text, and subtotal) |
payments | Array<PaymentLine> | Yes* | Payment methods and amounts (*auto-calculated if omitted) |
buyer | BuyerInfo | No | Buyer information for invoices |
receipt_discount | Discount | No | Receipt-level discount or surcharge |
flags | ReceiptFlags | No | Receipt behavior flags (default: fiscal receipt) |
close_action | CloseAction | No | "close" or "void" (default: "close") |
ReceiptLine Object
Receipt lines can be items, free text, or subtotal operations:
// Item line
{
"type": "item",
"description": "Product Name",
"quantity_thousandths": 1000, // 1000 = 1.000 pieces
"unit_price_cents": 1500, // 1500 = 15.00 currency units
"vat": "19%", // Can be percentage (e.g., "19%") or letter ("A", "B", etc.)
"discount": { // Optional item-level discount
"kind": "percent",
"basis_points": 1000, // 1000 = 10.00%
"is_surcharge": false
},
"um": "buc" // Unit of measure (optional)
}
// Text line
{
"type": "text",
"text": "Custom text to print"
}
// Subtotal line
{
"type": "subtotal",
"discount": { // Optional subtotal-level discount
"kind": "percent",
"basis_points": 1000, // 1000 = 10.00%
"is_surcharge": false
}
}
Notes:
- Only one subtotal with a discount is allowed per receipt.
- You cannot use a subtotal discount if a global
receipt_discountis also present.
PaymentLine Object
{
"method": "cash", // "cash", "card", "credit", "tichete_masa", etc.
"amount_cents": 1500 // Payment amount in cents
}
BuyerInfo Object
{
"vat_number": "RO12345678" // VAT number (CUI/CIF)
}
Discount Object
// Percentage discount
{
"kind": "percent",
"basis_points": 1000, // 1000 = 10.00%
"is_surcharge": false // false = discount, true = surcharge
}
// Absolute amount discount
{
"kind": "absolute",
"amount_cents": 500, // 500 = 5.00 currency units
"is_surcharge": false
}
Response:
{
"status": 0,
"msg": "Receipt printed",
"slip_number": 123 // Fiscal receipt number
}
Auto Card-to-POS: If enabled in device configuration, card payments in the receipt will automatically trigger a POS sale transaction before printing the fiscal receipt.
print_non_fiscal_receipt
Description: Prints a non-fiscal receipt (free text) on the fiscal device. Useful for proforma invoices, order slips, or other information that does not require fiscalization.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
lines | Array<NonFiscalLine> | Yes | Array of text lines for the non-fiscal receipt |
NonFiscalLine Object
// Simple text line
{
"type": "text",
"text": "Text to print"
}
// Formatted text line (DATECS only - ignored on other devices)
{
"type": "text",
"text": "Formatted text",
"formatting": {
"bold": true,
"italic": false,
"double_height": true,
"underline": false,
"alignment": "center", // "left", "center", "right"
"condensed": false
}
}
Response:
{
"status": 0,
"msg": "Receipt printed"
}
print_x
Description: Prints an X report (non-fiscal daily summary).
Parameters: None
Response:
{
"status": 0,
"msg": "Report printed",
"report_number": 45
}
print_z
Description: Prints a Z report (fiscal daily closure).
Parameters: None
Response:
{
"status": 0,
"msg": "Report printed",
"report_number": 46
}
deposit_cash
Description: Records a cash deposit in the fiscal device.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
amount | integer | Yes | Deposit amount in cents (must be > 0) |
Response:
{
"status": 0,
"msg": "Cash operation successful",
"total_cash_drawer": 15000 // Total cash in drawer after operation (cents)
}
withdraw_cash
Description: Records a cash withdrawal from the fiscal device.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
amount | integer | Yes | Withdrawal amount in cents (must be > 0) |
Response:
{
"status": 0,
"msg": "Cash operation successful",
"total_cash_drawer": 10000 // Total cash in drawer after operation (cents)
}
chime
Description: Triggers the acoustic signal (beeper) on the fiscal device.
Parameters: None
Response:
{
"status": 0,
"msg": "Operation completed successfully"
}
open_drawer
Description: Opens the cash drawer connected to the fiscal device.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
| pulse_duration_ms | number | No | Duration of drawer opening pulse in milliseconds. Default: 100. Note: Ignored by Tremol devices. |
Response:
{
"status": 0,
"msg": "Operation completed successfully"
}
anaf_export
Description: Exports fiscal data for ANAF (Romanian tax authority) reporting.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
range | AnafExportRange | Yes | Date or Z-number range for export |
destination_path | string | Yes | Full path where to save the export file |
AnafExportRange Object
// Date range
{
"start": "2023-12-01",
"end": "2023-12-31"
}
// Z-number range
{
"start": 1,
"end": 10
}
Response:
{
"status": 0,
"msg": "Operation completed successfully"
}
anaf_status
Description: Retrieves the ANAF synchronization status from the fiscal device.
Parameters: None
Response:
{
"status": 0,
"msg": "Report data retrieved successfully",
"data": "{\"Success\":{}}" // JSON string with ANAF status details
}
load_logo
Description: Uploads a logo image to the fiscal device for printing on receipts.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
image_data | string | Yes | Base64-encoded image data (PNG, JPG, etc.) |
Response:
{
"status": 0,
"msg": "Operation completed successfully"
}
fiscal_memory_report
Description: Generates a fiscal memory report for a specified date or Z-number range.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
range | FiscalRange | Yes | Date or Z-number range |
report_type | string | Yes | "short" or "detailed" |
FiscalRange Object
// Date range
{
"start": "2023-12-01",
"end": "2023-12-31"
}
// Z-number range
{
"start": 1,
"end": 10
}
Response:
{
"status": 0,
"msg": "Operation completed successfully"
}
je_report
Description: Generates an electronic journal (JE) report with filtering options.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
range | JeReportRange | Yes | Range specification for the report |
doc_type | string | Yes | Document type filter |
output_mode | string | Yes | Output destination |
JeReportRange Object
// Date range
{
"type": "date",
"start": "2023-12-01",
"end": "2023-12-31"
}
// Z-number range
{
"type": "z_number",
"start": 1,
"end": 10
}
// Document number range
{
"type": "doc_number",
"start": 100,
"end": 200
}
Document Types
"all"- All document types"fiscal_receipts"- Only fiscal receipts"z_reports"- Only Z reports"invoices"- Only invoices"non_fiscal_receipts"- Only non-fiscal receipts"numerar"- Only cash operations
Output Modes
"print_on_device"- Print report on fiscal device printer"read_line_by_line"- Return report data for display/processing
Response:
{
"status": 0,
"msg": "Report data retrieved successfully",
"data": "Report content..." // Contains report data if output_mode is "read_line_by_line"
}
POS Terminal Operations
The following operations are available for POS payment terminals:
sale
Description: Initiates a payment transaction on the POS terminal.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
amount | integer | Yes | Transaction amount in cents (must be > 0) |
Response:
{
"status": 0,
"msg": "Sale successful: [transaction_details]"
}
settlement
Description: Performs an end-of-day settlement on the POS terminal.
Parameters: None
Response:
{
"status": 0,
"msg": "Settlement successful: [settlement_details]"
}
Common Response Format
All device operations return a standardized response format:
{
"status": 0, // 0 = success, non-zero = error
"msg": "Operation description", // Human-readable message
// ... additional operation-specific fields
}
For error responses, the format is:
{
"status": [error_code], // Negative number for errors
"error": "Error description" // Detailed error message
}
Usage Examples
See the HTTP API and WebSocket API pages for complete examples of how to invoke these operations.