=== Wayl Checkout ===
Contributors: wayl
Tags: payment, checkout, wayl, woocommerce, iraq
Requires at least: 5.0
Tested up to: 6.9
Requires PHP: 7.4
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
WC requires at least: 5.0
WC tested up to: 8.5

Enable Wayl Checkout payments in your WooCommerce store. Accept online payments via Visa/MasterCard, ZainCash, FIB, and FastPay.

== Description ==

**Wayl Checkout** is a payment facilitator plugin for WooCommerce that enables merchants to accept online payments through multiple local and international payment methods in one unified solution.

**Features:**
* Accept payments from customers in Iraq and internationally
* Support for Iraqi Dinar (IQD) and US Dollar (USD)
* Multiple payment methods: Iraqi local and international Visa/MasterCard, ZainCash, FIB (First Iraqi Bank), and FastPay
* Arabic and English language support
* Secure payment processing with real-time notifications
* Easy setup and configuration

**About Wayl Checkout:**
* **Payment Facilitator** - Built for the Iraqi market
* **All Payment Methods in One** - Aggregate Iraqi local and international Visa/MasterCard, ZainCash, FIB, and FastPay in a single checkout solution
* **Secure & Reliable** - Enterprise-grade security with webhook signature verification
* **Easy Integration** - Simple setup process, no technical expertise required
* **Real-time Updates** - Instant payment notifications via webhooks
* **Full Refund Support** - Process refunds directly from WooCommerce orders

**Key Features:**

* **Multiple Payment Methods** - Accept Iraqi local and international Visa/MasterCard, ZainCash, FIB, and FastPay payments
* **Iraqi Dinar Support** - Full support for IQD currency with USD conversion
* **Secure Processing** - Enterprise-grade security with webhook signature verification
* **Real-time Notifications** - Instant payment status updates via webhooks
* **Refund Management** - Process full refunds directly from WooCommerce order management
* **Bilingual Support** - Arabic and English language interface
* **Comprehensive Logging** - Detailed logs for debugging and transaction tracking
* **Easy Configuration** - Simple setup wizard and intuitive admin interface
* **Mobile Optimized** - Responsive checkout experience for all devices
* **WooCommerce Native** - Seamless integration with WooCommerce order management

**Requirements:**

* WordPress 5.0 or higher
* WooCommerce 5.0 or higher
* PHP 7.4 or higher
* SSL certificate (for production use)

== External Services ==

This plugin connects to the Wayl payment API to create payment links and process transactions.

Service: Wayl Payment API
URL: https://api.thewayl.com

Data sent:
- Order ID
- Order total
- Currency
- Line items
- Redirect URL
- Webhook URL

Data is sent:
- When customer places an order
- When verifying payment via webhook

Terms of Service: https://www.wayl.io/terms
Privacy Policy: https://www.wayl.io/privacy

== Third-Party Service Information ==

This plugin integrates with Wayl's payment processing service to enable secure payment transactions.

**What is Wayl?**

Wayl is a payment processing service that provides secure checkout functionality for e-commerce transactions, with a focus on supporting payments in Iraq (IQD) and other currencies.

**What data is sent to Wayl and when?**

The following data is transmitted to Wayl's API (https://api.thewayl.com/api/v1):

**During Checkout (when customer clicks to pay):**
* Order reference ID (generated by the plugin)
* Order total amount and currency
* Line items (products, shipping, taxes, fees, discounts)
* Customer redirect URL (order confirmation page)
* Webhook URL (for payment status updates)
* Payment page language preference
* Product names and images (if available)

**During Webhook Processing (when Wayl sends payment status):**
* Webhook signature verification
* Payment status updates
* Order status updates

This data is sent **only when a customer initiates a payment** during the checkout process. The plugin does not send any data to Wayl until a payment is initiated.

**What data is received from Wayl?**

When Wayl processes a payment, it sends webhook notifications to your site containing:

* Payment status (Paid, Failed, etc.)
* Payment method and processor information
* Transaction details
* Customer information (name, phone) if provided during payment

**Privacy and Service Terms:**

* Wayl Privacy Policy: https://www.wayl.io/privacy
* Wayl Terms of Service: https://www.wayl.io/terms
* Wayl Website: https://www.wayl.io/

**User Consent:**

By using this payment method, customers consent to having their payment information processed by Wayl according to Wayl's privacy policy and terms of service. The plugin itself does not store payment card details or sensitive payment information.

**Privacy Statement:**

This plugin does not track users. No user tracking, analytics, or personal data collection is performed by this plugin beyond what is necessary for payment processing through Wayl's service.

== Support ==

**Need Help?**

* **Email Support**: support@wayl.io
* **WhatsApp Support**: +964 775 227 7781
* **Website**: https://www.wayl.io
* **Dashboard**: https://dashboard.thewayl.com

**Common Issues:**

* **Payment not processing**: Check that your API key is correct and your account is active
* **Webhook not working**: Ensure your server can receive POST requests and the webhook URL is accessible
* **Currency conversion issues**: Make sure your WooCommerce store currency is set to USD when using IQD mode
* **Payment methods not showing**: Verify your API key is valid and your account has payment methods enabled

== Privacy & Security ==

**Data Privacy:**
* This plugin does not store payment card details or sensitive payment information
* Payment data is processed securely through Wayl's encrypted API
* Customer consent is required for payment processing
* No user tracking or analytics are performed by this plugin

**Security Features:**
* Webhook signature verification
* Secure HTTPS communication
* Input sanitization and output escaping
* WordPress security best practices
* Regular security updates

**Third-Party Services:**
* This plugin integrates with Wayl's payment processing service
* Payment data is transmitted to Wayl's secure API (https://api.thewayl.com)
* Wayl Privacy Policy: https://www.wayl.io/privacy
* Wayl Terms of Service: https://www.wayl.io/terms

== Webhook Setup ==

The plugin automatically generates a webhook secret and URL. The webhook URL will be:
`https://yourdomain.com/?wc-api=waylchp_webhook`

Make sure this URL is accessible and your server can receive POST requests.

== Logging ==

When logging is enabled, the plugin creates log files in:
`wp-content/uploads/wayl-checkout/`

Log files are created daily and include:
- API requests and responses
- Webhook processing
- Payment status updates
- Error messages

== Screenshots ==

1. Modern checkout interface with multiple payment options
2. Easy-to-use admin settings page with setup wizard
3. Payment method selection (Visa, MasterCard, ZainCash, FIB, FastPay)
4. Order management with refund capabilities
5. Real-time payment status updates

== Frequently Asked Questions ==

= What payment methods does Wayl support? =

Wayl Checkout supports Iraqi local and international Visa/MasterCard, ZainCash, FIB (First Iraqi Bank), and FastPay. All payment methods are aggregated in one unified checkout solution. Accept payments from both Iraqi local cards and international cards.

= What currencies are supported? =

The plugin supports Iraqi Dinar (IQD) and US Dollar (USD). For IQD mode, your WooCommerce store must be configured to use USD as the base currency, and the plugin will handle the conversion.

= How do I get an API key? =

1. Register your account at dashboard.thewayl.com
2. Submit your merchant information
3. Contact Wayl Support via email (support@wayl.io) or WhatsApp (+964 775 227 7781) to obtain your Merchant Token API Key
4. Add your API key in WooCommerce > Settings > Payments > Wayl

= Is this plugin secure? =

Yes, the plugin follows WordPress security best practices and includes:
* Webhook signature verification
* Secure API communication (HTTPS)
* Input sanitization and output escaping
* No storage of sensitive payment data
* Regular security updates

= Can I use this plugin in test mode? =

Yes, you can use test API keys provided by Wayl for development and testing before going live.

= How do refunds work? =

You can process refunds directly from the WooCommerce order management page. The plugin will automatically refund the full order amount to the customer through Wayl's API.

= Do I need technical knowledge to set up this plugin? =

No, the plugin includes a simple setup wizard and clear instructions. Basic WordPress and WooCommerce knowledge is sufficient.

= Is this plugin suitable for Iraqi merchants only? =

While Wayl is designed for the Iraqi market, it supports both Iraqi local and international Visa/MasterCard cards, making it suitable for merchants serving customers in Iraq and internationally.

= What languages are supported? =

The plugin supports both Arabic and English. You can configure the payment page language in the plugin settings.

= How do I monitor my payments? =

All payments can be monitored through the Wayl dashboard at dashboard.thewayl.com. The plugin also provides order status updates in WooCommerce.

== Installation ==

1. **Upload the plugin:**
   * Upload the plugin files to `/wp-content/plugins/wayl-checkout/`, or
   * Install the plugin through the WordPress admin interface by searching for "Wayl Checkout"

2. **Activate the plugin:**
   * Go to Plugins > Installed Plugins
   * Find "Wayl Checkout" and click "Activate"

3. **Configure the plugin:**
   * Go to WooCommerce > Settings > Payments
   * Find "Wayl" in the payment methods list
   * Click "Manage" to configure your API key and settings

4. **Get your API key:**
   * Register at dashboard.thewayl.com
   * Contact Wayl Support (support@wayl.io or +964 775 227 7781) to obtain your Merchant Token API Key
   * Enter your API key in the plugin settings

5. **Go live:**
   * Save your settings
   * Test a transaction in test mode (if available)
   * Start accepting payments from your customers

== Configuration ==

**Required Settings:**

1. **API Key** (Required)
   * Contact support@wayl.io or WhatsApp +964 775 227 7781 to obtain your Merchant Token API Key
   * Enter the API key in the "API Key" field

2. **Language** (Optional)
   * Choose between Arabic (ar) or English (en) for the payment page
   * Default: English

3. **Currency Mode** (Optional)
   * **Site Currency**: Use your store's default currency
   * **Force IQD**: Convert USD to Iraqi Dinar (requires USD as site currency)

4. **Logging** (Optional)
   * Enable to log API requests and responses for debugging
   * Logs are stored in `wp-content/uploads/wayl-checkout/`
   * Recommended: Enable during setup, disable in production

**Recommended Settings:**

* Enable the payment method for your store
* Set a clear payment method title and description
* Test the integration before going live
* Monitor your first few transactions

== Changelog ==

= 1.0.0 =
* Initial production release for WordPress.org
* Payment facilitator for WooCommerce: Visa/MasterCard, ZainCash, FIB, FastPay
* IQD and USD support with Arabic and English
* Secure processing with webhook verification and refund support
* Admin settings with setup wizard and comprehensive logging

== Upgrade Notice ==

= 1.0.0 =
Initial production release. Enable Wayl Checkout payments in your WooCommerce store.

== Developer Information ==

**Plugin Structure:**
* Main plugin file: `wayl-checkout.php`
* Payment gateway class: `includes/class-waylchp-payment-gateway.php`
* API client: `includes/class-waylchp-api.php`
* Webhook handler: `includes/class-waylchp-webhook-handler.php`
* Logger: `includes/class-waylchp-logger.php`

**Hooks & Filters:**
* `waylchp_payment_channels` - Filter payment channels before display
* `waylchp_checkout_data` - Filter checkout data before API call
* `waylchp_webhook_data` - Filter webhook data before processing

**API Endpoints:**
* Checkout: `https://api.thewayl.com/api/v1/checkout`
* Refund: `https://api.thewayl.com/api/v1/refunds`
* Webhook: `https://yourdomain.com/?wc-api=waylchp_webhook`

**Requirements:**
* WordPress 5.0+
* WooCommerce 5.0+
* PHP 7.4+
* SSL certificate (for production)
* cURL extension enabled
