=== Monthly Invoice Gateway for WooCommerce ===
Contributors: coodigoo
Tags: woocommerce, invoice, payment, deferred payment, monthly billing
Requires at least: 6.0
Tested up to: 6.9
Stable tag: 1.0.2
Requires PHP: 8.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Adds a monthly invoice (deferred payment) option to WooCommerce. Manage consolidated monthly billing for businesses and corporate customers.

== Description ==

Monthly Invoice Gateway for WooCommerce adds a deferred payment method to your WooCommerce store. Customers can place orders without immediate payment and receive a consolidated invoice at the end of the billing period.

This plugin is designed for B2B (business-to-business) transactions where monthly invoicing is the standard payment practice.

**Note:** The plugin includes payment management (e.g. tracking paid/unpaid status). The free version does not include invoice generation or automated invoice notifications — sellers must create and send invoices to customers manually.

= Key Features =

* Monthly invoice (deferred payment) gateway
* Compatible with both WooCommerce Checkout Block and legacy checkout
* Flexible billing closing day (1st–30th or end of month)
* Optional payment fee (taxable or non-taxable)
* Per-user access control (individual approval system)
* Optional administrator and shop manager checkout access
* Customizable thank you page message with template variables
* Usage details page with monthly billing breakdown
* Monthly history page with aggregated data
* Customer management page with search and filters
* Staff role badges (Admin / Shop Manager) on usage details and customer list
* Payment status tracking (paid/unpaid)
* WooCommerce HPOS (High-Performance Order Storage) compatible
* WooCommerce Cart & Checkout Blocks compatible
* Internationalization (i18n) ready — translations included for Japanese, German, Spanish, French, Italian, and Portuguese (Brazil)

= How It Works =

1. Enable the payment method in WooCommerce > Settings > Payments
2. Customers select "Monthly Invoice" at checkout
3. Orders are consolidated by the billing closing day
4. Admins manage invoices and payment status from the admin panel

= User Access Control =

* **Automatic (default):** All users with the `customer` role can use invoice payment
* **Manual approval:** Enable per-user restrictions and individually approve customers on the customer management page
* **Staff checkout (optional):** Enable "Administrator & Shop Manager Access" to allow administrator and shop manager accounts to use this payment method at checkout

Note: By default, staff roles (administrator, editor, author, contributor, shop_manager) cannot use this payment method at checkout. When "Administrator & Shop Manager Access" is enabled, administrator and shop_manager roles are allowed.

= Thank You Page Variables =

Customize the thank you page message with these variables:

* `{order_id}` — Order ID
* `{order_number}` — Order number
* `{customer_name}` — Customer name
* `{company_name}` — Company name
* `{order_total}` — Order total
* `{order_date}` — Order date
* `{closing_day}` — Billing closing day

= Database =

When activated, the plugin creates one table (the prefix may differ from `wp_` depending on your WordPress configuration):

* `wp_cdg_mig_monthly_invoice_payments` — Stores invoice payment records per order: order ID, user ID, amount, billing month, payment status (paid/unpaid), and related dates. Used for the usage details and monthly history pages.

== Installation ==

1. Upload the plugin folder to `/wp-content/plugins/`
2. Activate the plugin through the "Plugins" menu in WordPress
3. Go to WooCommerce > Settings > Payments > "Monthly Invoice (Deferred Payment)" to configure

== Frequently Asked Questions ==

= Does the free version include invoice issuance or notifications? =

The plugin includes payment management (tracking paid/unpaid status), but the free version does **not** include invoice generation or automated invoice notifications. Sellers must create and send invoices to customers manually. Invoice issuance and notification features may be available in a premium version.

= The payment method does not appear at checkout =

Please check the following:

* The payment method is enabled in WooCommerce > Settings > Payments
* You are logged in as a customer user (with the `customer` role), or as an administrator/shop manager with "Administrator & Shop Manager Access" enabled
* If "Restrict Usage by User" is enabled, the customer must be individually approved on the customer management page

= Some users do not appear on the customer management page =

Only users with the `customer` role are displayed. Users with other roles are not shown.

= Payment status column is not visible =

Make sure "Payment Status Tracking" is enabled in the plugin settings.

= What happens to my data when I delete the plugin? =

When you delete (not just deactivate) the plugin from the WordPress admin panel, all plugin data is automatically removed:

* Database tables (`wp_cdg_mig_monthly_invoice_payments`)
* User meta (`cdg_mig_monthly_invoice_allowed`)
* Plugin options (`woocommerce_monthly_invoice_gateway_settings`)

Deactivating the plugin does NOT delete any data.

== Changelog ==

= 1.0.2 - 07/09/2026 =
* Added "Administrator & Shop Manager Access" setting to optionally allow administrator and shop manager accounts to use monthly invoice payment at checkout.
* Added staff role badges (Admin / Shop Manager) on the usage details and customer list pages.
* Updated translations (.pot, .po, and .mo files).

= 1.0.1 - 02/28/2026 =
* Translation updates: synced all .po files with the .pot template and corrected fuzzy entries for German (de_DE), Spanish (es_ES), French (fr_FR), Italian (it_IT), and Portuguese Brazil (pt_BR). Japanese (ja) unchanged.

= 1.0.0 - 02/28/2026 =
* Initial release.
* Monthly invoice (deferred payment) gateway for WooCommerce.
* Compatible with WooCommerce Checkout Block and legacy checkout.
* Billing closing day, payment fee, per-user access control, thank you page message.
* Usage details, monthly history, and customer management pages.
* Payment status tracking (paid/unpaid).
* Translations: Japanese, German, Spanish, French, Italian, Portuguese (Brazil).
