Tpay Integration
Polski PRO adds a Tpay payment gateway to WooCommerce. The customer pays by bank transfer, BLIK or card, Tpay notifies the shop, and the order is marked as paid. Payments need a Tpay account, a merchant ID and a security code. Refunds from the order screen also need an API key and an API password.
Supported methods
Section titled "Supported methods"| Method | How it works |
|---|---|
| Bank transfer | The customer picks the bank on the Tpay payment page |
| BLIK | The customer ticks "Pay with BLIK" and types the 6-digit code at your checkout |
| Payment card | Paid on the Tpay page |
The gateway is not switched on in Polski > Modules. Once Polski PRO is active it appears in the WooCommerce payment methods as Tpay, disabled by default.
Configuration
Section titled "Configuration"Go to WooCommerce > Settings > Payments > Tpay.
| Setting | Default | Description |
|---|---|---|
| Enable/Disable | off | Shows the gateway at checkout |
| Title | Tpay | Method name the customer sees |
| Description | Pay via bank transfer, BLIK or credit card. | Text under the method name at checkout |
| Merchant ID | empty | Your Tpay merchant ID (4-5 digits) |
| Security code | empty | Code from the Tpay panel; signs payments and notifications |
| API key | empty | 40-character API key, needed only for refunds |
| API password | empty | API password, needed only for refunds |
| BLIK | on | Shows the BLIK code field at checkout |
| Payment surcharge | None | None, a fixed amount (PLN) or a percentage of the order total |
| Surcharge amount | 0 | Amount in PLN or the percentage value |
| IP validation | on | Accepts notifications only from Tpay IP addresses |
| Auto-complete | off | Sets the order to "Completed" once it is paid |
| Initial order status | Pending payment | "Pending payment" or "On hold", set before the customer goes to Tpay |
Since 1.32.4 there is no Bank selection setting. Nothing read it: the customer always picks the bank on the Tpay page.
Without a merchant ID and a security code the customer sees "Payment gateway not configured." at checkout and cannot pay.
Payment flow
Section titled "Payment flow"- The customer chooses Tpay at checkout. With BLIK ticked, the plugin checks that the code has exactly 6 digits. If it does not, no order is created and the customer sees "Please enter a valid 6-digit BLIK code.".
- The order gets the initial status from the settings and the customer is sent to
https://secure.tpay.com. The plugin passes the amount, the description "Order #number", the e-mail, the first and last name and the language PL. For BLIK it adds channel 64 and the code. - After payment Tpay sends a notification to the gateway's WooCommerce API address (
/wc-api/polski_tpay/) and the customer returns to the thank-you page. After a failed payment the customer returns to checkout.
The notification address goes to Tpay with every payment, so you do not enter it in the Tpay panel.
The BLIK field is rendered by the gateway's classic payment_fields() method. The plugin does not register a separate integration for the Checkout block.
Payment surcharge
Section titled "Payment surcharge"The surcharge applies only when the customer chose Tpay. It shows in the cart as a taxable fee "Payment surcharge".
- Fixed amount: the value of "Surcharge amount" in PLN is added.
- Percentage: calculated from the cart subtotal including tax. Shipping is not part of the base.
An amount of 0 or less turns the surcharge off, even when a surcharge type is selected.
Notification checks (IPN)
Section titled "Notification checks (IPN)"Every Tpay notification goes through these checks in order:
- With IP validation on, the sender IP must be on the Tpay allowlist (5 addresses). Proxy headers (
X-Forwarded-For,CF-Connecting-IP) count only when the site enables thepolski/trusted_proxyfilter from the free Polski plugin. Otherwise the plugin usesREMOTE_ADDR. - The gateway must have a saved merchant ID and security code. An unconfigured gateway rejects notifications.
- The order encoded in the CRC field must exist and be paid with Tpay.
- The MD5 checksum must match:
md5(merchant_id + transaction_id + amount + crc + security_code).
A rejected notification gets a 400, 403 or 404 response and does not change the order.
Order status after a notification
Section titled "Order status after a notification"| Situation | What the plugin does |
|---|---|
| Status TRUE or PAID, full amount | payment_complete() with the Tpay transaction ID, optionally "Completed" |
| Status TRUE or PAID, less paid than the order total | "On hold" with an underpayment note; the order is not marked as paid |
Overpayment (error overpay) |
Order paid, with an overpayment note |
| CHARGEBACK | "Refunded" with a note |
An order that is already paid is not processed again.
Refunds
Section titled "Refunds"A refund entered on the WooCommerce order screen goes to the Tpay Transaction API. It needs the API key, the API password and the transaction ID the gateway stores when the order is paid. When Tpay confirms the refund, the order gets a note with the amount. When data is missing or Tpay returns an error, WooCommerce shows the refund as failed.
Where does the customer enter the BLIK code?
Section titled "Where does the customer enter the BLIK code?"At your checkout. Ticking "Pay with BLIK" shows a 6-digit field. The plugin checks the code before the order is placed and sends it to Tpay with the payment.
What happens when the customer pays too little?
Section titled "What happens when the customer pays too little?"The order goes to "On hold" with a note of the amount paid and the amount due. The plugin does not mark it as paid; the decision is yours.
Does a percentage surcharge include shipping?
Section titled "Does a percentage surcharge include shipping?"No. It is calculated from the cart subtotal including tax, without shipping.
Do refunds work without an API key?
Section titled "Do refunds work without an API key?"No. A refund from the order screen needs the API key and API password from the Tpay panel. Payments work without them.