=== Solidgate Payment Gateway for WooCommerce ===
Contributors: solidgate
Tags: payment, gateway, credit card, woocommerce, checkout
Requires at least: 5.6
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 2.5.2
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Accept card payments via Solidgate. Supports classic and block checkout, with BLIK, MB Way, and Bizum.

== Description ==

Solidgate Payment Gateway for WooCommerce integrates the [Solidgate](https://solidgate.com) payment platform into your WooCommerce store. Customers can pay by credit or debit card directly on your checkout page using an embedded payment form, or be redirected to a Solidgate-hosted payment page.

The plugin supports both the classic WooCommerce checkout and the modern Gutenberg block-based checkout out of the box.

= Key features =

* **Embedded payment form** — card fields and APM buttons appear directly inside the checkout payment section as soon as the customer selects this gateway, no redirect required.
* **Hosted payment page** — redirect customers to a Solidgate-hosted page to complete payment.
* **Classic and block checkout** — fully compatible with both the legacy WooCommerce checkout and the WooCommerce Blocks (Gutenberg) checkout.
* **BLIK** — automatically rendered for PLN orders with a Poland billing address.
* **MB Way** — automatically rendered for EUR orders with a Portugal billing address.
* **Bizum** — automatically rendered for EUR orders with a Spain billing address.
* **Webhook-based order updates** — order status (authorized, settled, declined, refunded) is updated in real time via Solidgate webhooks.
* **Refunds from WooCommerce admin** — issue full or partial refunds directly from the order screen.
* **HPOS compatible** — fully supports WooCommerce High-Performance Order Storage (custom order tables).
* **Logging** — optional debug logging to the WooCommerce log for troubleshooting.

= How APMs work =

BLIK, MB Way, and Bizum buttons are rendered automatically by the Solidgate SDK when the order currency and the customer's billing country match the APM requirements. No extra configuration is needed — the SDK silently ignores button containers when conditions are not met, so enabling all three APMs has no visual impact on customers who are not eligible for them.

= Third-Party Service =

This plugin connects to the **Solidgate** payment platform (https://solidgate.com) to process payments. Solidgate is a third-party service — by using this plugin you are subject to their terms and privacy policy.

**What data is sent to Solidgate:**

* Order details: amount, currency, order ID
* Customer billing country and email address (used for payment form pre-fill and APM eligibility)
* Payment method data entered by the customer inside the Solidgate-hosted iframe (card numbers are never processed by your server)
* Webhook signatures sent from Solidgate to your site to confirm payment status

**When data is sent:** Data is transmitted at checkout when the customer initiates payment, and via webhooks when Solidgate sends order status updates (authorised, settled, declined, refunded).

* Solidgate Terms of Service: https://solidgate.com/terms/
* Solidgate Privacy Policy: https://solidgate.com/privacy-policy/

= Requirements =

* WordPress 5.6 or later
* WooCommerce 6.0 or later
* PHP 7.4 or later
* A Solidgate merchant account — [sign up at solidgate.com](https://solidgate.com)

== Installation ==

1. Upload the `solidgate-for-woocommerce` folder to `/wp-content/plugins/`, or install via **Plugins > Add New** in WordPress admin.
2. Activate the plugin through the **Plugins** screen.
3. Go to **WooCommerce > Settings > Payments** and click **Set up** next to "Solidgate Payment Gateway for WooCommerce".
4. Enter your credentials from the Solidgate merchant dashboard:
   * Public Key
   * Private Key
   * Webhook Public Key
   * Webhook Private Key
5. Choose your integration type: **Integrated form** or **Payment page**.
6. In the Solidgate dashboard, set your webhook URL to:
   `https://yoursite.com/?wc-api=solid_hook`

== Frequently Asked Questions ==

= Where do I get my API keys? =

Log in to your [Solidgate merchant dashboard](https://merchant.solidgate.com) and navigate to **Settings > API Keys**.

= What is the difference between "Integrated form" and "Payment page"? =

With **Integrated form**, the Solidgate card form appears directly inside the checkout payment section as soon as the customer selects this gateway — no redirect, no modal. Customers fill their card details inline and click Pay to authorize the payment, then WooCommerce finalizes the order. With **Payment page**, customers are redirected to a Solidgate-hosted page to complete payment and then returned to your store.

= How do I set up the webhook? =

In your Solidgate merchant dashboard, add a webhook endpoint pointing to `https://yoursite.com/?wc-api=solid_hook`. Solidgate will send order status events (authorize, settle, decline, refund) to this URL, and the plugin will update the corresponding WooCommerce order automatically.

= Does the plugin support refunds? =

Yes. You can issue full or partial refunds directly from the WooCommerce order screen (**WooCommerce > Orders > [order] > Refund**). The plugin calls the Solidgate refund API automatically.

= Which countries and currencies are supported for APMs? =

* **BLIK** — PLN (Polish Zloty), billing country: Poland
* **MB Way** — EUR, billing country: Portugal
* **Bizum** — EUR, billing country: Spain

APM buttons appear automatically when the order matches the required currency and country. No extra configuration is needed.

= Is the plugin compatible with WooCommerce HPOS? =

Yes. The plugin declares compatibility with WooCommerce High-Performance Order Storage (custom order tables) and uses `wc_get_orders()` for all order lookups.

= Does the plugin work with the block-based checkout? =

Yes. The plugin registers a WooCommerce Blocks payment method integration via `AbstractPaymentMethodType`. In Integrated form mode the card form renders inline in the payment method area. After the customer authorizes their card, WooCommerce's Place Order button finalizes the order.

= Is PCI compliance maintained? =

Yes. Card data is entered directly inside a Solidgate-hosted iframe served from `cdn.solidgate.com`. Your server never handles raw card numbers.

== Screenshots ==

1. Gateway settings screen in WooCommerce admin.
2. Embedded payment form (Integrated form mode) on classic checkout.
3. Embedded payment form on block-based checkout.
4. BLIK, MB Way, and Bizum APM buttons rendered alongside the card form.

== Changelog ==

= 2.5.0 =
* Changed: Integrated form mode now renders the card form inline in the payment section immediately when the gateway is selected, instead of opening a modal after clicking Place Order (Stripe/Braintree-style UX).
* Changed: Classic checkout no longer depends on jQuery Modal — removed that dependency.
* Changed: Both classic and block checkout share the same token-based flow through process_payment().
* Changed: /solid/v1/init REST endpoint now reads cart totals from the WC session when called without body parameters (classic checkout), so no extra AJAX is needed for amount/currency.
* Added: Loading shimmer animation while the payment form initializes.
* Added: Auto re-initialization when cart totals change (coupon or shipping update).

= 2.4.0 =
* Fixed: Plugin slug renamed to `solidgate-for-woocommerce` for WP.org compliance.
* Fixed: Plugin name updated to "Solidgate Payment Gateway for WooCommerce".
* Fixed: Text domain updated throughout to match plugin slug.
* Fixed: jQuery Modal bundled locally — removed CDN dependency.
* Fixed: `$_POST['solid_token']` now uses `wp_unslash()` before sanitization.
* Fixed: `$_GET['order_id']` validated with `isset()` before use in callbacks.
* Fixed: `print_r()` replaced with `wp_json_encode()` in all log calls.
* Fixed: Missing translators comments added to all sprintf/__() calls.
* Fixed: Removed `load_plugin_textdomain()` (auto-loaded since WP 4.6).
* Fixed: Webhook nonce check suppressed with explanation (server-to-server, no WP nonce).
* Fixed: Slow DB query phpcs notices suppressed with explanation.
* Added: `License` and `License URI` headers.
* Added: `readme.txt` and `composer.json`.

= 2.3.0 =
* Added: BLIK, MB Way, and Bizum APM support for classic and block checkout.
* Added: `geo_country` (ISO 3166-1 alpha-3) in order body for APM auto-rendering.
* Added: `future_usage: { payment_type: one-time }` globally (required by MB Way and Bizum).
* Fixed: APM container divs now output inline in `payment_fields()` for classic checkout.

= 2.2.0 =
* Added: WooCommerce Block checkout support via `AbstractPaymentMethodType`.
* Added: REST endpoint `/wp-json/solid/v1/init` for pre-order payment initialization.
* Added: React portal overlay for block checkout (bypasses WC processing-state opacity).
* Added: Billing email and country pre-filled in Solidgate form from WC store data.

= 2.1.0 =
* Initial public release.

== Upgrade Notice ==

= 2.4.0 =
Plugin slug renamed from `woocommerce-solid-gateway` to `solidgate-for-woocommerce` for WP.org submission. Existing merchant settings (stored under the `solid` gateway ID) are unaffected. Deactivate the old plugin before installing this version.
