s1awek

payload ecommerce tpay

by s1awek
Payments
v3
>=3.83.0 <4.0.0
MIT

Overview

Summary generated from the README

Adds a Tpay payment method to @payloadcms/plugin-ecommerce, replacing or complementing the built-in Stripe adapter. It supports BLIK, pay-by-link bank transfers and cards through one Tpay account. It mounts notification and BLIK endpoints and adds a tpay field group to the transactions collection, which requires a migration. Needs Payload 3.83 or newer and a Tpay merchant account.

Features

  • Payment adapter and client adapter following the ecommerce plugin PaymentAdapter contract
  • BLIK level 0 endpoints to enter the code in your own checkout and poll its status
  • Notification endpoint verified by checksum and a default-on JWS signature check
  • Checks amount and currency against the Tpay API before confirming an order
  • Idempotent order creation across notification and browser return paths
  • Environment variable fallbacks, sandbox mode and request timeouts

Use cases

  • Accept BLIK and Polish bank transfers in a Payload-based online shop
  • Keep BLIK customers inside the checkout without redirecting them to a payment page
  • Test Polish payment flows against the Tpay sandbox before going live

From the author

Tpay payment adapter for @payloadcms/plugin-ecommerce: BLIK, bank transfers and cards for Polish shops built on Payload CMS 3.

Installation

npm i @wellmade-online/payload-ecommerce-tpay

2

Stars

0

Forks

0

Open Issues

1 months ago

Last Updated

7

Weekly Downloads

v0.1.0

npm Version

224.2 KB

Unpacked Size

0

Dependencies

GitHub stars

2+2 since Sep 13

Show data
GitHub stars by day (UTC)
DateStars
Dec 5, 20262
Dec 4, 20262
Dec 3, 20262
Dec 2, 20262
Dec 1, 20262
Nov 30, 20262
Nov 29, 20262
Nov 28, 20262
Nov 27, 20262
Nov 26, 20262
Nov 25, 20262
Nov 24, 20262
Nov 23, 20262
Nov 22, 20262
Nov 21, 20262
Nov 20, 20262
Nov 19, 20262
Nov 18, 20262
Nov 17, 20262
Nov 16, 20262
Nov 15, 20262
Nov 14, 20262
Nov 13, 20262
Nov 12, 20262
Nov 11, 20262
Nov 10, 20262
Nov 9, 20262
Nov 8, 20262
Nov 7, 20262
Nov 6, 20262
Nov 5, 20262
Nov 4, 20262
Nov 3, 20262
Nov 2, 20262
Nov 1, 20262
Oct 31, 20262
Oct 30, 20262
Oct 29, 20262
Oct 28, 20262
Oct 27, 20262
Oct 26, 20262
Oct 25, 20262
Oct 24, 20262
Oct 23, 20262
Oct 22, 20262
Oct 21, 20262
Oct 20, 20262
Oct 19, 20262
Oct 18, 20262
Oct 17, 20262
Oct 16, 20262
Oct 15, 20262
Oct 14, 20262
Oct 13, 20262
Oct 12, 20262
Oct 11, 20262
Oct 10, 20262
Oct 9, 20262
Oct 8, 20262
Oct 7, 20262
Oct 6, 20262
Oct 5, 20262
Oct 4, 20262
Oct 3, 20262
Oct 2, 20262
Oct 1, 20262
Sep 30, 20262
Sep 29, 20262
Sep 28, 20262
Sep 27, 20262
Sep 26, 20262
Sep 25, 20262
Sep 24, 20262
Sep 23, 20262
Sep 22, 20262
Sep 21, 20262
Sep 20, 20262
Sep 19, 20262
Sep 18, 20261
Sep 17, 20261
Sep 16, 20261
Sep 15, 20260
Sep 14, 20260
Sep 13, 20260
npm weekly downloads

7−135 since Sep 17

Show data
npm weekly downloads by day (UTC)
DateWeekly downloads
Dec 5, 20267
Dec 4, 20268
Dec 3, 20266
Dec 2, 20264
Dec 1, 20267
Nov 30, 202610
Nov 29, 202610
Nov 28, 20268
Nov 27, 202611
Nov 26, 202611
Nov 25, 202613
Nov 24, 202610
Nov 23, 20267
Nov 22, 20269
Nov 21, 20269
Nov 20, 20268
Nov 19, 202610
Nov 18, 202610
Nov 17, 202610
Nov 16, 202618
Nov 15, 202616
Nov 14, 202616
Nov 13, 202617
Nov 12, 202615
Nov 11, 202613
Nov 10, 202615
Nov 9, 20268
Nov 8, 20267
Nov 7, 20267
Nov 6, 20265
Nov 5, 20267
Nov 4, 20267
Nov 3, 20265
Nov 2, 20266
Nov 1, 20268
Oct 31, 20269
Oct 30, 20269
Oct 29, 20267
Oct 28, 20267
Oct 27, 20269
Oct 26, 202610
Oct 25, 20268
Oct 24, 20267
Oct 23, 20265
Oct 22, 202615
Oct 21, 202616
Oct 20, 202614
Oct 19, 202615
Oct 18, 202617
Oct 17, 202618
Oct 16, 202619
Oct 15, 202612
Oct 14, 202612
Oct 13, 202612
Oct 12, 20269
Oct 11, 20268
Oct 10, 20267
Oct 9, 20267
Oct 8, 20267
Oct 7, 20266
Oct 6, 20267
Oct 5, 20267
Oct 4, 20268
Oct 3, 20269
Oct 2, 20268
Oct 1, 20265
Sep 30, 20266
Sep 29, 20267
Sep 28, 20267
Sep 27, 20267
Sep 26, 202618
Sep 25, 202624
Sep 24, 202637
Sep 23, 2026178
Sep 22, 2026176
Sep 21, 2026175
Sep 20, 2026173
Sep 19, 2026161
Sep 18, 2026155
Sep 17, 2026142

Each point is npm's rolling 7-day download count.

Health Score

59/100Good

Composite score based on GitHub activity, stars, npm downloads, publish recency, dependency count, and package size.

Badge for your README

Payload Directory health badge
Markdown
[![Payload Directory](https://payloaddirectory.dev/badge/1369615995-root.svg)](https://payloaddirectory.dev/plugins/1369615995-root)
HTML
<a href="https://payloaddirectory.dev/plugins/1369615995-root"><img src="https://payloaddirectory.dev/badge/1369615995-root.svg" alt="Payload Directory"></a>
Updated Nov 2, 2026Created Sep 14, 2026Published Sep 14, 2026

README

@wellmade-online/payload-ecommerce-tpay

npm license node

Tpay payment adapter for @payloadcms/plugin-ecommerce. Gives a Payload CMS 3 shop the payment methods Polish customers actually use: BLIK, online bank transfers (pay-by-link) and cards, through a single Tpay account.

Written for the plugin's official PaymentAdapter contract, so it plugs in exactly where the built-in Stripe adapter would.

Dokumentacja po polsku: README.pl.md.

Requirements

  • Payload CMS 3.83 or newer with @payloadcms/plugin-ecommerce
  • Node 20.9 or newer
  • A Tpay merchant account (sandbox account: register.sandbox.tpay.com)

Developed and tested against Payload and @payloadcms/plugin-ecommerce 3.88.0. The plugin pins payload to an exact version in its own peer dependencies, so the two always move together; this package accepts the 3.x line and does not claim compatibility with 4.x.

Install

npm install @wellmade-online/payload-ecommerce-tpay

Configure

Server side, in your Payload config:

import { ecommercePlugin } from '@payloadcms/plugin-ecommerce'
import { tpayAdapter, PLN } from '@wellmade-online/payload-ecommerce-tpay'

export default buildConfig({
  plugins: [
    ecommercePlugin({
      currencies: {
        defaultCurrency: 'PLN',
        supportedCurrencies: [PLN],
      },
      payments: {
        paymentMethods: [
          tpayAdapter({
            // every value below falls back to an environment variable
            clientId: process.env.TPAY_CLIENT_ID,
            clientSecret: process.env.TPAY_CLIENT_SECRET,
            merchantId: process.env.TPAY_MERCHANT_ID,
            securityCode: process.env.TPAY_SECURITY_CODE,
            sandbox: process.env.TPAY_SANDBOX === 'true',
            payerSuccessUrl: 'https://your-shop.example/order/confirmation',
            payerErrorUrl: 'https://your-shop.example/order/failed',
          }),
        ],
      },
    }),
  ],
})

Leave the plugin's access configuration alone unless you know what each function guards. The development host in dev/ sets isDocumentOwner: () => true and publicAccess: () => true so that scripts can drive it without logging in. Copied into a shop, that configuration lets any signed in customer create an order with a plain POST /api/orders, without paying anything: the plugin gives orders and transactions create: isAdmin, and the host's isAdmin is "any logged in user". Nothing in this adapter can defend a shop whose own collections accept orders from anyone. Keep the plugin defaults, or write access functions that check a role.

Client side, wherever you configure the storefront:

import { tpayAdapterClient } from '@wellmade-online/payload-ecommerce-tpay'

const paymentMethods = [tpayAdapterClient({ label: 'BLIK, transfer, card' })]

Adapter options

Every option is optional; the credentials fall back to environment variables, and the adapter throws at startup if clientId or clientSecret ends up empty.

OptionTypeDefaultWhat it does
clientIdstringTPAY_CLIENT_IDOAuth client ID from the Tpay panel (Integration > API).
clientSecretstringTPAY_CLIENT_SECRETOAuth secret.
merchantIdnumber | stringTPAY_MERCHANT_IDMerchant number from the panel. Goes into the notification checksum.
securityCodestringTPAY_SECURITY_CODENotification security code. Without it notifications are refused, never waved through.
sandboxbooleanTPAY_SANDBOX === 'true'Routes every call to the sandbox API.
notificationUrlstringderived from NEXT_PUBLIC_SERVER_URL or PAYLOAD_PUBLIC_SERVER_URLAbsolute public URL Tpay sends the result to.
payerSuccessUrlstringnoneWhere Tpay returns the payer after a successful payment. Set it - see the note below.
payerErrorUrlstringnoneWhere Tpay returns the payer after a failed payment.
verifyJwsbooleantrueVerifies the X-JWS-Signature header over the whole notification body. false disables the layer explicitly.
jwsRootCertificatestring (PEM)noneTpay root certificate, so the certificate chain is checked too, not only the signature.
timeoutMsnumber15000Ceiling on a single request to the Tpay API. 0 turns it off.
cartsSlugstring'carts'Slug of the carts collection. Set it if you renamed the collection - the plugin passes its own slug to confirmOrder but not to initiatePayment.
langstring'pl'Language of the Tpay payment page.
labelstring'Tpay'Readable name of the payment method.
groupOverridesobjectnoneOverrides for the field group the adapter contributes to transactions.

payerSuccessUrl and payerErrorUrl are worth setting deliberately. The adapter sends the return URLs to Tpay only when you provide them. Leave them out and Tpay returns the payer wherever the merchant panel points, which is outside your shop, so confirm-order is never called - and that endpoint is where the plugin decrements stock. A shop missing these two settings takes payments and never adjusts inventory.

Schema change

The adapter contributes a tpay field group to the plugin's transactions collection: transactionId, title, paymentUrl, shippingAddress and stockClaimedAt. Adding the adapter therefore changes your database schema - run your usual Payload migration step (payload migrate:create then payload migrate, or a dev push) after installing it.

tpay.stockClaimedAt is the one to know about: it is how the adapter hands the plugin's stock decrement trigger to at most one confirm-order call per transaction. It is also the field to query when reconciling inventory, because a succeeded transaction that has an order but no stockClaimedAt is one whose stock nobody adjusted. See Known limitations.

Environment variables

VariableMeaning
TPAY_CLIENT_IDOAuth client ID, Tpay panel: Integration > API
TPAY_CLIENT_SECRETOAuth client secret
TPAY_MERCHANT_IDNumeric merchant ID, part of the notification checksum
TPAY_SECURITY_CODENotification security code, Tpay panel: Notifications > Security
TPAY_SANDBOXtrue routes every call to the sandbox API
NEXT_PUBLIC_SERVER_URLUsed to derive the notification URL when you do not set one

Timeouts

Every call to the Tpay API carries a deadline of 15 seconds, and the certificate fetch behind JWS verification carries a shorter one of 5 seconds, because that request runs while a notification is waiting for its answer. A provider that accepts a connection and then goes quiet would otherwise hold a checkout request, or a BLIK status poll, open for as long as your host allows. Change the API ceiling with timeoutMs on the adapter; timeoutMs: 0 turns it off and leaves only your host's own limits.

Notification URL

The adapter mounts an endpoint at:

POST /api/payments/tpay/notifications

Set that full public URL as the notification address, either per transaction (the adapter sends it with every transaction it creates) or in the Tpay panel. It has to be reachable from the public internet, so a tunnel is needed while developing locally.

How a payment runs

  1. The storefront calls POST /api/payments/tpay/initiate. The adapter writes a pending transaction, creates the matching transaction in Tpay and returns paymentUrl.
  2. The storefront redirects the customer to paymentUrl.
  3. Tpay charges the customer and sends a server to server notification to the endpoint above. The adapter verifies it and creates the order.
  4. The customer comes back to payerSuccessUrl, and the storefront calls POST /api/payments/tpay/confirm-order with the transactionID returned in step 1 and the cartID (plus the cart secret for a guest cart). The plugin's handler rejects the request with Cart ID is required. before the adapter is ever reached, and the adapter then checks that same secret (or the logged in owner) against the transaction being confirmed, so send all of them.

Steps 3 and 4 both finish the order, whichever arrives first, and neither creates a second one. That matters because a redirect payment has no guarantee the browser ever comes back: the customer can pay with BLIK and close the tab.

Both paths are exercised against a real Payload instance with the plugin installed, using a real sandbox notification signed by Tpay, in dev/. Confirming an already confirmed transaction twice answers Order already confirmed and leaves exactly one order, which is measured rather than asserted.

BLIK in your own checkout (BLIK level 0)

The flow above sends the customer to Tpay to pick a method. BLIK level 0 keeps them where they already are: they type the six digit code from their banking app into your checkout, and nothing redirects anywhere. The adapter registers two endpoints for it.

EndpointBodyAnswers
POST /api/payments/tpay/bliktransactionID, blikToken, and secret for a guest cartthe code has been sent
POST /api/payments/tpay/blik-statustransactionID, and secret for a guest cartpending, rejected, paid or failed

A logged in customer who owns the transaction may omit secret. Anything else is answered with HTTP 403, and so is an unknown transactionID, so the endpoints do not tell an attacker which identifiers exist.

  1. Call initiate exactly as before. Keep transactionID; ignore paymentUrl, nobody opens it.
  2. Show a six digit field. The adapter strips spaces and dashes, and rejects anything that is not six digits before contacting Tpay, because a BLIK code is single use and lives about two minutes.
  3. POST /blik with the code, then poll /blik-status every second or two until it stops answering pending.

Three things here are measured against a live sandbox rather than assumed, and each of them will bite an integration that guesses instead:

  • Tpay answers success to a code that cannot possibly be valid. The literal code abcdef came back as result: success with the payment pending. The response to /blik therefore means "your request arrived", never "the customer paid". This adapter never reports a payment on the strength of it.
  • A rejected code does not change the transaction status. It stays pending, and the only trace of the refusal is paymentErrorCode on the last entry of payments.attempts. Measured with code 000000, which produced error 63 while the transaction still read pending. /blik-status reads that entry and answers rejected, so your checkout can ask for another code instead of leaving the buyer watching a spinner forever. The payment stays open and the next code goes to the same transaction, with no second order and no second transaction.
  • These endpoints deliberately bypass the plugin's confirm-order. That handler is written for a buyer coming back once, not for a loop: it decrements inventory whenever the adapter's answer carries transactionID, and BLIK level 0 requires polling until the code is accepted or refused. The claim described under Known limitations would hold the decrement to one, but a status poll has no business deciding stock at all. /blik-status finishes the order through the same idempotent path the server to server notification uses. The flip side is in Known limitations: a checkout that only ever uses BLIK never triggers the plugin's decrement, so it has to adjust stock itself.

The whole path runs against a real Payload instance with the plugin installed in dev/, including the refusal: a good code moves the payment to paid with one order, a refused code answers rejected and leaves the payment open, and a second code sent to that same payment completes it.

What the adapter refuses to accept

A notification endpoint is a public URL, so everything about it assumes someone will try to fake a payment.

  • Checksum. Every notification carries an md5 computed from the merchant ID, transaction ID, amount, tr_crc and your security code. A notification without a matching checksum is answered with HTTP 400 and no order is created. Missing configuration is a refusal too, never a silent pass.
  • What the checksum does not cover. Those five inputs are the whole recipe, so tr_status, tr_paid, tr_currency, tr_email and test_mode sit outside it: change any of them and the same md5 still matches. Two of those, tr_status and tr_paid, are exactly the fields this adapter reads to decide that an order is paid. The checksum therefore authenticates which transaction a message is about, not what it says happened to it. Measured against a real sandbox notification and pinned in test/notification-shape.test.js.
  • JWS signature. Second layer, on by default, and the only one that covers the whole body including the fields above. A notification without a valid X-JWS-Signature header is answered with HTTP 400. The certificate is fetched only from the Tpay host for the current environment, so a forged x5u pointing anywhere else is rejected before any outbound request is made. Pass jwsRootCertificate to also verify the chain against Tpay's root. verifyJws: false switches the layer off, which leaves a paid order one leaked notification body away from anyone who can reach the endpoint; do that knowingly.
  • test_mode is not an environment marker. A sandbox notification arrives with test_mode=0. Do not branch on it to tell test traffic from real traffic; use your own configuration.
  • Underpayment. With a plain bank transfer the payer types the amount themselves. If less arrives than the order is worth, the order is not created and the transaction stays pending with an error in the log. A transaction whose own amount cannot be read as a positive number is refused in the same way: a comparison that cannot be made must not report that nothing is owing.
  • Payment state comes from the Tpay API, never from the browser. The return URL is client side and anyone can open it by hand, so confirm-order asks Tpay what actually happened.
  • The proof of payment has to be about this transaction. confirm-order and /blik-status ask Tpay about the transaction ID stored on the document, never about one supplied in the request, and a correct answer only counts if Tpay reports the same amount and currency as the document. Without that, a buyer could pay for a cheap transaction and present that payment as proof for an expensive one. A mismatch is refused, and so is an API answer with no amount at all: a change in the API's shape stops sales loudly instead of waving everything through.
  • Nobody confirms a transaction they cannot prove is theirs. Transaction IDs are sequential integers, and Payload's local API bypasses collection access, so confirm-order applies the same gate as the BLIK endpoints: the request has to come from the logged in owner of the transaction or carry the cart secret. That gate sits in front of the "already confirmed" answer too, so an order's accessToken is never handed to a stranger who guessed the ID. An identifier that matches nothing is refused with the same message and the same HTTP 403 as one that belongs to somebody else, so the endpoint cannot be walked to learn which transactions exist; the same holds when the cart the transaction points at has been deleted - a caller who cannot prove the payment is theirs gets the refusal, not a 500.
  • The address on the transaction wins. The customer email recorded at initiate is what the order is created with. An email in a later request only fills the gap when the transaction has none, so knowing someone's transaction ID does not let you become the owner of their order.
  • A cart is paid for once. initiatePayment refuses a cart whose purchasedAt is set, because the goods behind it are already sold and a second payment would be taken for the same order. The flag is read from the database rather than from the cart object handed in: the plugin's endpoint loads the cart without purchasedAt, so a check against what it passes would never fire. If you renamed the carts collection, give the adapter its slug as cartsSlug - the plugin passes its own slug to confirmOrder but not to initiatePayment. A cart that cannot be read at all leaves a warning in the log and does not block the checkout; that is not evidence of a second payment.
  • Errors leave the details in the log. Anything that is not a deliberate answer (403, 409) comes back from the BLIK endpoints as a fixed message; the text of the underlying exception, including Tpay API paths and status codes, is written to the Payload logger only.

Amounts

Payload stores money in minor units (integer grosze), Tpay expects decimals. On the way out, and for every value that arrives as a string - a notification body, tr_paid, tr_amount - the conversion is digit shuffling only: strings padded and sliced, nothing divided or multiplied, because a one grosz drift changes the checksum and the payment is rejected with no readable reason.

The REST API is the exception, and it is worth knowing about. GET /transactions/{id} returns amount as a JSON number, so by the time the value reaches this package it is already a float; apiAmountToMinor scales it with Math.round(value * 10 ** decimals). That is rounding rather than exact arithmetic, and for two decimal places it is exact for every amount a shop can realistically charge - the error of the product stays far below the half unit that would round to the wrong integer. test/amount.test.js pins the values instead of asking you to take that on trust.

import { minorToDecimalString, decimalStringToMinor } from '@wellmade-online/payload-ecommerce-tpay'

minorToDecimalString(1999) // '19.99'
decimalStringToMinor('19.99') // 1999

Two decimal currencies only. Every conversion here assumes a minor unit of two decimal places, which is the ISO 4217 default and holds for everything Tpay settles (PLN, EUR, USD, GBP). A currency with a different exponent - JPY has none, KWD has three - is refused by initiatePayment with a loud error rather than converted by the wrong power of ten, and the same table guards the checks on the way back, so such a currency cannot pass the amount gate by both ends making the same mistake. Take it out of the plugin's supportedCurrencies.

Known limitations

  • Inventory is decremented by the plugin's confirm-order endpoint, and only when the buyer comes back. The plugin's handler decrements stock whenever the adapter's answer carries a transactionID, and it has no idempotency gate of its own: measured against plugin-ecommerce 3.88.0 on a live instance, two identical confirm-order calls for one already confirmed transaction took stock from 5 to 4 to 3. The adapter now hands that trigger out at most once per transaction. The claim is a conditional write of tpay.stockClaimedAt on the transaction document, so only the call that wins it gets transactionID back; a reloaded return page, a second browser tab or a hand written curl all get the same answer with no trigger in it, and stock stays put. Which path closed the order makes no difference: the buyer's first confirm-order, a repeated one, and a notification that finished the order before the browser returned all go through the same claim.

  • The flip side of that is deliberate: a payment finished only by the notification adjusts no stock. If the customer pays and never returns to the shop, nothing calls confirm-order, so the plugin's decrement never runs. The adapter does not decrement on the notification path either, because then a buyer who did come back would take a second unit off the shelf. Reconciling that case is on the shop, and tpay.stockClaimedAt is the field to look at: a succeeded transaction with an order and no stockClaimedAt is one whose stock nobody adjusted.

  • A BLIK checkout adjusts no stock at all unless you do it. The two limitations above are about confirm-order running too often; this one is the opposite. BLIK level 0 never returns the browser anywhere, so a checkout built on /blik and /blik-status alone never calls confirm-order and therefore never reaches the plugin's decrement. Measured on a live instance: a completed BLIK payment created the order and left stock at 5. Adjust inventory yourself once, when /blik-status first answers paid.

  • Record "stock already adjusted" on the order, not in memory. The demo shop keeps that marker in a process level set, which is fine for a demo and wrong for a shop: a restart forgets it, and the next paid answer decrements the same transaction again. Persist it on the order document.

  • A chargeback changes the transaction, not the order. A CHARGEBACK notification sets the transaction to refunded and leaves the order in processing. A shop that watches orders alone will not see that the money went back; watch the transaction status, or add a hook that mirrors it.

  • Finishing an order is not an atomic compare and swap. payload.update with a where clause is a find followed by a per-document write, so there is a narrow window in which the notification and the browser both believe they finished the order. The result is an orphaned order document, never a double charge, since there is only ever one payment. Closing the window would mean bypassing collection hooks, which is the worse trade. The race is decided by whoever attaches an order first, not by the transaction status: a transaction that already has an order gets that same order back, and a transaction with no order gets one on a verified paid notification even when its status has already moved somewhere else, because a settled refusal followed by a late transfer must not cost the buyer their order.

  • The demo shop adjusts stock from the cart, the order is built from the transaction. Its /shop/decrement-stock route reads cart.items, while the order created here comes from transaction.items - the snapshot taken when the payment started. The two lists are the same in the demo and can differ in a shop, because a cart stays editable after initiate (another tab, a slow buyer). Adjust stock from the transaction's items, the list the order is actually made of.

  • The guest cart secret is issued once, by the plugin, when the cart is created. There is no rotation and this adapter does not add one: anyone holding a copy can prove that cart until it is purchased, which is exactly why it must not travel in a URL, a log line or an analytics event. Keep it where the cart lives and send it only in the request body.

  • Recurring payments, card tokenisation, marketplace transactions and refunds through the API are not implemented.

Development

npm install
npm test     # builds, then runs the suite

The suite runs offline against fixtures and a Payload stub: no Tpay account is needed. Certificates for the signature tests are generated at test time with openssl, so no private key is checked in.

Running the demo shop

dev/ holds a real Payload instance with @payloadcms/plugin-ecommerce and this adapter installed, plus a click-through demo shop: a catalogue, a cart, and a checkout with a six digit BLIK field next to a "pay on the Tpay page" button. A side panel shows what each step actually wrote to the database. It is how the behaviour described in this README was measured, and the quickest way to see the adapter work before wiring it into your own shop.

npm install && npm run build          # the host imports the built ../dist
cd dev
pnpm install
export TPAY_CLIENT_ID=... TPAY_CLIENT_SECRET=... TPAY_MERCHANT_ID=... TPAY_SECURITY_CODE=...
export NEXT_PUBLIC_SERVER_URL=https://<public tunnel to 127.0.0.1:8099>
node --import tsx shop.mts            # then open http://127.0.0.1:8099/

Sandbox credentials are enough; the host sets sandbox: true itself. The BLIK path needs no tunnel, because it reads the payment state by asking Tpay rather than waiting for a notification; the redirect path does, since Tpay delivers the result as a server to server request that never reaches a local address. dev/README.md covers the tunnel, the scripted runs for an accepted and a refused BLIK code, and an instrument check to run before you trust a silent notification endpoint.

The access configuration in dev/payload.config.ts is deliberately wide open so scripts can drive the instance without logging in. Do not copy it into a shop; the Configure section above says why.

Made by Wellmade

Built and maintained by Wellmade, a studio building Payload and headless commerce shops. It came out of running a Payload shop in production that needed the Polish payment methods Stripe does not cover.

Gaps are listed under Known limitations above; issues and pull requests are welcome, and paid work on this package is possible.

License

MIT - see LICENSE. Copyright (c) 2026 Wellmade.

Similar plugins