=== MoPay for WooCommerce ===
Contributors: mopay
Tags: payments, woocommerce, mpesa, ecocash, lesotho
Requires at least: 6.9
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 0.3.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Accept M-Pesa, EcoCash, and Card payments in Lesotho using MoPay.

== Description ==
MoPay for WooCommerce adds MoPay as a hosted WooCommerce payment method for M-Pesa, EcoCash, and cards.

The merchant API key stays server-side. Customers are redirected to MoPay to complete payment, then the plugin retrieves the MoPay session from the server and verifies its reference and amount before updating the WooCommerce order.

Classic checkout and WooCommerce Checkout Blocks are supported, as is High-Performance Order Storage (HPOS).

== Installation ==
1. Upload the plugin ZIP in WordPress under Plugins → Add New → Upload Plugin.
2. Activate MoPay for WooCommerce.
3. Go to WooCommerce → Settings → Payments → MoPay.
4. Paste the API key from your MoPay project and save.
5. Ensure the WooCommerce store currency is LSL.

== Testing ==
New MoPay projects use sandbox mode by default. You can use the documented MoPay sandbox M-Pesa and EcoCash phone presets to test successful, pending, failed, cancelled, and expired payment flows without real money.

The redirect + server-side session verification flow works with normal localhost HTTP development when the MoPay backend accepts the localhost redirect URL. A public HTTPS tunnel is only needed to exercise optional webhook delivery to a local machine.

MoPay orders remain on-hold while the customer is on the hosted payment page. Generic WooCommerce new-order and on-hold emails are suppressed until the MoPay Session API confirms a successful transaction.

== Frequently Asked Questions ==
= Does this support WooCommerce Blocks? =
Yes.

= Does this support HPOS? =
Yes. The plugin uses WooCommerce order CRUD APIs and declares HPOS compatibility.

= Is the MoPay API key exposed in checkout JavaScript? =
No. Only a boolean indicating that the gateway is configured is sent to Checkout Blocks.

= Are webhooks required? =
No. Payment state is confirmed by retrieving the MoPay session server-side after the shopper returns. Legacy signed webhook support is retained as an optional compatibility feature.

== Changelog ==
= 0.3.0 =
* Synchronized the plugin release version and generated artifact version with package.json.

= 0.2.0 =
* Updated API base URL to https://mopay.co.ls.
* Added sandbox-ready lifecycle handling for pending, failed, cancelled, and expired sessions.
* Prevented MoPay API keys from being exposed to Checkout Blocks.
* Added server-side reference and amount correlation before marking orders paid.
* Added payment-attempt history for retry correlation.
* Added HPOS and Checkout Block compatibility declarations.
* Updated Checkout Block registration to WooCommerce's current payment integration pattern.
* Made legacy webhook support optional.
* Added bounded background reconciliation for pending or browser-abandoned sessions.
* Added Docker Compose development and testing tooling in the source repository.

= 0.1.0 =
Initial release.
