npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

novitus-fiscal-sdk

v1.0.0

Published

UnOfficial TypeScript/JavaScript SDK for Novitus Fiscal Printer API - Type-safe client for receipts, invoices, and non-fiscal printouts

Readme

Novitus SDK for TypeScript/JavaScript

npm version License: MIT TypeScript Node.js GitHub Stars GitHub Issues

UnOfficial TypeScript/JavaScript SDK for the Novitus Fiscal Printer API. This SDK provides a clean, type-safe interface for interacting with Novitus fiscal printers.

Features

  • 🔒 Type-Safe - Full TypeScript support with comprehensive type definitions
  • 🚀 Easy to Use - Simple, intuitive API design
  • Built-in Validation - Automatic validation of documents before sending
  • 🔄 Auto Token Management - Automatic token refresh and expiration handling
  • 🛡️ Error Handling - Custom error classes for better error management
  • 📝 Well Documented - Extensive documentation and examples

Installation

npm install novitus-fiscal-sdk

Or with yarn:

yarn add novitus-fiscal-sdk

Quick Start

import { NovitusClient, Receipt, VATRate } from 'novitus-fiscal-sdk';

// Initialize the client
const client = new NovitusClient({
  host: 'http://localhost:8888',
});

// Initialize (obtains token automatically)
await client.initialize();

// Create a receipt
const receipt: Receipt = {
  items: [
    {
      article: {
        name: 'Tasty Pizza',
        ptu: VATRate.B,
        quantity: '2',
        price: '25.00',
        value: '50.00',
      },
    },
  ],
  summary: {
    total: '50.00',
    payIn: '50.00',
  },
};

// Send receipt with auto-confirm
const response = await client.sendReceipt(receipt, true);
console.log('Receipt sent!', response.request.id);

API Documentation

Client Initialization

import { NovitusClient } from 'novitus-fiscal-sdk';

const client = new NovitusClient({
  host: 'http://localhost:8888',
  token: 'optional-token', // Optional: provide existing token
  timeout: 30000, // Optional: request timeout in ms (default: 30000)
});

// Initialize the client (obtains token if not provided)
await client.initialize();

Token Management

The SDK automatically handles token management, including:

  • Automatic token obtaining on initialization
  • Token refresh before expiration
  • Fallback to new token if refresh fails
// Manual token operations (usually not needed)
const tokenResponse = await client.obtainToken();
await client.refreshToken();

Sending Documents

Receipt

import { Receipt, VATRate } from 'novitus-fiscal-sdk';

const receipt: Receipt = {
  items: [
    {
      article: {
        name: 'Product Name',
        ptu: VATRate.A, // 23% VAT
        quantity: '1',
        price: '100.00',
        value: '100.00',
      },
    },
  ],
  summary: {
    total: '100.00',
  },
};

// Send with auto-confirm
const response = await client.sendReceipt(receipt, true);

Invoice

import { Invoice, VATRate } from 'novitus-fiscal-sdk';

const invoice: Invoice = {
  info: {
    number: 'INV/2025/001',
    dateOfSell: '2025-10-13',
  },
  buyer: {
    name: 'ABC Company Ltd.',
    nip: '1234567890',
  },
  items: [
    {
      article: {
        name: 'Service',
        ptu: VATRate.A,
        quantity: '1',
        price: '1000.00',
        value: '1000.00',
      },
    },
  ],
  summary: {
    total: '1000.00',
  },
};

const response = await client.sendInvoice(invoice, true);

Non-Fiscal Printout

import { Printout } from 'novitus-fiscal-sdk';

const printout: Printout = {
  lines: [
    {
      textLine: {
        text: 'Hello World',
        bold: true,
        center: true,
        masked: false,
      },
    },
  ],
};

const response = await client.sendNFPrintout(printout, true);

Queue Management

// Get queue status
const queueStatus = await client.getQueueStatus();
console.log('Requests in queue:', queueStatus.requestsInQueue);

// Delete queue
const deleteResponse = await client.deleteQueue();
console.log('Status:', deleteResponse.status);

Document Operations

// Check document status
const status = await client.checkDocumentStatus('receipt', requestId);

// Confirm document
await client.confirm('receipt', requestId);

// Delete document
await client.deleteDocument('receipt', requestId);

VAT Rates

The SDK provides an enum for Polish VAT rates:

import { VATRate } from 'novitus-fiscal-sdk';

VATRate.A // 23%
VATRate.B // 8%
VATRate.C // 5%
VATRate.D // 0%
VATRate.E // Exempt
VATRate.F // Not subject to VAT
VATRate.G // Special

Payment Methods

import { PaymentMethod } from 'novitus-fiscal-sdk';

PaymentMethod.Card
PaymentMethod.Cash
PaymentMethod.Transfer
PaymentMethod.Mobile
// ... and more

Error Handling

The SDK provides custom error classes for better error handling:

import {
  NovitusValidationError,
  NovitusApiError,
  NovitusNetworkError,
  NovitusAuthError,
} from 'novitus-fiscal-sdk';

try {
  await client.sendReceipt(receipt, true);
} catch (error) {
  if (error instanceof NovitusValidationError) {
    console.error('Validation failed:', error.field, error.message);
  } else if (error instanceof NovitusApiError) {
    console.error('API error:', error.statusCode, error.errorDescription);
  } else if (error instanceof NovitusNetworkError) {
    console.error('Network error:', error.message);
  } else if (error instanceof NovitusAuthError) {
    console.error('Auth error:', error.message);
  }
}

Examples

Check out the examples directory for more usage examples:

Type Definitions

The SDK is fully typed. All types are exported from the main package:

import {
  // Documents
  Receipt,
  Invoice,
  Printout,
  
  // Items
  Article,
  Advance,
  Container,
  
  // Payments
  Cash,
  TypicalPayment,
  Currency,
  
  // Common
  Summary,
  Buyer,
  SystemInfo,
  
  // Enums
  VATRate,
  PaymentMethod,
  Unit,
  
  // Responses
  TokenResponse,
  QueueResponse,
  CheckDocumentStatusResponse,
} from 'novitus-fiscal-sdk';

Validation

The SDK automatically validates documents before sending:

// This will throw a NovitusValidationError
const invalidReceipt: Receipt = {
  items: [], // Error: items are required
  summary: {
    total: '0.00',
  },
};

await client.sendReceipt(invalidReceipt); // Throws error

API Reference

For detailed API documentation, visit: https://noviapi.novitus.pl/en/

License

MIT

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Support

For issues and questions: