Skip to content

Developer notes

Technical reference for developers who customize PayPo Buy Now Pay Later for CS-Cart and Multi-Vendor.

Item Value
Add-on id kv_paypo
Function prefix fn_kv_paypo_
Language variables kv_paypo.*
CSS scope .kv-paypo
PHP namespace Tygh\Addons\KvPaypo
Preset payment (generated by kv new --kind integration)
Class Role
Client\BaseClient HTTP (cURL, TLS verification, timeouts), JSON, OAuth2 client-credentials with an encrypted token cache, error mapping, masked logging
Client\Api PayPo API v3.1: createTransaction, getTransaction, setStatus (COMPLETED / CANCELED), refund, token via /oauth/tokens
Registration Pure builder of the registration body (address split into street / building / flat, NN-NNN zip, +48 phone, UUIDs)
PaymentService Registration, read-back sync, confirm, cancel, refunds with resume, order status; serialised per payment with named locks
Transition Pure status logic: PayPo status -> local status -> order status, never backwards
Client Client per company, the connection test
Accounts, Secret Credentials (test and live) sealed with AES-256-GCM; one account per store owner or per vendor
Config, Access Settings, owner mode, who may see and manage what
Queue, Jobs, JobException Job queue: back-off 5 min / 15 min / 1 h / 3 h / 12 h, per-job isolation, overlap lock; handlers in Jobs::handle(), recurring work in Jobs::schedule()
Log Event log with masking, filters, CSV, retention
Webhook X-PayPo-Signature check (base64 or hex HMAC-SHA256 of POST+<path>+<json>), event ids; the controller kv_paypo.webhook?c=<account> stores the event as a job
Table Purpose
?:kv_paypo_accounts Credentials per company (secrets sealed), last connection check, token cache
?:kv_paypo_log Log
?:kv_paypo_jobs Queue
?:kv_paypo_transactions, ?:kv_paypo_refunds Payments and refunds

PHP: change_order_status_post (confirm, cancel and refund at an order status), prepare_checkout_payment_methods (hides the method without PLN, outside the limits, when switched off or not connected), init_templater_post (only while an upgrade synchronization is pending). Template: orders:tabs_extra (post, the PayPo tab), addons:manage and addons:tabs_content (licence card), index:styles (admin CSS).

The add-on implements PayPo API v.3.1, document version 3.1.2 of 2026-07-08:

  • https://static.paypo.ro/assets/documents/api-30/PayPo_API_3_1_EN.pdf (the PDF covers the PayPo Poland and Romania hosts; this add-on uses the Polish ones)
  • Production base URL https://api.paypo.pl/v3/, sandbox https://api.sandbox.paypo.pl/v3/ (section 2)
  • OAuth2 client credentials, POST /oauth/tokens, JWT valid 30 minutes (section 9.1); notifications signed per section 9.2
  • POST /transactions (3.1), response {transactionId, redirectUrl} (3.2), return ?status=OK|ERR (3.3)
  • Statuses NEW, PENDING, ACCEPTED, COMPLETED, REJECTED, CANCELED (4); notifications (5); confirmation (6); GET /transactions/{id} (7); cancellation PATCH {status: CANCELED} (8.1); POST /transactions/{id}/refunds (8.2); HTTP statuses and error bodies (10)

No sandbox credentials were available. Every request is checked by tests/mock-server/server.js against the field table of section 3.1 and the other sections, and the mock’s responses are the document’s examples (tests/fixtures/). Verified against the official API reference; run in the PayPo sandbox before going live.

Open points (what the document leaves unclear)

Section titled “Open points (what the document leaves unclear)”
  1. The sample X-PayPo-Signature is 40 hex characters, section 9.2 prescribes base64 of HMAC-SHA256: the add-on accepts both encodings of HMAC-SHA256, over the raw and the re-encoded body, for the request path, the path with query, the script path and the registered notifyUrl path. If PayPo signs differently, use the setting “Reject notifications with a bad signature” = off: the notification then only triggers a read-back.
  2. order.amount is typed int in the table but the sample shows a string: an integer is sent.
  3. The document does not say that GET /transactions/{id} accepts our registration id or that the answer’s transactionId equals it. The add-on stores its own UUID before the call and uses PayPo’s transactionId once known; a lost registration answer is looked up by our UUID and, when found, cancelled (no redirect address can be recovered from a GET).
  4. The document does not say whether referenceRefundId deduplicates. After an unanswered refund the add-on reads the transaction (refund list of the extended answer, or the reduced amount) and only sends again when the refund is not there.
  5. The cancel answer is printed as “HTTP 201 OK” and the confirm answer as 200: any 2xx is accepted.
  6. The document lists no amount limits, no rate limits and no User-Agent rule. Limits are set per payment method by the merchant.
  7. The errors member of a 400 answer is printed as a list in curly braces; the add-on reads it as a list of {path, message} objects (and as an object of them).

The base URL can be overridden for tests in config.local.php (development only):

$config['kv_paypo_base_url'] = 'http://127.0.0.1:11830';

node tests/mock-server/server.js 11830 starts a local stand-in of the provider API; node tests/e2e/e2e.mjs runs the HTTP end-to-end test against it; php tests/unit.php runs the unit tests.

Admin templates live in design/backend/templates/addons/kv_paypo/. Do not edit them in a store; they are replaced on update.