=== Flexible Invoices for WooCommerce - KSeF Add-on ===
Contributors: vvperyk, wpdesk
Tags: invoices, ksef, invoice, flexible invoices, woocommerce
Requires at least: 6.4
Tested up to: 6.9
Requires PHP: 7.4
Stable tag: 2.3.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Donate link: https://wpdesk.net/sk/support

Easily send invoices from Flexible Invoices straight to KSeF using the official Ministry of Finance API.

== Description ==
KSeF - invoice registration from Flexible Invoices is a WordPress plugin that lets you send invoices directly to KSeF (Polish National e-Invoice System). It works as an extension for Flexible Invoices and uses the official KSeF API provided by the Polish Ministry of Finance.

The plugin allows you to submit invoices from WordPress and WooCommerce straight to KSeF, without exports or external systems. invoice status, KSeF reference numbers, and error messages are all available inside the WordPress dashboard.

This plugin is an add-on for [Flexible Invoices](https://wpdesk.link/fi-rm) and therefore requires the Flexible Invoices plugin in min. version min. 6.2.0.
If you also want to use automatic invoice generation, or issue invoices in the OSS standard, opt for the [Flexible Invoices PRO](https://wpdesk.link/ksef-fi-rm) in version 5.3.0 or higher.

== Key Features ==

* Direct invoice registration to KSeF from Flexible Invoices
* One-click sending of individual invoices to KSeF
* Bulk invoice registration to the National e-Invoice System (KSeF)
* Clear KSeF status displayed in the invoice list
* Dedicated KSeF metabox showing:
  * invoice registration status
  * registration date
  * KSeF reference ID
  * KSeF API error messages
* Integration with the official KSeF API
* Full compatibility with [Flexible Invoices](https://wpdesk.link/fi-rm) and  [Flexible Invoices PRO](https://wpdesk.link/ksef-fi-rm)

== How it works ==

1. Install and activate [Flexible Invoices](https://wordpress.org/plugins/flexible-invoices/)
2. After installing the plugin, go to Invoices → Reports → KSeF to connect the store with the invoice system.
3. Enter your KSeF API credentials in the plugin settings.
4. Send invoices to KSeF:
   * individually with one click
   * in bulk using bulk actions
5. Monitor invoice status and KSeF details directly in WordPress.

== Screenshots ==

1. Invoice list with KSeF status column.
2. KSeF metabox in invoice edit screen showing status and details.

== Frequently Asked Questions ==

= What does this plugin do? =

It allows you to send invoices from Flexible Invoices directly to KSeF.

= Does it support the FA(2) format? =

Yes. All submitted invoices comply with KSeF requirements and the FA(2) format.

= Can I send multiple invoices to KSeF at once? =

Yes. Bulk invoice registration to KSeF is supported.

= Does this plugin work without Flexible Invoices? =

No. This plugin is an extension and requires Flexible Invoices to be installed and active.

== Data Use Policy ==

This plugin connects to the official KSeF API (provided by the Polish Ministry of Finance) to send invoices generated by the Flexible Invoices plugin.

This connection is required to send and verify electronic invoices (FA(2)).

When sending a document, the following data is transmitted:
- Invoice data (required by law)
- Your KSeF access token or credentials (configured in plugin settings)

This service is provided by the Ministry of Finance of the Republic of Poland:
1. [API documentation](https://www.podatki.gov.pl/ksef/)
2. [Privacy policy](https://www.gov.pl/web/gov/polityka-prywatnosci)

WP Desk plugins collect anonymous diagnostic and configuration data to enhance product quality, stability, and alignment with user needs. This data is securely transmitted once after plugin activation and once a week later on, to WP Desk's servers at testsdata.wpdesk.org and data.wpdesk.org for statistical analysis, technical issue identification, and plugin performance optimization.
All data collection is conducted anonymously, without storing personal, financial, or sensitive business information. The application does not collect data without users knowledge. Data collection requires an users opt-in through the plugin settings.

[Learn more about it in docs](https://wpdesk.pl/sk/docs-fi-ksef)

== Changelog ==

= 2.3.1 - 2026-04-28 =
- Fixed problem with ID data for Entity 3 (recipient) in generated XML. Now it generates the same way Entity 2 does.

= 2.3.0 - 2026-04-28 =
- Added notice in KSeF metabox informing about unsaved changes in invoice.
- Improved api error handling
- The method for generating the XML file has been completely overhauled
- Added fiksef_xml_data filter for modifying data used for XML generation

= 2.2.3 - 2026-04-13 =
- Fixed problem with corrections and entity3 being added to xml.
- Fixed problem with reconciliation - bad query was searching for invoices that haven't been yet sent
- Fixed problem with missing ksefNumber causing critical error for documents already sent to ksef

= 2.2.2 - 2026-04-07 =
- Fixed problem with corrections and np rate.
- Fixed correction to invoice link. KSeF number is now used instead of reference number to link correction to invoice.
- Fixed problem with totals for np. rate for invoices. P_13_8 and P_13_9 are now filled with sum of np I and np II correspondingly.
- Fixed problem with reference number instead of KSeF number showing in certain places

= 2.2.1 - 2026-03-30 =
- Fixed problem with prefixed vat numbers. Plugin now automatically removes prefix from entered vat numbers when needed.

= 2.2.0 - 2026-03-30 =
- Added automatic retry every 8 hours for invoices that failed to send due to network issues.
- Added support for NP tax rate.

= 2.1.2 - 2026-03-25 =
- Changed XML generation rules.
- Field P_6 is sent only if it differs from P_1
- The DataWytworzeniaFA field contains the date the XML was generated
- The DataZamowienia field has been removed from the generated XML

= 2.1.1 - 2026-03-23 =
- Fixed problem with entity 3 being added if recipients name is equal to single space

= 2.1.0 - 2026-03-23 =
- Added support for 0 WDT/KR/EX rates. Proper rate is automatically assigned based on invoice and woocommerce order
- Added ability to enable/disable sending of foreign documents
- JSV, GV parameters are now set to 2 by default
- Fixed styles for wordpress 7.0 compatibility

= 2.0.14 - 2026-03-03 =
- Minor changes in displaying error messages
- Mapped 'przelew-bankowy' and 'gotowka' as payment methods
- Added fiksef_services_initial_validation_reasons filter for modifying internal document validation

= 2.0.13 - 2026-02-25 =
- Fixed issue with special characters in entity names, item names and notes
- Document notes are now placed in invoice footer instead of payment method name. Use fiksef_xmldata_footer filter to dynamically modify value

= 2.0.12 - 2026-02-24 =
- Fixed an issue with discounts on documents
- Fixed an issue with the recipient on invoices. By default, the recipient role is set to "Odbiorca". To change the role, use the "fiksef_xmldata_entity3_role" filter
- B2C invoices are now marked correctly

= 2.0.11 - 2026-02-19 =
- Fixed a critical error in the KSeF metabox when some settings were not saved.

= 2.0.10 - 2026-02-09 =
- Minor changes and UI updates
- WooCommerce is no more required for this plugin to work
- Plugin uses order number instead of order id

= 2.0.9 - 2026-02-04 =
- Minor changes and UI updates
- Fixed problem with sending invoices without VAT number

= 2.0.8 - 2026-02-04 =
- Minor changes and UI updates
- Updated API routes
- Added support for FA (3) file

= 2.0.7 - 2026-02-02 =
- KSeF submenu is now always visible if the plugin is active

= 2.0.6 - 2026-01-29 =
- Added ability to send documents with customers without vat number

= 2.0.5 - 2026-01-26 =
- Added ability to fill exempt reason
- Duplicate handling added

= 2.0.4 - 2026-01-20 =
- Updated API environments paths
- Added download button for downloading XML (after enabling it with filter)

= 2.0.3 - 2026-01-15 =
- Fixed deprecated notice on PHP version 8.4 and newer
- Fixed fatal error related to closing session

= 2.0.2 - 2025-12-29 =
- Removed metabox for proformas
- Removed ability to try sending without authenticated connection
- Changed position of settings page

= 2.0.1 - 2025-12-16 =
- Missing repository images, updated readme

= 2.0.0 - 2025-12-16 =
- Support for KSeF API v2

= 1.0.0 - 2025-07-21 =
- Initial release with manual and bulk invoice sending to KSeF.
