=== JeelPay for WooCommerce ===
Contributors: jeelpay
Tags: woocommerce, payment gateway, bnpl, Study now pay later, installments
Requires at least: 5.8
Tested up to: 6.9
Requires PHP: 7.4
Stable tag: 1.1.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Study Now Pay Later payments through JeelPay. Split tuition into easy installments with no interest.

== Description ==

JeelPay is a Study Now Pay Later (SNPL) payment gateway that allows your customers to split their tuition fee into interest-free installments. Integrated seamlessly with WooCommerce, JeelPay provides a modern payment solution for educational organizations.

= Key Features =

* **Study Now Pay Later** - Let customers pay interest-free installments up to 12 installments
* **Seamless Integration** - Works with both WooCommerce Classic and Block-based checkout
* **Multiple API Support** - Supports both Items API and Schooling API for educational institutions
* **Real-time Status** - Automatic order status updates via webhooks
* **Secure Payments** - HMAC-SHA256 webhook signature verification
* **Sandbox Mode** - Test integration before going live
* **Arabic Support** - Fully translated interface for Arabic-speaking customers
* **Order Management** - Automatic cancellation of unpaid orders after timeout

= Requirements =

* WordPress 5.8 or higher
* WooCommerce 5.0 or higher
* PHP 7.4 or higher
* JeelPay account ([Sign up here](https://jeel.co))
* SSL certificate (HTTPS required)

= Supported Countries & Currencies =

* Saudi Arabia (SAR)

= How It Works =

1. Customer selects JeelPay at checkout
2. Customer is redirected to JeelPay to complete approval
3. Customer returns to your website after approval
4. Order is automatically completed upon payment confirmation
5. Webhooks keep order status synchronized

== Installation ==

= Automatic Installation =

1. Log in to your WordPress dashboard
2. Navigate to Plugins > Add New
3. Search for "JeelPay"
4. Click "Install Now" and then "Activate"

= Manual Installation =

1. Download the plugin zip file
2. Log in to your WordPress dashboard
3. Navigate to Plugins > Add New > Upload Plugin
4. Choose the zip file and click "Install Now"
5. Activate the plugin

= Configuration =

1. Go to WooCommerce > Settings > Payments
2. Click on "JeelPay"
3. Enter your API credentials:
   - **Client ID** - Provided by JeelPay
   - **Client Secret** - Provided by JeelPay
   - **Entity ID** - Your entity ID
4. Configure other settings as needed
5. Save changes

For detailed setup instructions, visit our [documentation](https://jeel.co/docs).

== Frequently Asked Questions ==

= Do I need a JeelPay account? =

Yes, you need to sign up for a JeelPay account at [jeel.co](https://jeel.co) to obtain your API credentials.

= Does this work with WooCommerce Blocks? =

Yes! The plugin fully supports both WooCommerce Classic checkout and the modern Block-based checkout.

= What currencies are supported? =

Currently, only Saudi Riyal (SAR) is supported.

= Is there a test mode? =

Yes, the plugin includes a sandbox mode that allows you to test the integration before going live. Simply enable "Sandbox Mode" in the settings and use your sandbox credentials.

= What happens if a customer doesn't complete payment? =

Orders that remain unpaid will be automatically cancelled after 4 hours. This timeout is configurable.

= Does this support Arabic? =

Yes, the plugin is fully translated into Arabic and includes RTL (right-to-left) support.

= What about the Schooling API? =

The plugin supports JeelPay's Schooling API for educational institutions. Enable "Use Schooling API" in settings and provide the Educational Year ID.

== Screenshots ==

1. Plugin settings page showing API configuration
2. JeelPay payment option at checkout
3. National ID field in checkout form
4. Order details showing JeelPay transaction information
5. WooCommerce Scheduled Actions showing automatic tasks

== Changelog ==

= 1.1.0 - 2026-04-08 =
* Simplified checkout fields - removed redundant Buyer National ID and Student Name fields
* Only Student National ID is now required (displayed as "National ID")
* Student name is automatically derived from billing first and last name
* Streamlined checkout experience with fewer form fields
* Updated translations for simplified field labels

= 1.0.5 - 2026-04-05 =
* Fixed promo banner link to redirect to WooCommerce checkout instead of external jeel.co
* Banner now properly handles customized checkout page URLs
* Applied fix to both classic and block-based cart implementations

= 1.0.4 - 2026-04-01 =
* Added promotional banner on cart page showing JeelPay installment options
* Banner displays above "Proceed to Checkout" button when cart total qualifies
* Supports both classic and block-based WooCommerce cart
* Fixed security escaping in cart banner JavaScript

= 1.0.3 - 2026-03-30 =
* Added idempotency key support for checkout creation to prevent duplicate orders during network timeouts
* Implemented automatic retry logic with up to 10 attempts and exponential backoff
* Store transaction ID (tx_id) from API response headers for debugging
* Enhanced reliability for payment processing

= 1.0.2 - 2026-02-16 =
* Fixed HPOS compatibility issue with order meta data saving
* National ID and student fields now properly save on checkout
* Works with both official WooCommerce checkout and Elementor custom pages
* Cleaned up debug code
* Added proper nonce verification handling

= 1.0.1 - 2026-02-10 =
* Security: Added proper sanitization and validation for webhook data
* Security: Fixed escaping in inline admin scripts
* Security: Added UUID format validation for checkout IDs in webhooks
* Security: Added status validation for webhook callbacks
* Fixed order note escaping for webhook status updates

= 1.0.0 - 2026-01-18 =
* Initial release
* Items API support
* Schooling API support for educational payments
* WooCommerce Blocks integration
* Arabic translation support
* Automatic webhook verification
* Scheduled order cancellation for unpaid orders
* Sandbox mode for testing
* National ID validation
* Mobile number validation
* HPOS (High-Performance Order Storage) compatibility

== Upgrade Notice ==

= 1.1.0 =
Major improvement - Simplified checkout experience with fewer required fields. Only National ID is now required for Schooling API payments. Student name is automatically captured from billing information. Recommended for all users.

= 1.0.5 =
Bug fix - Fixed promo banner link to redirect to WooCommerce checkout page instead of external website. Recommended for all users.

= 1.0.4 =
New feature - Added promotional banner on cart page to highlight JeelPay installment options. Customers can now see JeelPay payment information before reaching checkout.

= 1.0.3 =
Enhancement release - Added idempotency support and automatic retry logic for improved payment reliability. Recommended for all users.

= 1.0.2 =
Bug fix release - Fixed HPOS compatibility issue that prevented National ID fields from saving properly on checkout pages with custom shortcodes (like Elementor).

= 1.0.1 =
Security update - Recommended for all users. Fixes sanitization and escaping issues.

= 1.0.0 =
Initial release of JeelPay for WooCommerce.

== Developer Notes ==

= Hooks & Filters =

The plugin provides several hooks for developers:

`jeelpay_get_order_reference_id` - Filter the order reference ID sent to JeelPay
`jeelpay_get_order_by_reference_id` - Filter order retrieval by reference ID

= Action Scheduler =

The plugin uses WooCommerce Action Scheduler for recurring tasks. View scheduled actions at:
WooCommerce > Status > Scheduled Actions > Filter by "jeelpay" group

= Translation =

The plugin is translation-ready. Translation files are located in `/languages/`.

== Privacy Policy ==

= What data is collected? =

When a customer makes a payment using JeelPay, the following information is sent to JeelPay's servers:

* Order total and items
* Customer billing information (name, email, phone)
* National ID (as entered by customer, Schooling API only)

= Data Retention =

JeelPay transaction IDs and checkout session IDs are stored in order metadata for reconciliation purposes.

= Third Party Services =

This plugin connects to JeelPay's API servers:
* Production: `https://api.jeel.co`
* Sandbox: `https://api.sandbox.jeel.co`

By using this plugin, you agree to JeelPay's [Terms of Service](https://jeel.co/terms) and [Privacy Policy](https://jeel.co/privacy).
