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).

Description: Prints a fiscal receipt with items, payments, and optional buyer information. This is the most complex and important operation in the system.

Parameters:

ParameterTypeRequiredDescription
linesArray<ReceiptLine>YesArray of receipt lines (items, text, and subtotal)
paymentsArray<PaymentLine>Yes*Payment methods and amounts (*auto-calculated if omitted)
buyerBuyerInfoNoBuyer information for invoices
receipt_discountDiscountNoReceipt-level discount or surcharge
flagsReceiptFlagsNoReceipt behavior flags (default: fiscal receipt)
close_actionCloseActionNo"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_discount is 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.

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:

ParameterTypeRequiredDescription
linesArray<NonFiscalLine>YesArray 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"
}

Description: Prints an X report (non-fiscal daily summary).

Parameters: None

Response:

{
  "status": 0,
  "msg": "Report printed",
  "report_number": 45
}

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:

ParameterTypeRequiredDescription
amountintegerYesDeposit 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:

ParameterTypeRequiredDescription
amountintegerYesWithdrawal 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:

ParameterTypeRequiredDescription
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:

ParameterTypeRequiredDescription
rangeAnafExportRangeYesDate or Z-number range for export
destination_pathstringYesFull 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
}

Description: Uploads a logo image to the fiscal device for printing on receipts.

Parameters:

ParameterTypeRequiredDescription
image_datastringYesBase64-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:

ParameterTypeRequiredDescription
rangeFiscalRangeYesDate or Z-number range
report_typestringYes"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:

ParameterTypeRequiredDescription
rangeJeReportRangeYesRange specification for the report
doc_typestringYesDocument type filter
output_modestringYesOutput 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:

ParameterTypeRequiredDescription
amountintegerYesTransaction 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.