e-bon
e-bon.ro
TypeScript SDK

client.receipts

Reference for the ReceiptsResource — store fiscal receipts after printing and retrieve them with cursor-based pagination, mirroring /api/v1/receipts.

client.receipts

client.receipts wraps /api/v1/receipts/* — the receipt store. Receipts are persisted after the fiscal printer has issued them, so this resource is a write-through audit log rather than a printing API. To actually print, use client.commands.send with type: 'print_receipt' or client.devices.sendCommand. See the matching REST documentation at Receipts API.

HTTP-level failures surface as EBonApiError — see Errors and /en/api/errors.

client.receipts.create(body)

Create a receipt (store after fiscal printing).

async create(body: CreateReceiptBody): Promise<Receipt>
NameTypeRequiredNotes
deviceIdstringyesThe device that issued the receipt.
typeReceiptTypeyessale, refund, void, etc. — see @e-bon/types.
itemsReceiptItem[]yesLine items.
paymentsPayment[]yesPayment lines.
totalnumberyesReceipt total in the device currency.
vatBreakdownVatBreakdownEntry[]yesVAT split — { rate, base, vat } entries.
fiscalIdstringnoFiscal identifier returned by the printer.
fiscalDatestringnoFiscal date (printer clock) in ISO-8601.
fiscalSeriesstringnoFiscal series number.
customerCifstringnoCustomer fiscal code (B2B receipts).
qrCodestringnoQR code payload printed on the receipt.
operatorIdstringyesThe operator who issued the receipt.

Returns a single Receipt. (The SDK unwraps the { receipt } envelope.)

const receipt = await client.receipts.create({
  deviceId: 'dev_01HZ...',
  type: 'sale',
  items: [{ name: 'Coffee', quantity: 1, price: 12.5, vatRate: 19 }],
  payments: [{ type: 'cash', amount: 12.5 }],
  total: 12.5,
  vatBreakdown: [{ rate: 19, base: 10.5, vat: 2 }],
  operatorId: 'op_01',
});

client.receipts.list(query?)

List receipts with pagination and filters.

async list(query?: ListReceiptsQuery): Promise<ListReceiptsResult>
NameTypeRequiredNotes
deviceIdstringnoFilter by device.
typestringnoFilter by ReceiptType.
operatorIdstringnoFilter by operator.
minTotalnumbernoLower bound on total.
maxTotalnumbernoUpper bound on total.
startDatestringnoISO-8601 lower bound (inclusive).
endDatestringnoISO-8601 upper bound (inclusive).
sortBystringnoField to sort on (e.g. fiscalDate).
sortOrder'asc' | 'desc'noSort direction.
limitnumbernoPage size; server caps the maximum.
startAfterstringnoCursor — pass the previous page's lastId.

Returns { receipts: Receipt[], hasMore: boolean, lastId: string | null }.

let cursor: string | null = null;
do {
  const page = await client.receipts.list({ limit: 100, startAfter: cursor ?? undefined });
  for (const r of page.receipts) console.log(r.id, r.total);
  cursor = page.hasMore ? page.lastId : null;
} while (cursor);

client.receipts.get(id)

Get a single receipt by ID.

async get(id: string): Promise<Receipt>
NameTypeRequiredNotes
idstringyesReceipt identifier.

Returns a single Receipt. (The SDK unwraps the { receipt } envelope.)

const receipt = await client.receipts.get('rcp_01HZ...');