=== Ezone Pay ===
Contributors: anas-taleb99
Tags: payments, payment link, checkout, ezone pay
Requires at least: 6.0
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 0.1.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Create Ezone Pay payment links from WordPress and display checkout in an embedded iframe.

== Description ==

Ezone Pay creates payment-link checkout sessions from WordPress. The plugin stores a local payment reference, displays the returned payment link in an iframe, and updates payment status by polling the Ezone Pay API after the customer returns to WordPress.

Features:

* Development and production API modes.
* Separate API keys for development and production.
* Embedded iframe checkout for payment links.
* Payment confirmation using Ezone Pay payment-link details and transactions.
* Shortcode-based payment button.

Important: embedded checkout depends on Ezone Pay allowing your site domain in iframe/frame headers. If the Ezone Pay checkout page blocks framing, Ezone Pay must allow the merchant site domain or the browser will block the iframe.

== Installation ==

1. Upload the `ezone-pay` folder to `/wp-content/plugins/`.
2. Activate **Ezone Pay** in WordPress.
3. Go to **Settings > Ezone Pay**.
4. Choose the environment mode.
5. Add the development and/or production API keys.
6. Make sure each API key has the **Create Payment Link** and **View Payment Links** permissions enabled.
7. Add the shortcode to a page.

== Configuration ==

The plugin supports two API modes:

* Development: `https://test.ezonepay.ly`
* Production: `https://api.ezonepay.ly`

To get a development API key, register or log in at `https://demo.ezonepay.ly/`, then go to **الإعدادات > مفاتيح API**.

To get a production API key, register or log in at `https://my.ezonepay.ly/`, then go to **الإعدادات > مفاتيح API**.

When creating an API key, enable these permissions:

* **إنشاء رابط دفع**
* **عرض روابط الدفع**

You can manage settings in WordPress admin or define constants in `wp-config.php`:

`define('EZONE_PAY_API_MODE', 'dev');`
`define('EZONE_PAY_DEV_API_KEY', 'your-dev-secret-key');`
`define('EZONE_PAY_PRODUCTION_API_KEY', 'your-production-secret-key');`

== Shortcode ==

Use:

`[ezone_pay_button amount="0.1" reference="ORDER-123" title="Pay with Ezone"]`

Optional customer fields:

`[ezone_pay_button amount="0.1" reference="ORDER-123" title="Pay with Ezone" customer_first_name="Ali" customer_last_name="Saleh" customer_phone="0910000000"]`

== Payment confirmation ==

After the customer returns from Ezone Pay, the checkout status endpoint polls Ezone Pay directly using payment-link details and transactions. The selected API key must have permission to create and view payment links.

== External services ==

This plugin connects to the Ezone Pay API to create payment links, display the Ezone Pay checkout page, and confirm whether a payment has been completed. This service is provided by Ezone.

The plugin connects to one of these Ezone Pay API endpoints depending on the selected environment mode:

* Development: `https://test.ezonepay.ly`
* Production: `https://api.ezonepay.ly`

When a visitor clicks the payment button, the plugin sends the configured Ezone Pay API key, payment amount, payment title, optional note, order reference, internal reference, WordPress return URL, and optional customer first name, last name, and phone number to Ezone Pay. This data is sent so Ezone Pay can create a payment link and return the checkout URL.

After the visitor is redirected back to WordPress, the plugin may send the configured Ezone Pay API key, payment link ID, amount, and order reference to Ezone Pay to check payment-link details and payment-link transactions. This data is sent so WordPress can confirm whether the payment was completed.

The checkout itself is loaded from the payment link returned by Ezone Pay. Any payment details entered by the customer inside the Ezone Pay checkout are submitted directly to Ezone Pay and are not processed by this plugin.

Terms of service: https://ezonepay.ly/ar/terms

Privacy policy: https://ezonepay.ly/ar/privacy

== Trademark notice ==

This plugin uses the Ezone Pay name to identify the payment service it integrates with. Public distribution should only proceed after you confirm that you have permission from the Ezone Pay trademark owner to use the name, brand, and any related marks.

== Frequently Asked Questions ==

= Does this plugin process card or wallet credentials? =

No. The plugin creates Ezone Pay payment links and embeds the returned checkout URL.

= Why does the payment page stay on "waiting for confirmation"? =

WordPress has not yet confirmed the payment. Make sure the API key can view payment links and transactions.

= Why is the iframe blank or blocked? =

The Ezone Pay checkout page may be using frame-blocking headers. Ezone Pay must allow the merchant domain for iframe checkout.

== Changelog ==

= 0.1.0 =
* Initial release.
