=== La Facterie for WooCommerce ===
Contributors: lafacterie
Tags: woocommerce, e-invoicing, factur-x, invoice, facture-electronique
Requires at least: 6.5
Tested up to: 7.1
Requires PHP: 7.4
Requires Plugins: woocommerce
WC requires at least: 8.3
WC tested up to: 11.2
Stable tag: 0.2.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Sends WooCommerce orders and refunds to La Facterie, which issues French Factur-X e-invoices and prepares e-reporting.

== Description ==

La Facterie for WooCommerce connects your store to [La Facterie](https://lafacterie.com), a French e-invoicing service. The plugin does not create invoices itself. It sends your orders and refunds to your La Facterie account, which issues the Factur-X invoices and credit notes, deposits them with an approved platform (plateforme agréée) and prepares the e-reporting of your sales to consumers.

A La Facterie account is required. The plugin is free. On the free plan of La Facterie, your orders arrive in your account and their invoices stay as previews without a number. Issuing invoices needs a paid plan, see the [prices](https://lafacterie.com/tarifs).

= What the plugin does =

* Sends each paid order to La Facterie. A business order (SIREN, SIRET or VAT number) paid by transfer, cheque or on delivery is sent once placed, as it may be paid weeks later.
* Sends each refund as a credit note (avoir) linked to its invoice, and a full credit note when an invoiced order is cancelled or its payment fails.
* Adds SIREN, SIRET and intra-community VAT number fields to the checkout, with the Checkout block and with the classic checkout. Customers keep them in My account and you can correct them on the order screen.
* Shows the invoice on the order screen (number, status, PDF, credit notes) and in a column of the orders list. Customers download their invoices and credit notes from My account.
* Can join the invoice PDF to your order e-mails once it is issued.
* Works with PDF Invoices & Packing Slips (WP Overnight): can stop its invoices for the orders La Facterie invoices, never two invoices in one e-mail.
* On the free plan, says on each order that its invoice is a preview, and sends the orders that waited again once a paid plan is active.
* Retries on its own when La Facterie cannot be reached, up to 8 times. A refused or blocked order says what to fix, and a button sends it again.
* Adds a La Facterie menu: dashboard, reports with VAT totals, invoices with filters and PDF, support requests.
* Shows your La Facterie plan and this month's usage on the settings page.
* Adds a privacy policy suggestion, a data exporter and an eraser for the identifiers it keeps.
* Supports HPOS and runs its jobs with Action Scheduler, the queue that comes with WooCommerce.
* Shows its screens in French, or in English when WordPress is in English.

= What it does not do =

* It does not issue invoices, keep invoice files or talk to the tax administration. La Facterie does that.
* It does not sell the subscription. You manage it in your La Facterie account.

= About compliance =

No plugin can guarantee legal compliance. La Facterie helps you follow the French e-invoicing rules: it issues Factur-X invoices, deposits them with the approved platform connected to your account and prepares your e-reporting. La Facterie is a compatible solution (solution compatible), not an approved platform. Your VAT settings and the mentions your business needs remain your responsibility.

== External services ==

This plugin connects to La Facterie, an e-invoicing service run by Synthetix Labs Ltd. The service is required: it issues the invoices and credit notes from the data the plugin sends.

The plugin only talks to the La Facterie address set on its settings page, https://app.lafacterie.com by default. Nothing is sent before you save an API key there.

What is sent, and when:

* When an order is paid, when a business order on deferred payment is placed, when you press "Renvoyer à La Facterie", or when orders that waited for a paid plan are sent again: the order number, date and currency, the lines (name, SKU, quantity, price, VAT rate), shipping, fees and discounts, the payment method and date, the customer note, and the buyer's name, company, billing and shipping address, e-mail, SIREN, SIRET and VAT number.
* When a refund is created, or an invoiced order is cancelled: the lines, shipping and fees to credit, with their amounts.
* When a store manager opens an order: the La Facterie ids of its invoice and credit notes, to read their status.
* When someone downloads an invoice or a credit note, or an order e-mail carries the invoice: the id of that document.
* When the settings page is opened or "Tester la connexion" is pressed, and hourly while orders wait for a paid plan: a request for your plan and this month's usage.
* When a manager opens the La Facterie dashboard, reports or invoices: a request for these figures, cached a few minutes.
* When a manager sends a support request or reply: its text and category, the manager's name and e-mail, the store address, WordPress, WooCommerce, PHP and plugin versions, and the related order or document.

Every request carries your API key in the Authorization header, so the address must use https. La Facterie keeps the invoices for the legal retention period (10 years in France) and passes them to the approved platform connected to your account, which delivers them to your business buyers or reports their data to the French tax administration.

The plugin loads no external script, font or image (its charts are drawn on your server) and sends nothing to any other service.

Terms of service: https://lafacterie.com/legal/cgu
Privacy policy: https://lafacterie.com/legal/confidentialite

== Installation ==

1. Install and activate WooCommerce 8.3 or later.
2. Install and activate La Facterie for WooCommerce.
3. In your La Facterie account, create an API key under Paramètres, then API.
4. In WordPress, go to La Facterie > Réglages, paste the API key and press "Tester la connexion". The key is saved and the page shows your plan. The La Facterie address is already filled in.
5. Place a test order. Its invoice number appears in the "La Facterie" box of the order screen.

== Frequently Asked Questions ==

= Do I need a La Facterie account? =

Yes, see https://lafacterie.com to open one.

= How much does it cost? =

The plugin is free. La Facterie has a free plan and paid plans, listed on https://lafacterie.com/tarifs. Issuing invoices, the approved platform, e-reporting and the PDF need a paid plan.

= Is La Facterie an approved platform (PA)? =

No. La Facterie is a compatible solution. It prepares your invoices and deposits them with the approved platform connected to your account.

= Does a wrong SIREN or VAT number block the checkout? =

No. A wrong value never stops a checkout. The plugin removes spaces, keeps what it can use and tells you on the order what was ignored. A business buyer in France without a SIREN waits in La Facterie until you add the SIREN on the order screen and send the order again.

= What happens when La Facterie cannot be reached? =

The order waits and is sent again on its own, up to 8 times with a growing delay. The order screen says why it waits. A permanent refusal, such as a wrong API key or an invoicing rule, is not retried. The order shows what to fix and a button to send it again.

= Which orders are invoiced? =

Paid orders, and business orders paid by transfer, cheque or on delivery as soon as they are placed. Other orders wait for their payment. Orders with a zero total are sent too.

= What happens on the free plan? =

Orders still go to La Facterie, but their invoices stay as previews without a number. Nothing is issued, deposited with the approved platform or reported, and customers have no invoice to download. The order screen says so and links to your subscription. The same applies when a payment is late past the grace period or when a cancelled subscription has ended.

Once a paid plan is active, the orders that waited are sent again on their own within the hour, or right away with the resend button of an order.

= Can I refund only the shipping cost? =

Yes, it is sent as a credit note. A free amount is sent only when it is all that is left on the order (an order set to Refunded). Otherwise the order says how to issue that credit note in La Facterie.

= Which currencies are supported? =

Euros only for now. La Facterie refuses invoices in another currency and the order says so.

= Is it compatible with HPOS and the Checkout block? =

Yes. The plugin only uses WooCommerce order objects and the official additional checkout fields API.

= What does the plugin keep about my customers? =

On orders and customer accounts: the SIREN, SIRET and VAT number typed at checkout, the invoice and credit note numbers and the La Facterie ids. The WordPress privacy tools can export and erase the identifiers. Issued invoices stay in La Facterie for the legal retention period.

= Where can I get help? =

Open a request from La Facterie > Support, use the support forum of this plugin or write to info@lafacterie.com. The help center is at https://lafacterie.com/aide.

== Screenshots ==

1. The "La Facterie" box on the order screen: invoice number, status and tracking, PDF and a credit note.
2. SIREN, SIRET and VAT number fields in the address form of the Checkout block.
3. The settings page with the plan, this month's usage and the latest sending errors.
4. The invoice column in the orders list.
5. Invoices and credit notes in the customer's My account.

== Changelog ==

= 0.2.1 =
* Invoicing accuracy: VAT category from the delivery country, refunds that differ from the credit note wait for you, optional postcode.

= 0.2.0 =
* English interface.

= 0.1.0 =
* First release: orders, refunds and cancellations sent to La Facterie, SIREN, SIRET and VAT number at checkout, invoice PDF in orders, e-mails and My account, dashboard, reports and support pages, HPOS support.
* Free plan: invoices stay as previews, the orders that waited are sent again once a paid plan is active.
