Printing tickets

Third-party apps can print receipts by sending a structured ticket payload. You only populate the ticket data; honei handles layout and routing to the available printer (on-device printer or ESC/POS)

Integration flow

Device & Routing Behavior

  • S1F2: prints on the integrated printer with optimized defaults.

  • S1E2: prints via ESC/POS. honei selects and drives the available printer automatically.

  • No extra configuration is required on the caller side; just send the payload.

Intent Action

To trigger a print, launch an intent with the following action and extra:

String payload =
  "{"
+ "\"tableName\":\"Mesa 5\","
+ "\"ticketNumber\":\"12\","
+ "\"numberOfGuests\":2,"
+ "\"date\":\"24/02/2025\","
+ "\"subtotal\":77.73,"
+ "\"total\":85.50,"
+ "\"taxAmount\":7.77,"
+ "\"taxRate\":0.10,"
+ "\"items\":["
+ " {\"units\":1,\"name\":\"Hamburguesa con queso\",\"unitPrice\":12.50,\"price\":14.50,"
+ "  \"modifierOptions\":[{\"name\":\"Extra queso\",\"supl\":2.00}]},"
+ " {\"units\":1,\"name\":\"Coca Cola\",\"unitPrice\":3.50,\"price\":3.50,\"modifierOptions\":[]}"
+ "]"
+ "}";
Intent intent = new Intent("app.honei.terminal.PRINT_TICKET");
intent.putExtra("data", payload);
// Start the intent as task
startActivityForResult(intent, 1001);

Parameters

Key
Type
Description

data

String

stringified JSON described below.

Ticket Payload (Schema)

Field
Type
Required
Notes

tableName

String

No

Table/area label shown on ticket.

ticketNumber

String

No

Your internal ticket/order number.

numberOfGuests

Number

No

For dine-in contexts.

date

String

Yes

Display date/time; if omitted, device time may be used.

subtotal

Number

Yes

Sum of item price before taxes.

total

Number

Yes

Subtotal + taxes (+ service/fees if any).

taxAmount

Number

Yes

Total tax amount (matches total - subtotal if only one tax).

taxRate

Number

No

Decimal form (10% = 0.10). Optional if multiple rates apply.

items

Array

Yes

See Items tab

Example

{
  "tableName": "Mesa 5",
  "ticketNumber": "12",
  "numberOfGuests": 2,
  "date": "24/02/2025",
  "subtotal": 77.73,
  "total": 85.50,
  "taxAmount": 7.77,
  "taxRate": 0.10,
  "items": [
    {
      "units": 1,
      "name": "Hamburguesa con queso",
      "unitPrice": 12.50,
      "price": 12.50,
      "modifierOptions": [
        {
          "name": "Extra queso",
          "supl": 2.00
        }
      ]
    },
    {
      "units": 1,
      "name": "Coca Cola",
      "unitPrice": 3.50,
      "price": 3.50,
      "modifierOptions": []
    }
  ]
}

Receiving Result

When launching a PRINT_TICKET intent, honei Terminal returns a result code to your app:

  • RESULT_OK → the ticket was successfully printed.

  • RESULT_CANCELED → the ticket could not be printed. In this case, the intent will include an errorMessage in the data extras.

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
  super.onActivityResult(requestCode, resultCode, data);

  if (requestCode != 1001) return;

  if (resultCode == RESULT_OK) {
    // Ticket was printed
    Log.d("PrintResult", "Printing successful");
  } else {
    // Ticket not printed
    if (data != null) {
      String errorMessage = data.getStringExtra("errorMessage");
      Log.e("PrintResult", "Printing failed: " + errorMessage);
    } else {
      Log.e("PrintResult", "Printing failed: Unknown error");
    }
  }
}

Last updated