=== ZATCA Tools — E-Invoicing ===
Contributors: zatcatools
Tags: zatca, e-invoice, invoice, saudi arabia, vat
Requires at least: 6.0
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Automatically issue Saudi ZATCA Phase 2 compliant e-invoices for paid WooCommerce orders. Refunds issue credit notes. Signed, reported, delivered.

== Description ==

This plugin connects your WooCommerce store to ZATCA Tools, a cloud e-invoicing service for Saudi merchants, and issues a compliant tax invoice for every paid order — automatically.

When an order is paid, the plugin sends its details to your ZATCA Tools account, which builds the invoice, signs it with your establishment certificate, and reports it to ZATCA (the Fatoora platform for the second phase of e-invoicing). The invoice and its QR code are then available from the order screen, and the buyer can receive a PDF copy by email.

**Features**

* Automatic tax invoice for every paid order
* Automatic credit notes for refunds
* Standard (B2B) tax invoices when the buyer has a VAT number
* Invoice PDF with the official ZATCA QR code
* Runs in the background so checkout is never slowed down

**Requirements**

* A ZATCA Tools account connected to ZATCA (a free account at zatcatools.com)
* Your store currency set to SAR
* WooCommerce active

== External services ==

This plugin connects to ZATCA Tools, an external e-invoicing service operated by ZATCA Tools, to create and report tax invoices for your orders. This connection is required for the plugin to function, and only happens after you enter your own API key in the plugin settings.

**What data is sent, and when**

* When you save your API key in the settings screen, the plugin sends the key to the ZATCA Tools API to verify it (an account lookup request).
* When an order is paid, the plugin sends that order's details — line items, amounts, discounts, shipping, the buyer's name, and (if present) the buyer's email, billing address and VAT number — to the ZATCA Tools API so a tax invoice can be issued and reported to ZATCA.
* When an order is refunded, the plugin sends the refund details so a credit note can be issued.

No data is sent to any external service until you enter an API key and enable the plugin.

* Service provider: ZATCA Tools — https://zatcatools.com
* Terms of Use: https://zatcatools.com/terms
* Privacy Policy: https://zatcatools.com/privacy

== Installation ==

1. Upload the plugin and activate it, or install it from your WordPress dashboard.
2. Create an account and an API key at zatcatools.com (Settings > API).
3. In WooCommerce > Settings > ZATCA Tools, paste the API key and save.
4. A success message confirms the connection. Paid orders are now invoiced automatically.

Full guide: https://zatcatools.com/docs/woocommerce

== Frequently Asked Questions ==

= Do I need an account with an external service? =

Yes. This plugin is a connector for the ZATCA Tools e-invoicing service. You create a free account at zatcatools.com and connect it to ZATCA, then paste your API key into the plugin.

= Do my customers see anything different at checkout? =

No. The integration runs entirely in the background.

= How are business (B2B) invoices handled? =

If the order carries a valid Saudi VAT number (in a VAT field or the order note) and a complete billing address, a standard cleared tax invoice is issued instead of a simplified one.

= What about refunds? =

Refunding an order automatically issues a credit note against the original invoice.

== Screenshots ==

1. The ZATCA Tools settings screen in WooCommerce.
2. The invoice panel on the order screen with the PDF link.

== Changelog ==

= 1.0.0 =
* Initial release: automatic invoices, credit notes, B2B detection, order-screen invoice panel.

== Upgrade Notice ==

= 1.0.0 =
Initial release.
