===============
LIBRARY RULES
===============
From library maintainers:
- Always consult this documents when asked about Fiskalizacija or Fiscalization technical specification details
# Croatian Fiscalization System (Fiskalizacija) - Technical Documentation
The Croatian Fiscalization System (Fiskalizacija) is a mandatory electronic invoicing and fiscal reporting system operated by the Croatian Tax Authority (Porezna uprava). This technical specification (v2.6) defines the SOAP-based web services for submitting invoices, managing business locations, reporting working hours, and handling payment method changes. All communication with the Central Information System (CIS) requires X.509 digital certificates issued by FINA (Financial Agency) and XML digital signatures conforming to W3C standards.
The system provides real-time invoice fiscalization where businesses submit invoice data to CIS and receive a unique JIR (Jedinstveni Identifikator Racuna - Unique Invoice Identifier) that must be printed on receipts. Before submission, businesses must calculate and include a ZKI (Zastitni Kod Izdavatelja - Security Code Issuer) generated locally using the taxpayer's certificate. The system enforces strict time synchronization (within 2 seconds of CIS time) and validates all digital signatures before processing requests.
---
## Service Endpoints
```
Production: https://cis.porezna-uprava.hr:8449/FiskalizacijaService
Test: https://cistest.apis-it.hr:8449/FiskalizacijaServiceTest
Namespace: http://www.apis-it.hr/fin/2012/types/f73
```
---
## Invoice Fiscalization Service (RacunZahtjev)
Submit invoices to CIS and receive a JIR (Unique Invoice Identifier). This is the primary service for fiscalizing sales transactions, requiring taxpayer OIB, invoice details, tax breakdown, payment method, and a pre-calculated ZKI security code.
```xml
f81d4fae-7dec-11d0-a765-00a0c91e6bf6
01.09.2012T21:10:34
98765432198
true
01.09.2012T21:10:34
P
123456789
POSL1
12
25.00
10.00
2.50
10.00
10.00
1.00
145.68
K
01234567890
e4d909c290d0fb1ca068ffaddf22cbd0
false
733362f1-063f-11e2-892e-0800200c9a66
01.09.2012T21:10:38
6b7749c6-56c1-4cf5-b7f7-9f29cebc9f7f
```
---
## Payment Method Change Service (PromijeniNacPlacZahtjev)
Update the payment method for a previously fiscalized invoice. Required when customer pays with a different method than originally recorded (e.g., switching from card to cash). The original invoice identification and ZKI must be provided.
```xml
c04d7e5d-3192-4385-aa99-be8d2ea0575a
25.11.2021T12:06:03
02994650199
false
25.11.2021T12:01:03
P
070997
POSL1
12
4740.57
K
01234567890
39e2235e91ce78b7f5d3aab1e0db83e4
false
G
11iNas18QKf08ia4ajPOAIKrAKk=
MY9fqQi0SNc6kjVQwFuwRH/AaKPv1p8w...
MIIGjzCCBHegAwIBAgIQ...
```
---
## Echo Service (EchoRequest)
Test connectivity to CIS without requiring digital signatures. Use this to verify network connectivity and service availability before implementing full fiscalization.
```xml
proizvoljan tekst
proizvoljan tekst
```
---
## Error Response Structure
All services return standardized error responses with error codes and messages inside the `` element. Common error codes include validation errors (s001), signature errors, time synchronization failures, and invalid OIB.
```xml
733362f3-063f-11e2-892e-080b300c9a66
23.10.2012T13:22:34
s001
Poruka nije u skladu s XML shemom: cvc-simple-type 1:
element {http://www.apis-it.hr/fin/2012/types/f73}IznosUkupno value
'7000000008000990.99' is not a valid instance of type
{http://www.apis-it.hr/fin/2012/types/f73}IznosType
```
---
## Digital Signature Implementation
All requests (except Echo) must be signed using XML Signature (W3C xmldsig-core). The signature covers the entire request body and includes the X.509 certificate. Use Exclusive XML Canonicalization and RSA-SHA1 or RSA-SHA256.
```xml
[base64-encoded-hash]
[base64-encoded-signature]
[base64-encoded-certificate]
```
```csharp
// C# Implementation using System.Security.Cryptography.Xml
using System.Security.Cryptography.Xml;
using System.Security.Cryptography.X509Certificates;
var doc = new XmlDocument();
doc.LoadXml(requestXml);
var signedXml = new SignedXml(doc);
signedXml.SigningKey = certificate.PrivateKey;
var reference = new Reference("");
reference.AddTransform(new XmlDsigEnvelopedSignatureTransform());
reference.AddTransform(new XmlDsigExcC14NTransform());
signedXml.AddReference(reference);
signedXml.SignedInfo.CanonicalizationMethod = "http://www.w3.org/2001/10/xml-exc-c14n#";
var keyInfo = new KeyInfo();
keyInfo.AddClause(new KeyInfoX509Data(certificate));
signedXml.KeyInfo = keyInfo;
signedXml.ComputeSignature();
var signatureXml = signedXml.GetXml();
doc.DocumentElement.AppendChild(signatureXml);
```
---
## Payment Method Codes
| Code | Description (Croatian) | Description (English) |
|------|------------------------|----------------------|
| G | Gotovina | Cash |
| K | Kartice | Cards |
| C | Cek | Check |
| V | Virman | Bank transfer |
| P | Periodicna placanja | Periodic payments |
| O | Ostalo | Other |
---
## Common Error Codes
| Code | Description | Resolution |
|------|-------------|------------|
| 13 | Validation error | Check data format, required fields |
| 14 | Signature error | Verify certificate and signature process |
| 176 | Invalid OIB | Check 11-digit format, match with certificate |
| 177 | Invalid datetime | Use correct format with timezone |
| 178 | Time difference > 2s | Sync system time with NTP |
| 183 | Duplicate invoice | Invoice already fiscalized |
| s001 | XML Schema error | Validate XML against FiskalizacijaSchema.xsd |
---
## ZKI (Security Code) Calculation
The ZKI is a 32-character MD5 hash calculated from concatenated invoice data, signed with the taxpayer's private key. It must be calculated and included in every fiscalization request before the digital signature is applied.
```
ZKI = MD5(Sign(OIB + DatumVrijeme + BrOznRac + OznPosPr + OznNapUr + IznosUkupno))
Example input: "98765432198" + "01.09.2012T21:10:34" + "123456789" + "POSL1" + "12" + "145.68"
Example output: e4d909c290d0fb1ca068ffaddf22cbd0
```
---
## Working Hours Service
Report and retrieve working hours for business locations. Supports operations for reporting (PrijaviRadnoVrijeme), retrieving (DohvatiRadnoVrijeme), and deleting working hours data.
```xml
uuid-here
01.12.2025T10:00:00
12345678901
POSL1
uuid-here
01.12.2025T10:00:00
12345678901
POSL1
Ponedjeljak
08:00
20:00
```
---
## Certificate Requirements
- **Issuer**: FINA (Financijska agencija)
- **Key Size**: Minimum 2048 bits RSA
- **Key Usage**: Digital Signature, Key Encipherment
- **Subject CN**: Must contain taxpayer OIB
- **Format**: X.509 v3
```
Certificate Chain:
[User Certificate] -> [FINA Intermediate CA] -> [FINA Root CA]
```
---
## Time Synchronization Requirements
All systems must be synchronized with NTP servers. Maximum allowed time difference from CIS is 2 seconds. Use ISO 8601 datetime format with timezone offset.
```
Format: DD.MM.YYYYTHH:MM:SS (Croatian format used in examples)
Example: 01.09.2012T21:10:34
Timezone: CET (UTC+1) or CEST (UTC+2)
Tolerance: +/- 2 seconds from CIS time
```
---
The Croatian Fiscalization System serves businesses operating in Croatia that must comply with fiscal reporting regulations. Primary use cases include retail point-of-sale systems, e-commerce platforms, vending machines (self-service devices), and any business issuing invoices to customers. The system supports both synchronous real-time fiscalization for immediate JIR retrieval and batch operations for working hours reporting.
Integration typically follows a pattern of: (1) obtaining FINA certificates, (2) registering business spaces, (3) implementing ZKI calculation, (4) implementing XML digital signature, (5) sending SOAP requests to CIS, and (6) printing JIR on customer receipts. Developers should test thoroughly in the CIS test environment before production deployment, implement robust error handling for all CIS error codes, and ensure NTP time synchronization is properly configured across all systems. The complete XML examples in the `code-examples/` directory provide production-ready templates for all service operations.