=== Formipay – Donations & Instant Payment Forms (Paystack, Flutterwave & More) ===
Contributors: jackieriel
Tags: donation, paystack, flutterwave, payment, nigeria
Requires at least: 6.7
Tested up to: 7.0
Requires PHP: 7.2
Stable tag: 4.0.1
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Author URI: https://jacksonjonah.com.ng/about-me/

Receive donations and payments instantly via Paystack and Flutterwave using lightweight, secure, and conversion-focused forms.

== Description ==

Formipay is a lightweight and powerful donation and payment plugin designed for non-profits, charities, and businesses. It currently supports **Paystack** and **Flutterwave** payment gateways, offering secure transaction processing with **Server-Side Verification** to prevent fraud.

**Key Features:**

*   **SaaS-Grade Dashboard**: Distraction-free, full-width admin interface with premium card-based layouts.
*   **Multiple Gateways**: Switch between Paystack and Flutterwave easily with dynamic settings visibility.
*   **Payment/Donation Forms**: Create multiple payment/donation forms with fixed, flexible, or dropdown amounts.
*   **Custom Fields**: Collect extra information (e.g., Phone number, Address) from donors or payee. Support for Required fields.
*   **Field Types**: Support for Text, Textarea, Dropdown, Checkbox, Date, Time, and Date/Time fields.
*   **Transaction History**: View detailed logs with a clickable, perfectly aligned details modal and advanced search.
*   **Transaction Checker**: Frontend lookup tool using `[formipay_checker]` shortcode.
*   **Form Styling**: Customize form width and add custom CSS per form.
*   **Secure**: Uses server-side verification to ensure payments are authentic.
*   **Shortcode Support**: Embed forms anywhere using `[formipay id="123"]`.

**Upcoming Features:**

*   Integration other payment gateways

== Installation ==

1.  Upload the plugin files to the `/wp-content/plugins/formipay` directory, or install the plugin through the WordPress plugins screen directly.
2.  Activate the plugin through the 'Plugins' screen in WordPress.
3.  Go to the **Formipay** menu to configure your API keys (Paystack/Flutterwave).
4.  Create a new Payment/Donation Form and copy the generated shortcode.
5.  Paste the shortcode into any Page, Post, or Widget to display the form.
6.  Create success/thank you page and enter the page URL in form settings if you don't want to use the default success page.

== WP-Cron Background Sync Setup ==

Formipay includes an automatic background sync that runs every 10 minutes to retrieve any missed transactions directly from Paystack/Flutterwave APIs.

By default, WordPress triggers scheduled tasks (WP-Cron) when users visit your website. For highly reliable, timely background syncing, it is recommended to set up a real system cron job:

1. Open your `wp-config.php` file and add the following line to disable default visitor-triggered cron:
   `define( 'DISABLE_WP_CRON', true );`
2. Set up a real cron job on your hosting server (via cPanel or SSH command line) to trigger every 10 minutes:
   `wget -q -O - https://yourdomain.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1`

== Frequently Asked Questions ==

= Do I need an SSL certificate? =
Yes, for live transactions, it is highly recommended to have an SSL certificate installed on your site to ensure security.

= Can I use this for recurring payments? =
Currently, this plugin supports one-time payments. Recurring payment support may be added in future versions.

== Disclaimer & External Services ==

This plugin relies on external payment services to process transactions. By using this plugin, you agree to the terms and privacy policies of these providers:

*   **Paystack:** Used for processing secure payments in Africa. [Privacy Policy](https://paystack.com/terms)
*   **Flutterwave:** Used for processing secure payments globally and in Africa. [Privacy Policy](https://flutterwave.com/ng/privacy-policy)

== Screenshots ==

1.  **Dashboard Settings** - Configure API keys and default gateway.
2.  **Payment/Donation Form** - Payment/donation form creation.
3.  **Payment/Donation Form** - Payment/donation form with corresponding shortcode.
4.  **Payment/Donation Form** - Shortcode usage in a page.
5.  **Payment/Donation Form** - Example of a frontend payment/donation form.
6.  **Transaction History** - View list of donations.

== Changelog ==

= 4.0.1 =
*   **Consent Field Type**: Added a new custom field type for user consent (rendered as the last item right before the submit/pay button), supporting customizable font size and HTML links (such as anchor links to terms/privacy policies) in the checkbox labels.

= 4.0.0 =
*   **WP-Cron Background Sync**: Automated transaction synchronization in the background every 10 minutes, supporting both Paystack and Flutterwave configurations.
*   **Verification Speed & Reliability Improvements**: Optimized the transaction verification endpoint to prevent frontend verification hangs by verifying webhook-created records instantly and sending notification emails asynchronously.
*   **Quantity Payment Improvements**: Added admin options to toggle dynamic name input fields, customize the quantity dropdown placeholder text, and customize the total payment amount label.
*   **Structured Custom Fields Layout**: Formatted custom fields output to display line-by-line as a clean numbered list inside transaction details and emails.
*   **Post-Payment Reset**: Configured forms to auto-clear all inputs and dynamic sub-forms upon a successful payment without a redirect.

= 3.0.6 =
*   **Amount Field Configuration**: Added configuration option to customize the label of the Amount field (useful for course registration, tuition payments, etc.).
*   **Bypass Page Redirection**: Added a per-form option to disable redirection after successful payment, showing inline feedback and retaining page context.
*   **Currency Prefix & Format**: Formatted display amounts with comma separators and currency prefix (e.g. `NGN 300,000` or `NGN 100,000 - AI Automation`).
*   **Dynamic Completion Button**: Updated success button text to be context-aware (e.g. "Registration Complete" or "Payment Complete" depending on original label).

= 3.0.5 =
*   **Cashier Dashboard Access**: Updated permissions to allow the Formipay Cashier role to export transaction logs to CSV and sync transactions from the frontend dashboard.

= 3.0.4 =
*   **Dropdown Amount Method**: Added a new dropdown amount method allowing administrators to specify multiple predefined payment amounts (supporting custom labels like `500|Standard`).

= 3.0.3 =
*   **Gateway Fix**: Corrected the Flutterwave Test API Key integration for accurate sandbox environment testing.

= 3.0.2 =
*   **Premium Export Engine**: Added a powerful CSV export utility that dynamically handles custom form fields with dedicated columns for deep data analysis.
*   **Intelligent Pagination**: Implemented server-side pagination (40 per page) with a modern Indigo-themed UI for high-performance navigation through large transaction histories.

= 3.0.1 =
*   **Transaction Reliability Engine**: Implemented on-the-fly verification and a manual sync utility to capture transactions missed by browser timeouts.
*   **Passive Webhooks**: Added support for optional background webhooks for real-time transaction recording without conflicting with other plugins.
*   **Dashboard Enhancements**: Added a "Sync Transactions" utility to the dashboard and improved the transaction details modal.

= 3.0.0 =
*   **Major UI/UX Overhaul**: Transformed the entire plugin admin into a premium, SaaS-grade experience.
*   **New Dashboard**: Custom distraction-free landing page with real-time stats and premium card layout.
*   **Responsive Forms List**: Redesigned the Payment Forms list with tactile depth and smooth animations.
*   **Settings Engine 2.0**: Rebuilt the settings interface into a modern, card-based configuration hub.
*   **Mobile Optimization**: Full-width responsive layout for both Desktop and Mobile devices.
*   **Dynamic Gateway Toggling**: Intelligent settings visibility based on the selected payment gateway.
*   **Enhanced Transaction Modal**: Refined the transaction details popup with improved alignment and clarity.
*   **New 'Cashier' Role**: Introduced the **Formipay Cashier** user role, allowing non-admin users secure access to the transaction dashboard.

= 2.0.2 =
* Added support for multiple comma-separated Admin Notification Emails.
* Added Responsive Form Width settings for Tablet and Mobile devices.
* Improved mobile experience: First and Last Name fields now stack vertically on small screens.
* Added flexible "Field Width" settings (Full/Half) for all Default and Custom fields.
* Refactored shortcode rendering for better responsive field grouping.

= 2.0.1 =
* Fixed shortcode rendering bug

= 2.0.0 =
*   Added "Required?" setting for custom fields to enforce mandatory input.
*   Added new custom field types: Date, Time, and Date and Time.
*   Introduced a professional Tabbed Interface in the Admin UI (General, Custom Fields, Appearance, Notifications).
*   Added Form Styling options: Form Maximum Width and Custom CSS per form.
*   Added Transaction Checker feature with `[formipay_checker]` shortcode for frontend lookups.
*   Improved Transaction History: Clickable Transaction IDs with a details modal preview.
*   Improved Transaction History Search: Support for searching by Reference ID and Donor Email.
*   Moved placeholder settings to the General tab for better flow.
*   General UI/UX improvements and better form validation.

= 1.0.3 =
*   Added ability to customize default fields (First Name, Last Name, Email, Phone) placeholder texts per form.

= 1.0.2 =
*   Added Elementor Widget integration for easy form embedding.
*   General improvements and bug fixes.

= 1.0.1 =
*   Added Dropdown and Checkbox field types with options support.
*   Added Display Layout options (Inline/Block) for checkbox groups.
*   Added option to hide amount field for Fixed Amount forms.
*   Added Admin Notification Emails per form for instant payment alerts.
*   Added User Confirmation Emails with Rich Text (HTML) and dynamic placeholders.
*   Redesigned Custom Fields Admin UI with a professional grid layout.
*   Improved Paystack metadata synchronization for better transaction clarity.
*   Improved checkbox data collection logic and overall form styling.

= 1.0.0 =
*   Initial release.
*   Added Paystack and Flutterwave support.
*   Added Transaction History custom post type.

== Donation ==

If you find FormiPay helpful and would like to support its continued development, you can buy the developer a coffee here: http://jacksonjonah.com.ng/buymecoffee

