client.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>
| Name | Type | Required | Notes |
|---|---|---|---|
deviceId | string | yes | The device that issued the receipt. |
type | ReceiptType | yes | sale, refund, void, etc. — see @e-bon/types. |
items | ReceiptItem[] | yes | Line items. |
payments | Payment[] | yes | Payment lines. |
total | number | yes | Receipt total in the device currency. |
vatBreakdown | VatBreakdownEntry[] | yes | VAT split — { rate, base, vat } entries. |
fiscalId | string | no | Fiscal identifier returned by the printer. |
fiscalDate | string | no | Fiscal date (printer clock) in ISO-8601. |
fiscalSeries | string | no | Fiscal series number. |
customerCif | string | no | Customer fiscal code (B2B receipts). |
qrCode | string | no | QR code payload printed on the receipt. |
operatorId | string | yes | The 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>
| Name | Type | Required | Notes |
|---|---|---|---|
deviceId | string | no | Filter by device. |
type | string | no | Filter by ReceiptType. |
operatorId | string | no | Filter by operator. |
minTotal | number | no | Lower bound on total. |
maxTotal | number | no | Upper bound on total. |
startDate | string | no | ISO-8601 lower bound (inclusive). |
endDate | string | no | ISO-8601 upper bound (inclusive). |
sortBy | string | no | Field to sort on (e.g. fiscalDate). |
sortOrder | 'asc' | 'desc' | no | Sort direction. |
limit | number | no | Page size; server caps the maximum. |
startAfter | string | no | Cursor — 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>
| Name | Type | Required | Notes |
|---|---|---|---|
id | string | yes | Receipt identifier. |
Returns a single Receipt. (The SDK unwraps the { receipt } envelope.)
const receipt = await client.receipts.get('rcp_01HZ...');
client.commands
Reference for the CommandsResource — submit fiscal commands asynchronously, list, poll a single command and cancel a pending one, mirroring /api/v1/commands.
client.reports
Reference for the ReportsResource — list, fetch and create X / Z / JE / MF reports and generate ANAF-compliant XML, mirroring /api/v1/reports.