Tpay integration through the Open API
Tpay transfers, BLIK, cards and refunds in a store, app or multi-seller platform. With the JWS signature checked on every notification and statuses you can trust.
What a Tpay integration is made of
From the checkout form to booking the payment. Every layer has its job and its test.
Before we start
- You open the Tpay account and sandbox access as the merchant.
- If the store runs on a popular platform, Tpay has a ready plugin for it and we start there.
- Marketplace needs the Tpay Partner Programme and a separate agreement, so we settle that first.
- We keep the client_id and client_secret in environment variables, never in code.
Tpay publishes no IP list, because the addresses are dynamic. The signature is the only safeguard, so checking it is mandatory.
Checkout and form
- method choice
- BLIK code field
- recurring consent
The customer picks BLIK and types the code, or agrees to recurring payments.
Your server
- OAuth token
- POST /transactions
- transaction stored on the order
The server creates the transaction and stores it on the order.
Tpay
- payment page or BLIK Level 0
- bank authorisation
- settlement
The customer authorises in the bank, and Tpay settles it.
Notifications
- JWS signature in X-JWS-Signature
- certificate checked against the Tpay root CA
The JWS signature is checked before anything changes.
This is where the status is decided
The order
- status paid
- refunds
- event log
The status paid and an entry in the event log.
Three ways to take BLIK with Tpay
BLIK can redirect the customer, stay on your page or remember the store for next time.
With a redirect
the eBLIK formWhere the code is enteredon the Tpay formField in the requestgroupId 150Customer stays in the storeNoLater purchases without a codeNoGood forthe simplest startConfirmationin the banking app, a BLIK code is valid for 2 minutesLevel 0
code on your pageWhere the code is enteredin your formField in the requestblikToken with the codeCustomer stays in the storeYesLater purchases without a codeNoGood forphone purchasesConfirmationin the banking app, a BLIK code is valid for 2 minutesOne Click
an alias instead of a codeWhere the code is enteredonly on the first paymentField in the requestthe user aliasCustomer stays in the storeYesLater purchases without a codeYesGood forstores and apps with accountsConfirmationin the banking app, a BLIK code is valid for 2 minutes
Refunds: the status trap
Full and partial refunds behave differently in Tpay. Your panel has to add refunds up itself, not just read the transaction status.
- A partial refund reaches 100%The first refund covered one plate, the second the rest of the order, the whole amount together. For Tpay both are partial refunds.
- The transaction status staysPartial refunds never change the status in Tpay, even at 100%. Your system counts the refunded amount, and only a full refund gives the refund status.
- The balance checked firstA refund only goes through when the account balance covers the amount and the fee. The panel shows this before you order it.
A payment in the Tpay marketplace
One customer payment for products from several sellers. This is the flow in the marketplace API.
- Customer 02217.00 PLN
A cart from three sellers, one payment.
Your platformTpay does not compare child amounts with product prices, so the platform checks them against the cart before it creates the transaction.
80.00 + 73.00 + 64.00 = 217.00 PLNPOST /marketplace/v1/transaction - child transactions
- Seller 0180.00 PLN
- Soy candle 180 g x 2: 68.00 PLN
- Delivery: 12.00 PLN
Tpay account 01J9W3K8QZ…C0MD - Seller 0273.00 PLN
- Linen towel 50 x 90 cm: 59.00 PLN
- Delivery: 14.00 PLN
Tpay account 01J9X0D4TR…KZ3W - Seller 0364.00 PLN
- A5 dotted notebook x 3: 54.00 PLN
- Delivery: 10.00 PLN
Tpay account 01JA1R9C3N…HB5Z
- The precondition
- The marketplace only works within the Tpay Partner Programme and after a separate agreement.
- Identifiers
- Sellers and points of sale have ULID ids encoded in base32. We store them with the seller accounts.
- The paid notification
- With the value the platform gave the transaction, such as the order number.
Checklist before going live
What we check on the Tpay sandbox before you take the first real payment.
- The payment path3
- Notifications and refunds3
The payment path
The OAuth token and its renewal
By default a token lives 2 hours. The module renews it before it expires instead of waiting for an error.
Redirect to transactionPaymentUrl
The payment address comes back when the transaction is created. We never build it ourselves.
BLIK after the time runs out
A code lives 2 minutes. We check the customer message and the retry path.
Notifications and refunds
The JWS signature on every notification
With no IP list, the signature is the only proof a notification came from Tpay.
A repeated notification
A second notice about the same payment must not activate a service or ship a parcel twice.
The partial refund counter
The Tpay status does not say how much was refunded, so the panel counts it.
Common questions about Tpay
Answers about BLIK, the marketplace and notifications.
Read next
Pages worth a look when choosing a gateway.
Do you sell alone or with other sellers?
Tell us where Tpay payments should work and whether you need a marketplace. We will reply within an hour with questions and a quote.

