=== CatCode Przelewy24 & BLIK for WooCommerce ===
Contributors: catcode
Tags: woocommerce, payment gateway, przelewy24, blik, poland
Requires at least: 6.2
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Przelewy24 payments for WooCommerce (REST API v1): transfers, cards and BLIK, a separate BLIK method, signed notifications confirmed with transaction/verify. Pro: BLIK code at checkout, bank choice, refunds.

== Description ==

A WooCommerce payment gateway for **Przelewy24** (Poland), built on the Przelewy24 REST API v1.

Free:

* **Przelewy24** method — the buyer pays by bank transfer, card, BLIK or wallet on the Przelewy24 page.
* **BLIK** as its own line at checkout — the buyer lands on the Przelewy24 page with only BLIK offered.
* Works with the block checkout and the classic checkout, HPOS compatible.
* Payment notifications are applied only when their SHA-384 signature matches your CRC key, merchant and POS, and the amount and currency match the order. The payment is then confirmed with transaction/verify, as Przelewy24 requires — without it the money is not settled.
* The buyer's return is never taken as proof of payment: the plugin asks Przelewy24 for the transaction status itself. The order page keeps checking and updates by itself when the payment is confirmed; a buyer who cancelled gets a "Pay again" button.
* A repeat attempt (order-pay page, back button) first checks whether an earlier attempt was already paid, so one order is not charged twice. A second payment for a paid order is not confirmed and is flagged in the order notes.
* A paid amount different from the order puts the order on hold and is not confirmed.
* Protection against the notification and the buyer's return arriving at the same moment (no double "payment received").
* Sandbox and live credentials side by side, one switch between them. Orders remember the environment they were paid in.
* "Check connection" button (testAccess).
* Przelewy24 page language, time to pay, order status after payment.
* CRC and API keys are stored encrypted. Debug log without buyer contacts or keys.
* Translations: Polish.

Pro (licence from catcode.com.ua):

* **BLIK code right at checkout** (BLIK level 0, method 181/342 + chargeByCode): the buyer types the 6-digit code and accepts the Przelewy24 terms in your shop, then confirms in the banking app; the order page waits for the confirmation. If your account does not have BLIK level 0, the buyer is sent to the Przelewy24 page instead.
* **Bank choice at checkout**: the methods enabled for your Przelewy24 account are shown with their logos, the buyer goes straight to the chosen bank; the optional Przelewy24 terms consent skips the same question on the Przelewy24 page.
* Refunds, full and partial, from the WooCommerce order screen (transaction/refund), with the Przelewy24 refund notification written to the order.
* Payment journal: amount, method, Przelewy24 transaction, state, refunds and a one-click status check.

== Installation ==

1. Upload the plugin to `/wp-content/plugins/` and activate it.
2. WooCommerce → Settings → Payments → **Przelewy24**.
3. Enter the merchant ID, POS ID (if different), CRC key and API key ("reports key") of the sandbox account, save, press "Check connection".
4. Place a test order. BLIK in the sandbox: a code 777XXX succeeds, any other 6 digits fail.
5. Enter the live credentials and switch sandbox off.
6. Optional: enable **BLIK (Przelewy24)** in the Payments list.

The notification address is sent to Przelewy24 with every payment — nothing to configure in the Przelewy24 panel.

== Frequently Asked Questions ==

= Do I need a Przelewy24 account? =
Yes. Przelewy24 issues the merchant ID, the CRC key and the API key. A sandbox account can be enabled in the production panel (My data → Sandbox account) once the production account is active.

= Can it run next to the Przelewy24 plugin? =
Yes. This plugin uses its own gateway ids (`cc_przelewy24`, `cc_przelewy24_blik`) 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 order page and on every notification; Przelewy24 also repeats the notification until the payment is verified. Press "Check" in the payment journal (Pro) to ask right away. Make sure the credentials pass "Check connection" in the environment the order was paid in.

= Which currencies? =
PLN by default. Other currencies have to be enabled for your account by Przelewy24; then add them with the `p24wc_currencies` filter. BLIK is PLN only.

= Free and Pro =
Accepting 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.0 =
* First release: Przelewy24 REST API v1, signed notifications with transaction/verify, status check on return, amount and currency check, repeat-attempt protection, sandbox/live credentials, connection check, classic and block checkout, separate BLIK method.
* Pro: BLIK code at checkout, bank choice at checkout, refunds (full and partial), payment journal.
