this section will be revised and adapted for the certified version 2 of the the fiskaly Cloud-TSS! Version 2 does not need a client or service, you can integrate with a pure HTTPS version.
The fiskaly Client is a stateless HTTP client which handles requests, has client-side validation for the request schema and communicates with the SMAERS component. It is shipped as a set of shared libraries for different operating systems and architectures on our download page. The client uses a slightly modified version of the JSON-RPC 2.0 Protocol to describe requests, responses and errors. The only deviation from the specification concerns notifications, which are not implemented and cause an error. Please make sure you are familiar with the JSON-RPC 2.0 specification before continuing.
The Fiskaly Client exports two functions:
_fiskaly_client_invoke is used to invoke a JSON-RPC 2.0 method. It takes a complete JSON-RPC 2.0 request as its argument and returns the client response.
_fiskaly_client_free is used to free memory allocated by Invoke.
Parameters marked with a star (
*) are optional.
config method lets you configure the client and read the current configuration. It always returns all configuration parameters. You can set timeouts for the client and SMAERS independently, as well as enable the debug mode and configure its output. You can find an in-depth description of the debug mode further down the page. Any given parameters from the
config property are written to the configuration. If you only want to read the configuration, you can omit the
config property completely from the request. If you don't want use system proxy, use
- as a value of
http_proxy parameter. To log to stdout use
To make sure the fiskaly Client is stateless we use a context string that holds all needed information. This string needs to be sent with every method (except the version method) and will also be returned in every response. Make sure to update your stored context with the returned one from the response. Depending on the authentication method you want to use, either API-Key or email and password (latter only usable for the management API), you will need to provide the needed params. This will be either
password. You can also add all of the mentioned params. The client will prioritize authentication via email if the
base_url is for the management API. Otherwise it will always use
To prevent unintentional modification, the context, along with its sha256 hash, is encoded to a base64 string. It is recommended to treat the context as read-only and only use the provided methods to change its contents.
The request method is used to send HTTP requests. The URL is composed of the Base URL defined in the context and the request
path. The Client will automatically validate your inputs. In case of a request to the transaction endpoint of the KassenSichV API the client will also validate the request body and sign it using the SMAERS component.
If your intention is to download a file from one of our APIs (for example in case of an export in the KassenSichV API) you can provide a destination file path. The client will then store the received data in that file. The JSON-RPC response will contain no
body in this case.
The version method returns the version information of the currently used client and SMAERS.
The echo method returns the
params field from the request unmodified. This is used to check if the UTF-8 Encoding in the SDK is done correctly.
The self-test method checks the internal state of the fiskaly Client and fiskaly SMAERS and tries to connect to the fiskaly API. It returns the results of all individual tests.
The fiskaly Client will return errors as defined in the JSON-RPC 2.0 specification. To provide more detailed information on the error cause, the following additional, custom-defined errors can be returned by the fiskaly Client:
To assist troubleshooting, the fiskaly Client includes a debug mode. When enabled, information with variable granularity will be written to a log file. The verbosity is controlled by the
debug_level field in the configuration. Valid debug levels are -1 (no output), 1 (errors only), 2 (errors+warnings) and 3 (errors+warnings+info). The output file can also be set via the config method. Default is
/tmp/fiskaly.log. To write logs into stdout, use
- as a value of
The client is provided as a native library for common target platforms. Implementation-specific details vary between programming languages, therefore detailed instructions cannot be provided in this context. The necessary function signatures can be taken from the Functions section of this document. As all of our SDKs are OSS, you can always use them as a reference implementation.
The returned context contains the provided parameters and the default configuration. Store the context for future reuse and send it with every request. Any method call may modify the context, so it is important to always update the stored context with the returned one. Modifying the context directly may lead to undefined behavior and is strongly discouraged.
This step is optional and only needed if you want to override the default configuration parameters.
request method receives and returns the message body as base64-encoded binary data. This allows any data format to be uploaded and downloaded.
Plain text (JSON)
To store the response body in a file, provide a value to the
destination_file property. HTTP status and header information will still be returned in the response, but the body will be written to the provided file path.