=== Invoicing Integration for Sellsy and WooCommerce ===
Contributors: devikit
Tags: woocommerce, sellsy, invoice, france, accounting
Requires at least: 5.8
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 1.0.0
License: GPLv3
License URI: https://www.gnu.org/licenses/gpl-3.0.html

Connect WooCommerce with Sellsy for professional French invoicing - Personal API per merchant, factures, contacts, and PDF downloads.

== Description ==

**Invoicing Integration for Sellsy and WooCommerce** creates real Sellsy invoices (factures) from WooCommerce orders, directly from the WordPress admin.

https://youtu.be/5CdihDjUU3k

Each shop uses **its own Sellsy Personal API access** (Client ID + Client Secret). There is no shared Devikit Sellsy app and no invoice quota inside Free or PRO - API limits follow your Sellsy account.

= Key Features (FREE) =

* **Manual invoice per order** — create a native Sellsy invoice (facture) from the WooCommerce order screen.
* **Customer sync** — find or create Sellsy companies / individuals with billing address, email, VAT number (N° TVA), and SIRET.
* **VAT number + SIRET checkout fields** — classic checkout and WooCommerce Blocks, with detection of common EU VAT plugins to avoid duplicate fields.
* **Tax mapping** — common French rates (20 %, 10 %, 5.5 %, 2.1 %, 0 %) mapped to Sellsy taxes.
* **Draft or finalized documents** — keep new invoices as drafts or finalize them in Sellsy (document number assigned).
* **Payment deadline (Délai de paiement)** — choose how many days the customer has to pay (0–60); applied on each Sellsy invoice.
* **PDF download** — download Sellsy PDFs from the WordPress admin and from **My Account → Orders → View order**.
* **Open in Sellsy** — open the invoice in Sellsy from the WooCommerce order screen.
* **Logging** — optional logs that hide your Client Secret.
* **HPOS compatible** — works with the latest WooCommerce order storage.
* **Blocks checkout** — VAT / SIRET fields work with classic and block checkout.

= PRO Features =

Upgrade when you need hands-off invoicing and richer tax handling:

* **Automatic invoice creation** — create invoices when selected order statuses are reached, with automatic retries if something fails temporarily.
* **Credit notes (avoirs)** — manual and automatic on refunds; customers can download the PDF in My Account.
* **Send Invoice PDF / Send Credit Note PDF** — WooCommerce emails with Sellsy PDF attachments.
* **Bulk create** — create invoices or credit notes for many orders at once; download PDFs as a ZIP.
* **Introduction & closing text** — custom notes on Sellsy documents (you can insert order details).
* **EU B2B reverse charge (autoliquidation)** — for EU business buyers with a VAT number outside France.
* **EU OSS (B2C)** — destination VAT rates taken from WooCommerce for private customers outside France.
* **Invoice language** — optional Sellsy document language from your account languages list.
* **Priority email support**.

[**Get PRO Version**](https://devikit.fr/produit/sellsy-woocommerce-pro/)

Documentation: [https://devikit.fr/documentation/sellsy-woocommerce-pro/](https://devikit.fr/documentation/sellsy-woocommerce-pro/)

= Requirements =

* WordPress 5.8 or higher
* WooCommerce 5.0 or higher
* PHP 7.4 or higher
* Active Sellsy account with Personal API access (Client ID + Client Secret from **Réglages → Portail Développeur → API v2**)

== Installation ==

1. Upload the `invoicing-integration-for-sellsy-and-woocommerce` folder to `/wp-content/plugins/`, or install from the WordPress Plugins screen.
2. Activate the plugin.
3. Open **WooCommerce → Sellsy**.
4. In Sellsy go to **Settings → Developer Portal → API v2** ([developer portal](https://www.sellsy.fr/developer/api-v2)), create a **Personal** API access, then paste Client ID + Client Secret and click **Test Connection**.
5. Set document mode (draft / finalized), payment deadline, and checkout VAT / SIRET behavior.
6. Create invoices from the WooCommerce order screen.

== Frequently Asked Questions ==

= Where do I get my Sellsy Client ID and Client Secret? =

In Sellsy: **Réglages → Portail Développeur → API v2** (or open [https://www.sellsy.fr/developer/api-v2](https://www.sellsy.fr/developer/api-v2)). Click **Créer un accès API**, choose **Personnel** (server-to-server), link a staff member, select authorizations (scopes), then copy the **Client ID** and **Client Secret** (the secret is shown only once). Paste them into **WooCommerce → Sellsy** and run **Test Connection**. See [Types d'accès API](https://help.sellsy.com/fr/articles/5876615-types-d-acces-api).

= Do I need a Devikit / Public Sellsy app? =

No. Create a Personal API access in your own Sellsy account. Public apps require Sellsy partner validation and are not used by this plugin.

= Does the free plugin create invoices automatically? =

No. The free version creates invoices when you click **Create Invoice** on an order. Automatic creation, credit notes, emails, and bulk actions need [PRO](https://devikit.fr/produit/sellsy-woocommerce-pro/).

= Does this plugin limit how many invoices I can create? =

The plugin does not enforce its own invoice quota. Usage is subject to your Sellsy subscription and API rate limits.

= Can customers download their invoice PDF? =

Yes, after a Sellsy invoice exists for the order, from **My Account → View order**.

= Is HPOS supported? =

Yes. It works with the latest WooCommerce order storage.

= Does this work with WooCommerce Blocks? =

Yes. Classic and block checkout are supported for VAT / SIRET fields. Optional “business invoice” checkbox mode is classic-checkout only; on Blocks the field stays visible when not hidden.

= What happens when I uninstall the plugin? =

Plugin settings are removed from WordPress. Your invoices and contacts in Sellsy are not deleted.

== External services ==

This plugin communicates with the **Sellsy API v2**, operated by SELLSY SAS, to sync customers and create or retrieve documents.

= What is the Sellsy API? =

Sellsy is a French CRM and invoicing platform. This plugin uses the official API v2 at `https://api.sellsy.com/v2/` (OAuth token endpoint: `https://login.sellsy.com/oauth2/access-tokens`) to:

* Authenticate with your Personal Client ID and Client Secret (`client_credentials`)
* Test the connection
* Search, create, and update companies / individuals and contacts
* Create invoices, finalize drafts, and download PDFs
* (With PRO installed and licensed) create credit notes (avoirs), set document notes and language, apply reverse charge / OSS tax options, and run automation / bulk tools

Official documentation: [https://api.sellsy.com/doc/v2/](https://api.sellsy.com/doc/v2/).

= What data is sent and when? =

**When you create an invoice manually (FREE):**

* Customer: name, company, email, phone, billing address, VAT number (N° TVA), SIRET
* Order: line items (title, quantity, amounts, tax rates), shipping, fees, order date/reference, payment deadline

**When you test the connection or load settings:**

* Your Client ID and Client Secret for authentication
* Read-only connection checks and lookups (for example taxes / languages when needed)

**When you or a customer downloads a PDF:**

* The related document identifier to fetch the PDF from Sellsy

**FREE plugin:** no Sellsy traffic runs on its own without your action (manual invoice, connection test, or PDF download), except optional background tasks you explicitly enable in WooCommerce.

**With PRO** (automation, refunds, bulk): additional order/refund data may be sent according to PRO settings when order statuses change or you run bulk actions.

= Service provider information =

* **Service name:** Sellsy API v2
* **Website:** [https://www.sellsy.com/](https://www.sellsy.com/)
* **API base URL:** `https://api.sellsy.com/v2/`
* **Token URL:** `https://login.sellsy.com/oauth2/access-tokens`
* **API documentation:** [https://api.sellsy.com/doc/v2/](https://api.sellsy.com/doc/v2/)
* **API access help:** [https://help.sellsy.com/fr/articles/5876615-types-d-acces-api](https://help.sellsy.com/fr/articles/5876615-types-d-acces-api)
* **Plugin documentation:** [https://devikit.fr/documentation/sellsy-woocommerce-pro/](https://devikit.fr/documentation/sellsy-woocommerce-pro/)
* **Terms of Service:** [https://go.sellsy.com/informations-legales/conditions-generales](https://go.sellsy.com/informations-legales/conditions-generales)
* **Privacy Policy:** [https://go.sellsy.com/informations-legales/confidentialite-des-donnees](https://go.sellsy.com/informations-legales/confidentialite-des-donnees)

By using this plugin, customer and order data needed for invoicing is transmitted to Sellsy. You are responsible for GDPR compliance and for informing customers about this processing.

== Screenshots ==

1. Plugin settings
2. Plugin settings
3. Plugin settings
4. Plugin settings
5. Plugin settings
6. Plugin settings
7. Plugin settings
8. Plugin settings
9. Plugin settings

== Changelog ==

= 1.0.0 =
* Initial release - Sellsy Personal API, manual invoices, PDF, FR VAT/SIRET
* TVA on order emails and My Account (classic and block checkout)
* Clearer Sellsy Personal API connection setup (French help)
* Payment deadline (Délai de paiement) on Sellsy invoices

== Upgrade Notice ==

= 1.0.0 =
Initial release.
