General information
KSeF represents one of allowed forms of documenting transactions, along with paper invoices and electronic invoices, currently present in economic circulation.
Structured invoice is an invoice issued by taxpayers with the use of a data transmission system (KSeF), marked with an invoice identification number assigned in the system.
Receiving structured invoices with the use of KSeF requires invoice recipient’s acceptance. In case the recipient does not agree to receive documents in such form, the issuer is authorized to issue a structured invoice in the system, but its transfer should be performed in a way agreed with the recipient.
- 145.237.204.177 – aceess to test environment
- 145.237.204.182 – aceess to demo environment
- 145.237.204.187 – access to production environment
Port 443 must also be accessible.
Changes to company configuration
On the company form, in Trade section, parameter Use KSeF was added. The parameter:
- is presented on the form only if VAT Rate Group is set to PL
- can be selected/deselected at any moment during the work with the system
- by default, is deselected on newly created and converted databases
After checking the parameter, a control field allowing for indicating the start date of KSeF handling, is presented (by default, the current date is set) and additional tab KSeF is added to the company form and contains the following parameters:
- Automatically download the uploaded invoice files as attachments
- Download OAR as attachments
- Multiple document export mode – with values: Interactive session (default option), batch file
- Automatic KSeF verification prior to document confirmation
- Authentication – this section is filled-in automatically when generating a token on the basis of the properties of the certificate for which the token is being generated. Depending on data inserted for the certificate, TIN number or NIN number. It is necessary to establish a correct communication with KSeF. The certificates must be installed on the environement with Comarch ERP Standarrd system installed.
- Generate invoices in VAT account – account in which VAT invoices are to be generated
- Generate corrections in VAT account – account in which corrections are to be generated
By default, the VAT account set as default in a given center, is retrieved to these fields. If no VAT account is selected under configuration, it will not be possible to generate VAT invoices (the [VAT Invoice] button on the KSeF Purchase Invoices list will be insensitive).
- FA Scheme
- Document Export – contains the Reference number parameter with values: Reference number and System number
On the ribbon displayed in the KSeF tab, new button group KSeF was added and it contains the following buttons:
- Generate Token – after clicking the button, a token for the authenticated entity is generated, also the value of the entity ID and the token are entered in dedicated fields in the KSeF tab
- Delete Token – this button is active only if a token has already been generated.
On the company form, in Operators tab, there is Token Authentication in KSeF column. It is presented only if KSeF handling is activated (it cannot be edited in subordinated centers). If the operator executes an action related do KSeF handling that requires authentication and if on the company form, in Operators tab, in Assigned Operators, table, the parameter Token Authentication in KSeF is:
- checked, authenticated data transferred to KSeF consists of: ID and token set for the company on the tab KSeF.
- unchecked, it is necessary to open the window for certificate selection and transfer to KSeF the parameters of the selected certificate as authentication data.
In the tab, there is also parameter KSeF Work Environment with the following options:
- Demo,
- Development,
which allows specifying working mode of the KSeF component with selected environment. In case a token used for the communication with KSeF was already generated, before changing environment, first, it is necessary to delete that token.
Changes to document definitions
In the definitions of the following documents:
- Sales invoice (SI)
- Sales invoice quantity correction (SIQC)
- Sales Invoice Value Correction (SIVC)
- Sales Invoice VAT Correction (SITC)
- Advance Sales Invoice (ASI)
- Advance Sales Invoice Value Correction (ASIVC)
parameter Automatically upload to KSeF is available (checked, by default). It is presented only if the option of KSeF handling is activated in the company configuration.
Authorizations on operator group
On the operator group form (Configuration → Operator Groups), in Other Permissions tab, the following elements are available:
- Upload invoices to KSeF
- Download invoices from KSeF
- Edit KSeF number in a confirmed document
- Print invoices not uploaded to KSeF
These permissions are unchecked, by default.
Changes to customer/vendor form
On customer/vendor form, parameter Collect invoices via KSeF, is available and it is presented, if:
- the function of KSeF handling is activated on the company form
- customer/vendor type: National
- customer/vendor status: Entity
If the parameter is checked by the operator, the system can automatically uncheck in case of changing:
- the type of customer/vendor to EU or Non-EU
- customer/vendor status to retail customer
Additionally, parameter Send e-mail about issued SI is available, which allows for informing the customer by e-mail about the KSeF invoice issuance and sending in to KSeF. After e-mail messages are configured in Comarch ERP Standard and the parameter is selected, an e-mail message informing about an issued invoice is sent to the specified e-mail account when receiving an OAR and a KSeF invoice number. In tab Customer’s/Vendor’s Contact Details on customer/vendor form, there is a dedicated contact type KSeF e-mail for sending e-mail message to inform about a SI issued in KSeF.
KSeF-related changes to the list of sales invoices, their corrections and advance invoices
On the ribbon above the list of sales invoices, KSeF group of buttons is available and it contains the following buttons:
- Export
- Download OAR
- Check Correctness
On the list of sales invoices and purchase invoices, additional columns (hidden by default) are available, which optimize the work with KSeF:
- KSeF Number – presents the number from the control field of the analogical field on the invoice form
- KSeF Source Invoice No. – presents KSeF number of the source invoice to which the correction is issued
- KSeF Issue Date – (unavailable on the PI list)
KSeF-related changes to documents
In the header of the documents: sales invoice, its corrections (SIQC, SIVC, STIC), advance sales invoice and its corrections, the following fields are available:
- KSeF number
- KSeF status – the value of the field is displayed depending on the status of the communication with KSeF (Uploaded, Not Uploaded, OAR Downloaded, Rejected)
In case of purchase invoice, advance purchase invoice and their corrections, on document forms only KSeF Number field is presented.
KSeF-related changes to accounting documents
On accounting documents, the following elements are available:
- columns: KSeF Number and KSeF Source Invoice No. on the list of VAT accounts
- fields: KSeF Number and KSeF Status on the form of VAT sales/purchase invoice and their corrections – values of the fields are transferred, by default, from the source document.
In the case of VAT invoices/corrections added manually to the account, the value of the parameter KSeF Status can be set to:
- Not Uploaded (default value)
- Uploaded
- OAR Downloaded
Changes to generic directories
In generic directory Attachment Types, system value with the following parameters is available:
- Value: KSeF file
- Description: Xml file (*.xml)|*.xml
- Active: Yes
- Default: No
- Compression: Yes
- Write: File in database
- Size limit (bytes) No limits
Verification of invoice correctness in terms of KSeF file structure
Manual verification is activated after clicking on the [Check Correctness] button, available from the level of invoice form. Automatic verification is executed during the attempt of confirming a document from the level of details or of the list, if on the company form, the Automatic KSeF verification prior to document confirmation parameter is checked.
Regardless of selected verification method, if the attempt is:
- successful, in the information bar information KSeF verification: positive
- failed, in the information bar, information KSeF verification: negative is presented and returned error/errors are presented in the details
Exporting documents to KSeF
Exporting individual source documents to KSeF (SI and ASI)
Documents can be exported manually or automatically. For the manual export, the button is available, if:
- the currently logged-in user is authorized to export documents to KSeF
- document has Confirmed or Printed for SI and ASI and Confirmed for SIQC, SIVC, SITC, ASIVC.
- KSeF status of the document has value Not Upload or Rejected
- the issue date of the document is equal or later than the date set in the company configuration of the parameter Use KSeF from
If checked, when confirming a document, the system verifies the saving of the document operations history:
- after correct verification of a document, the document is confirmed and then sent to KSeF
- If document verification is failed, the document will remain unconfirmed and will not be sent to KSeF.
Exporting single corrections to KSeF (SIQC, SIVC, SIVC, ASIVC)
- the currently logged-in user is authorized to export documents to KSeF
- document status is Confirmed
- document correction is uploaded to KSeF regardless of whether the source document was uploaded to KSeF
- KSeF status of the document has value Not Upload or Rejected
- the issue date of the document is equal or later than the date set in the company configuration of the parameter Use KSeF from
Exporting many documents to KSeF
Depending on the setting of the parameter Multiple document export mode, which is available on the company form, export of many documents can be performed in one of the following modes:
- interactive session
- batch file
After selecting on the list of invoices more than one element and clicking on the [Export] button, the system verifies whether the operator is authorized to export the document to KSeF. IF the operator has authorization assigned, then, depending on the settings of the parameter, the interactive section is checked or export in batch file is activated. If the authorization is not assigned, the system blocks the operation.
Among documents selected by the user, the following documents are ignored:
- documents with status: Initiated, Unconfirmed and Canceled
- with KSeF status different than Not-Uploaded or Rejected
- with the issue date earlier than the date set in the company configuration of the parameter Use KSeF from
- that have already been printed
- that are not compliant with the structured invoice scheme
Additionally, it is also possible to export many documents for a given period – after selecting [Export For Period] button and verifying operator’s authorizations, additional window, in which it is necessary to fill-in export details, is presented:
- Field Day/Range of Dates – allows for specifying dates of exported documents
- Field Owner – allows for exporting document issued in a selected center
- Button [Export] and [Cancel] – the mechanism of export verification is analogical to the mechanism activated by the [Export] button
Printing sales invoices sent to KSeF
An invoice sent uploaded to KSeF can be sent to the recipient also as a printout, e-mail or e-Invoice. Since uploading to KSeF an invoice that was previously delivered to the recipient is considered as issuing subsequent (new) invoice, the functionality that blocks the possibility of exporting previously printed or sent via e-mail invoices to KSeF, has been introduced.
In case in the company configuration, the option of handling KSeF is activated, then, when trying to print a document, the system verifies whether:
- the document issue date is earlier than the date set in the company configuration for the parameter Use KSeF from, then, regardless of the setting of the parameter Collect invoices via KSeF, on the customer form, the document is print without checking subsequent conditions
- the document issue date is equal or later than the date set in the company configuration for the parameter and the parameter Handle KSeF is unchecked, then it is necessary to verify document KSeF number:
- If it is assigned – printing is started
- IF there is no KSeF number assigned, it is necessary to check whether the operator is authorized to print invoices not uploaded to KSeF – if such authorizations are assigned, a window with a dedicated message and buttons [Print] and [Cancel] are displayed
- the document issue date is equal or later than the date set in the company configuration for the parameter and the parameter Handle KSeF is checked, then it is necessary to verify document KSeF number: If there is no KSeF number, the error is presented.
Importing purchase invoices from KSeF
In the Purchase menu, there is a new list Import KSeF under the button group Documents. This list is used to import invoices from the National System of e-Invoices.
Selecting this button opens a list of purchase invoices imported from KSeF. The list is composed of such columns as:
- document date of issue and date of receipt
- vendor’s TIN and name
- reference number
- invoice values
On this list you can ergonomically manage the process of importing PI from KSeF, view invoices or control possible document duplication.
Above the list, the following buttons are available:
- Import
- Import for Period – allows for limiting the list of documents to a selected interval of dates, according to the date on which the invoice was sent or received
Upon selecting each button, the system verifies whether the operator is authorized to import documents from KSeF – if is not authorized, an appropriate message blocking the operation is displayed.
If the button [Import for Period] is selected, additional window allowing for specifying import details, is displayed:
- Invoices By Date with options: Invoices uploaded to KSeF, Invoices received in KSeF
- Start date and end date control field (current dates, by default)
- Import and Cancel buttons
Structured invoices are imported as attachments. On the basis of the attachment file preview, the user can add such document manually to the system from the level of the list of purchase invoices or VAT accounts.
Invoices imported from KSeF can also be visualized. You can now view an invoice without logging on to the KSeF system. To preview the invoice, double-click the selected document.
A structured invoice preview reflects all line items available and consistent with the invoice preview from the Ministry of Finance’s KSeF website.
Imported invoices are presented according to the FA(1) and FA(2) schema, depending on the invoice date in KSeF.
Generating VAT invoices
On the list KSeF Purchase Invoices, in the Generation, the [VAT Invoice] button is available.
Upon selecting this button, you can generate a VPI and a VPIC depending on the data provided in the imported document. After a VAT invoice is generated, a relevant window VPI/VPIC opens, where you can save the generated document.
VAT invoice can be deleted if it is not:
- confirmed
- posted
- paid
- added into a debt collection document
- added into SRO
Generating PI and corrections to invoices imported from KSeF
A purchase invoice and a correction can be generated on the KSeF purchase invoice list using the buttons available in the Generation button group:
- [Invoice] – when generating a PI, some data from document header is completed automatically, the remaining data needs to be completed as it is completed when generating normally a PI
- [Invoice from Document] – generates a PI from PO and POS documents
- [Correction] – opens a correction selection window during generation with field Reason for Correction and a Correction Type list with selectable values:
- Value Correction (selectable for API)
- Quantity Correction
- VAT Invoice Correction (selectable for API)
- Additional Cost Correction
Values and quantities to be corrected in the generated correction should be entered manually based on a previewed correction.
In manual purchase invoice correction and manual VAT purchase invoice, there is the field in the header:
- Corrected Invoice KSeF Number – KSeF number of the source invoice to be entered manually when issuing a document
Associating a document with a KSeF document
A document in the system can be associated with a document in KSeF. This is used when there is already an invoice in the system and, thus, no need to generate a document from KSeF. In the menu Purchase → Import from KSeF → Items tab, there is a new button [Assign] with values:
- PI – opens a window with PI invoice list
- VPI – opens a window with VPI invoice list
After selecting a document, an assignment must then be added.
When attempting to add an assignment to a document that is already associated with another document, the following message is displayed: “Failed to add document association. No attachment has been added to the invoice. The selected document is already associated.”
In the List button group, there is the button [Remove Assignment] that becomes active after selecting a document that is associated with another document in the system.
Retrieving OAR
[Download OAR] button is available on the invoice form, if the KSeF status of the document has value Uploaded. After clicking on the button, in case of response, KSeF sends:
- OAR, then:
- document KSeF status is OAR Downloaded
- KSeF Number on the document is filled-in
- if in the company configuration parameter Download OAR as attachments is checked, then xml file with attached OAR is added. In document changes history, operation KSeF AOR Download is saved with the document upload date.
- information that the session is being initiated or processed, then:
- document KSeF status is not updated
- in document changes history, operation KSeF AOR Download is saved with the processing stage description
- error, then:
- document KSeF status is changed to Rejected
- In document changes history, operation KSeF AOR Download is saved with the error description
Synchronization of KSeF parameters from Comarch POS / Comarch Mobile
When performing the synchronization to Comarch POS and to Comarch Mobile, the following value is sent:
- of the parameter Use KSeF from the company configuration along with its activation date
- value of the parameter Collect invoices via KSeF from the customer form
- value of the KSeF Number field of synchronized sales invoices and their corrections
When importing data, the value of Collect invoices via KSeF parameter, from the customer form, is sent.