=== NETOPIA Payments for WooCommerce ===
Contributors: catcode
Tags: woocommerce, payment gateway, netopia, romania, oney
Requires at least: 6.2
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.0.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Card payments in Romania through NETOPIA Payments (API v2). Signed IPN check, status check before an order is marked paid, block and classic checkout. Pro: Oney and PayPo.

== Description ==

A WooCommerce payment gateway for **NETOPIA Payments** (Romania), built on the NETOPIA API v2 — no certificate files, just the POS signature and an API key.

Free:

* Sends the buyer to the NETOPIA payment page (Visa, Mastercard and whatever else NETOPIA enabled for your POS).
* Works with the block checkout and the classic checkout, HPOS compatible.
* Payment notifications (IPN) are applied only when their signature checks out: the Verification-token must be signed by NETOPIA, issued for your POS signature and match the exact message body. A notification that fails the check is not trusted — the plugin asks NETOPIA for the status itself.
* The buyer's return is never taken as proof of payment: the order is confirmed after a status request to NETOPIA.
* Checks that the paid amount and currency match the order; a shortfall puts the order on hold.
* A repeat attempt (order-pay page, back button) first checks whether an earlier attempt was already paid, so one order is not charged twice.
* Protection against the IPN and the buyer's return arriving at the same moment (no double "payment received").
* Sandbox and live keys side by side, one switch between them. Orders remember the environment they were paid in.
* "Check connection" button — tests the API key of the selected environment before the first buyer arrives.
* Payment page in Romanian or English. Currencies: RON, EUR, USD.
* API keys are stored encrypted. Debug log without buyer contacts or keys.
* Translations: Romanian, Ukrainian.

Pro (licence from catcode.com.ua):

* **Oney** — 3 or 4 interest-free instalments for orders of 450–12,000 RON, with the instalment amount shown at checkout.
* **PayPo** — buy now, pay in 30 days, for orders from 50 RON.
* Refunds, full and partial, from the WooCommerce order screen (card payments).
* Payment journal: amount, method, NETOPIA status, transaction ID, masked card, authorisation code and a one-click status check.

Oney and PayPo appear at checkout only when the order fits the partner limits and the shop currency is RON. Both have to be activated for your POS by NETOPIA.

== Installation ==

1. Upload the plugin to `/wp-content/plugins/` and activate it.
2. WooCommerce → Settings → Payments → **NETOPIA Payments**.
3. Enter the POS signature (admin.netopia-payments.com → Points of sale → ⋮ → Technical settings) and the sandbox API key (sandbox account → Profile → Security), save.
4. Press "Check connection", then place a test order with a NETOPIA sandbox card.
5. Ask NETOPIA (implementare@netopia.ro) to validate the integration. After the POS is activated, enter the live API key and switch sandbox off.

The IPN address is sent to NETOPIA with every payment — nothing to configure in the NETOPIA admin.

== Frequently Asked Questions ==

= Do I need a contract with NETOPIA? =
Yes. NETOPIA issues the POS signature and the API keys. Until NETOPIA validates the integration you can only use the sandbox.

= Can it run next to NETOPIA's own plugin? =
Yes. This plugin uses its own gateway id (`cc_netopia`) and settings, so nothing is overwritten. Enable only one of them at checkout.

= The buyer paid but the order is still pending. =
The status is requested when the buyer returns, on the thank-you page and on every IPN. If none of them reached the shop, press "Check" in the payment journal (Pro). Make sure the API key passes "Check connection" in the same environment the order was paid in.

= An IPN was rejected in the log. =
Check that the POS signature in the settings is exactly the one of the POS that took the payment, and that the PHP openssl extension is enabled. The order is still reconciled through the status request.

= Free and Pro =
Accepting card payments is free, with no time limit. Pro features are unlocked with a licence key from catcode.com.ua. The 7-day trial starts only when you click it. A purchased licence keeps its Pro features after the term ends — only updates and support stop.

== Changelog ==

= 1.0.1 =
* Fixed: the product list sent to NETOPIA left out shipping and fees, so the buyer saw a list worth less than the amount being charged. Both are sent as their own rows now.


= 1.0.0 =
* First release: NETOPIA API v2 payment page, signed IPN verification, status check on return, amount and currency check, repeat-attempt protection, sandbox/live keys, connection check, classic and block checkout.
* Pro: Oney and PayPo, refunds (full and partial), payment journal.
