=== CatCode Czech Payments for WooCommerce ===
Contributors: catcodestudio
Tags: gopay, comgate, payment gateway, czech republic, slovakia
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

GoPay and Comgate for WooCommerce: cards, Apple Pay, Google Pay, bank buttons and QR payments for shops in the Czech Republic and Slovakia.

== Description ==

Two payment gateways in one plugin, for shops in the Czech Republic and Slovakia: **GoPay** and **Comgate**. Enable one or both; each has its own settings. The buyer pays on the secure page of the provider with a card, Apple Pay, Google Pay, a bank button or a QR code, whichever you have enabled there.

The plugin is built around one rule: an order is marked paid only when the provider itself says so, and a buyer who paid and closed the tab is not lost.

* **Orders confirmed by the API, not by the browser** — after every payment the plugin reads the payment back from the provider with your own credentials, on the buyer's return, on the notification and on the thank-you page. The return address and the body of a notification are only a hint. The Comgate notification is also checked against your connection password.
* **Amount and currency are compared** — a payment that does not match the order puts it on hold with a note instead of marking it paid, and a test payment can never pay a live order.
* **Bank transfers do not lose their order** — when the buyer has chosen a method and the money is on its way, the order waits on hold, so the WooCommerce timer for unpaid orders does not cancel it after an hour. It updates by itself when the money arrives.
* **No double e-mails, no double stock reduction** — the notification and the buyer's return can arrive in the same second; a database lock and a fresh read of the order apply each payment exactly once (HPOS order cache included).
* **Retries that just work** — every attempt is its own payment. When the buyer tries again, the previous Comgate payment is closed first, and an unused GoPay payment is offered again, so an old tab is unlikely to pay twice; if it happens anyway, the order note says so.
* **A buyer who cancels keeps the order** — they land on the order page with a clear message and can try again or choose another method; the order shows "Failed" with a note and the reason, when the provider gives one.
* **Shown only when it can work** — each method hides for currencies its provider does not take, and Comgate for amounts outside its limits.
* **Offered methods** — limit the payment page to cards, banks or wallets of your choice.
* **"Re-check the payment"** in the order actions — one click asks the provider and settles the order.
* **Test mode** — the GoPay sandbox with its own credentials, and Comgate test payments with your usual ones. "Check connection" shows what your account allows and tests that your notification address answers, even before you save.
* Classic and block checkout, HPOS compatible, virtual and downloadable products, "Processing" or "Completed" after payment, debug log without secrets. Secrets are stored encrypted. The payment page opens in the language of the buyer.
* Translations included: Czech and Slovak.

= Pro =

The Pro version is sold on [catcode.com.ua](https://catcode.com.ua/modules/catcode-czech-payments-for-woocommerce/), with a 7-day trial that never starts by itself. One licence covers both gateways:

* **Refunds from the order screen** — full or partial, through the API of the provider; partial refunds are counted, so the provider is never asked for more than the payment still holds.
* **Choice at checkout** — your banks, cards and wallets listed right at checkout, so the buyer lands directly on the chosen one. Apple Pay is listed only on devices that can pay with it.
* **Reserve, charge later** — reserve the amount on the card at checkout and charge it when the order ships: automatically when the order reaches the status you choose, or from the order actions. Cancelling the order releases the amount. It has to be enabled on your account at the provider.
* **Payment watchdog** — every 15 minutes the plugin re-checks the unpaid orders of the last 48 hours, so a payment whose notification was blocked still settles. Bank transfers on their way are followed for a week, and you get a warning a day before a GoPay reservation ends.
* **Payment journal** — every payment with its ID, method, amount, refunds and reservations, and a one-click re-check.

The licence runs for 1-5 years and includes updates and support for that term; a purchased licence keeps its Pro features after the term ends. One key covers two sites: the shop and its test copy.

GoPay and Comgate are trademarks of their owners. This plugin is an independent integration made by CatCode; it is not an official plugin of either and is not affiliated with or endorsed by them.

== External services ==

The plugin connects only to the provider of a gateway you have enabled, to create and read payments and to list the payment methods of your account.

* **GoPay** (GoPay s.r.o., [gopay.com](https://www.gopay.com/en/)): `gate.gopay.cz`, and `gw.sandbox.gopay.com` in test mode. Sent when an order is placed: amount, currency, order number, order lines, the buyer's name, e-mail, phone and billing address, and the addresses the buyer returns to.
* **Comgate** (Comgate a.s., [terms and documents](https://www.comgate.eu/documents)): `payments.comgate.cz`. Sent when an order is placed: amount, currency, order number, the buyer's name, e-mail, phone, billing and delivery address, and the addresses the buyer returns to.

== Installation ==

1. Upload the plugin and activate it.
2. WooCommerce → Settings → Payments → **GoPay (CatCode)** and/or **Comgate (CatCode)**.
3. GoPay: paste the GoID, ClientID and ClientSecret of the sandbox and, when you go live, of production. There is nothing to set up on the GoPay side: the plugin tells GoPay the notification address with every payment.
4. Comgate: in the Client Portal open Integration → E-shop settings → your shop → E-shop connection. Copy the identifier and the password into the plugin, add the IP address of your server to the allowed list, and paste the address shown in the plugin settings as the URL for the background payment result.
5. Press "Check connection", enable the method, place a test order, then switch test mode off.

== Frequently Asked Questions ==

= Which currencies work? =

GoPay: CZK, EUR, PLN, USD, GBP, HUF, RON. Comgate: CZK, EUR, PLN, HUF, USD, GBP, RON, NOK, SEK. The method hides at checkout in any other currency.

= Comgate says the request is not allowed. What now? =

Comgate accepts API calls only from the addresses on the allowed list of the connection. Add the IP address of your server there. Your hosting company can tell you which address your site calls out from.

= An order stayed "Pending payment" although the buyer paid. =

Use "Re-check the payment" in the order actions. With Comgate, also check that the notification address is set in the Client Portal. A firewall or security plugin must let requests to it through.

= Can I use both gateways at once? =

Yes. They are separate payment methods with separate settings. A buyer can even start with one and finish with the other: every attempt stays on the order.

= Does the buyer see the method on the page of the provider? =

Yes. The page shows what is enabled on your account, limited by "Offered methods" if you set it.

== Changelog ==

= 1.0.1 =
* Saved secrets no longer travel into the settings page: the field stays empty with a "saved" mark, and leaving it empty keeps the value.
* A refused GoPay refund says so in words.

= 1.0.0 =
* First release: GoPay and Comgate gateways with cards, Apple Pay, Google Pay, bank buttons and QR payments, API-confirmed orders, block checkout, HPOS, test mode, connection check and re-check action.
* Pro: refunds from the order screen, choice of bank and card at checkout, reserving an amount on the card, payment watchdog, payment journal, licence and updates.
