The fiskaly SDK includes an HTTP client that is needed1 for accessing the kassensichv.io API that implements a cloud-based, virtual CTSS (Certified Technical Security System) / TSE (Technische Sicherheitseinrichtung) as defined by the German KassenSichV (Kassensicherungsverordnung).
- Node 8.0+
- Automatic authentication handling (fetch/refresh JWT and re-authenticate upon 401 errors).
- Automatic retries on failures (server errors or network timeouts/issues).
- Automatic JSON parsing and serialization of request and response bodies.
- Future: [1] compliance regarding BSI CC-PP-0105-2019 which mandates a locally executed SMA component for creating signed log messages.
- Future: Automatic offline-handling (collection and documentation according to Anwendungserlass zu § 146a AO)
The Node.js SDK is available for a download via NPM.
Simply execute this command from the shell in your project directory:
$ npm install fiskaly-sdk-node --save
Or you can manually add the package to your package.json
file:
"dependencies": {
"fiskaly-sdk-node": "*"
}
then run
$ npm install
Finally, be sure to include the sdk in your code:
const { FiskalyClient } = require('fiskaly-sdk-node');
Additionally, to the SDK, you'll also need the fiskaly service. Follow these steps to integrate it into your project:
- Go to https://developer.fiskaly.com/downloads#service
- Download the appropriate service build for your platform
- Start the service
Additionally to the service, Node SDK, support also fiskaly client. The client library is used if your constructor parameter "fiskalyServiceUrl" is not provided.
Follow these steps to integrate it into your project:
- Go to https://developer.fiskaly.com/downloads#client
- Download the appropriate client library for your platform
- Move it to node_modules/fiskaly-sdk-node/lib/client/ directory
// Environment variables
const { FISKALY_SERVICE_URL, FISKALY_API_KEY, FISKALY_API_SECRET, FISKALY_BASE_URL } = process.env;
try {
// SDK Setup
const client = new FiskalyClient(FISKALY_SERVICE_URL);
await client.createContext(FISKALY_API_KEY, FISKALY_API_SECRET, FISKALY_BASE_URL);
const version = await client.getVersion();
console.log("Version", version);
} catch (e) {
// Handle Error
console.error(e);
}
The SDK is built on the fiskaly Client which can be configured through the SDK.
A reason why you would do this, is to enable the debug mode.
The following code snippet demonstrates how to enable the debug mode in the client.
try {
const configParams = {
debug_level: 3,
debug_file: __dirname + '/../fiskaly.log',
client_timeout: 5000,
smaers_timeout: 2000,
}
const newConfig = await client.configure(configParams);
} catch (e) {
// Handle Error
console.error(e);
}