=== InstantPay – Solana Payments ===
Contributors: instantpay
Tags: payments, solana, crypto, donations, digital products
Requires at least: 5.8
Tested up to: 6.8
Requires PHP: 7.4
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Accept Solana (SOL) donations and sell digital products using your InstantPay account – directly from WordPress, without leaving your dashboard.

== Description ==

InstantPay is a Solana-based payment platform that lets you create a personalized payment page (like `https://instantpay.now/u/yourname`) and receive SOL payments directly to your wallet.

This plugin brings that experience into WordPress:

- Manage your InstantPay account from a dedicated **InstantPay** menu in wp-admin (embedded dashboard).
- Add **donation widgets**, **product purchase widgets**, or your full **InstantPay page** to any post or page.
- Keep using your existing InstantPay setup – public pages and embeddable widgets continue to work as before.

All payments are processed securely on InstantPay. Your WordPress site never handles private keys or raw blockchain operations.

**Key features:**

- Embedded InstantPay dashboard inside WordPress admin.
- Shortcodes and (basic) Gutenberg blocks for:
  - Donate widgets
  - Product widgets
  - Full payment page embeds
- Auto-resizing iframes to avoid scrollbars.
- Designed to be safe: only `https://instantpay.now` is allowed as iframe/message origin.

== Installation ==

1. Upload the plugin files to the `/wp-content/plugins/instantPayWordpress` directory, or install via the WordPress plugins screen.
2. Activate the plugin through the **Plugins** screen in WordPress.
3. In the WordPress admin menu, click on **InstantPay**.
4. Inside the embedded InstantPay dashboard:
   - Connect your Solana wallet (e.g. Phantom).
   - Choose your username and finish onboarding (if you haven't already).
   - Configure your payment page, digital products and widgets.
5. Optionally, go to **Settings → InstantPay** (or the settings section in the InstantPay admin page) to:
   - Confirm your InstantPay username.
   - Review the site token (if used).
   - Enable or disable automatic loading of the frontend embed script.

== Usage ==

Once your account is connected, you can add InstantPay to your content in two ways:

- **Shortcodes** – for classic editor or quick manual embeds.
- **Gutenberg blocks** – for a more visual experience in the block editor.

=== Donate Widget ===

`[instantpay_donate]`

Attributes:

- `username` (optional) – If omitted, the username from plugin settings is used.
- `amount` (optional) – Default donation amount (in SOL).
- `theme` (optional) – Visual theme, e.g. `light`, `dark`, `auto`.

Example:

`[instantpay_donate amount="0.5" theme="dark"]`

=== Product Widget ===

`[instantpay_product id="PRODUCT_ID"]`

Attributes:

- `id` (required) – The ID of the digital product in your InstantPay dashboard.
- `username` (optional) – If omitted, the username from plugin settings is used.
- `theme` (optional) – Visual theme.

Example:

`[instantpay_product id="prod_123" theme="light"]`

=== Full Payment Page Embed ===

`[instantpay_page]`

Attributes:

- `username` (optional) – If omitted, the username from plugin settings is used.

Example:

`[instantpay_page]`

This will embed your public payment page (e.g. `https://instantpay.now/u/yourname`) inside an iframe on your WordPress site.

=== Gutenberg Blocks ===

In the block editor, search for **InstantPay** to find:

- **InstantPay Donate Button** – matches `[instantpay_donate]`, with Inspector controls for default amount and theme.
- **InstantPay Product Purchase** – matches `[instantpay_product]`, with a required Product ID field and theme selector.
- **InstantPay Full Page Embed** – matches `[instantpay_page]`, with an optional username override.

All blocks render via the same shortcodes on the frontend, so behaviour is identical whether you use shortcodes or blocks.

== Frequently Asked Questions ==

= Do I need an InstantPay account before installing this plugin? =

No. You can create and configure your InstantPay account directly from the embedded dashboard inside WordPress. Just click on the **InstantPay** menu, connect your wallet and follow the onboarding steps.

= Are payments processed on my WordPress site? =

No. All payments are processed on **InstantPay** using Solana RPC infrastructure. Your WordPress site never handles private keys or raw blockchain transactions.

= Does this plugin change my existing InstantPay setup? =

No. Existing public pages (`/u/username`) and previously generated embed codes continue to work as they are. This plugin is an additional, convenient layer for WordPress users – it does not break or replace the existing SaaS behavior.

= Which wallets are supported? =

InstantPay primarily supports **Phantom** and other Solana Wallet Adapter compatible wallets. The exact list of supported wallets is managed by InstantPay and may grow over time.

== Screenshots ==

1. Embedded InstantPay dashboard inside WordPress admin.
2. Example donate widget embedded in a WordPress page.
3. Example product widget embedded in a WordPress page.

== Changelog ==

= 1.0.0 =

* Initial stable release.
* Embedded InstantPay dashboard via iframe in wp-admin.
* Shortcodes for donate, product and full payment page embeds.
* Gutenberg blocks with Inspector controls for all widget types.
* Product selection dropdown in Gutenberg Product block (fetches from InstantPay API).
* Frontend auto-resize script to avoid iframe scrollbars.
* Comprehensive security audit and CSRF protection.
* Input sanitization and output escaping throughout.
* Fixed iframe heights for reliable widget display across themes.
* Real-time connection status updates via postMessage API.


