=== EmbPay for WooCommerce ===
Contributors: embpay
Tags: payments, woocommerce, checkout, stripe, payment gateway
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 8.1
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Accept payments through the EmbPay hosted checkout — cards and wallets in an on-site modal, or local redirect payment methods.

== Description ==

EmbPay for WooCommerce connects your store to the EmbPay payment platform.

**Checkout, your way**

* **Modal mode** — the EmbPay checkout opens in an overlay on your own checkout page. Supports cards & wallets.
* **Redirect mode** — customers are sent to the EmbPay hosted page. Use this to offer local redirect methods (iDEAL, Klarna, …).

**Built for modern WooCommerce**

* Works with the classic (shortcode) checkout and the Cart/Checkout Blocks.
* Fully compatible with High-Performance Order Storage (HPOS / custom order tables).
* Currency-aware amounts, including zero-decimal (JPY, KRW, …) and three-decimal (BHD, KWD, …) currencies.

**Reliable by design**

* Payments are confirmed by signed webhooks (HMAC-SHA256, timestamped, replay-protected).
* A 5-minute reconciliation cron re-checks recent unpaid orders directly against the EmbPay API, so a lost webhook never loses a payment.
* The paid amount and currency are verified against the order before it is completed; any mismatch puts the order on hold for manual review instead.
* Idempotency keys guarantee that double clicks and timeouts never create duplicate charges.

**More than payments**

* Refund orders (full or partial) straight from the WooCommerce order screen.
* Refunds and disputes made on the EmbPay side flow back into WooCommerce automatically.
* Optional product sync: every product gets an EmbPay payment link with a one-click "Share on WhatsApp" button, plus a batched bulk-sync tool.

== Installation ==

1. Upload the `embpay-for-woocommerce` folder to `/wp-content/plugins/`, or install through the WordPress plugins screen.
2. Activate the plugin.
3. Go to **WooCommerce → Settings → Payments → EmbPay**.
4. Paste your EmbPay secret API key (`ep_live_…`, or `ep_test_…` with test mode enabled) and save. The plugin validates the key and registers your site's webhook endpoint automatically.
5. Choose your display mode (Modal or Redirect) and enable the gateway.
6. Optionally use the **Send test webhook** button to verify delivery end to end.

== Frequently Asked Questions ==

= Which display mode should I use? =

Modal keeps customers on your site and supports cards & wallets. To offer local redirect methods (iDEAL, Klarna, …), use Redirect mode.

= Does it work with the Checkout block? =

Yes. The gateway registers a native Blocks payment method — no shortcode required.

= Does it support HPOS (custom order tables)? =

Yes. All order data is accessed through the WooCommerce CRUD layer and the plugin declares `custom_order_tables` compatibility.

= What happens if a webhook never arrives? =

A reconciliation task runs every 5 minutes and checks recent unpaid EmbPay orders directly against the API, completing them with the exact same verification the webhook uses.

= How do refunds work? =

Refund from the WooCommerce order screen as usual — the plugin calls the EmbPay refund API. Refunds issued from the EmbPay dashboard are mirrored back into WooCommerce by webhook.

== Changelog ==

= 1.0.0 =
* Initial release: hosted checkout in modal or redirect mode, Blocks + classic checkout support, HPOS compatibility, signed webhooks with reconciliation fallback, refunds in both directions, product sync with WhatsApp share links, Arabic and French translations.

== Upgrade Notice ==

= 1.0.0 =
Initial release.
