Developer notes
Technical reference for developers who customize Barion Payments.
Add-on identity
Section titled “Add-on identity”| Item | Value |
|---|---|
| Add-on id | kv_barion_payments |
| Function prefix | fn_kv_barion_payments_ |
| Language variables | kv_barion_payments.* |
| CSS scope | .kv-barion-payments |
| PHP namespace | Tygh\Addons\KvBarionPayments |
| Preset | payment (generated by kv new --kind integration) |
Structure
Section titled “Structure”| Class | Role |
|---|---|
Client\BaseClient |
HTTP (cURL, TLS verification, timeouts), JSON, error mapping, masked logging |
Client\Api |
The Barion calls: POST /v2/Payment/Start, GET /v4/payment/<id>/paymentstate, POST /v2/Payment/Refund; POS key in the x-pos-key header and, on POST, POSKey in the body |
PaymentService |
Start payload (items always add up to the order total, one balancing line), state read-back under a per-payment lock, refunds under a per-payment lock with a stored row and an Idempotency-Key |
Amount |
Amounts as Barion takes them (HUF has 0 decimals), on top of the ISO table in Money |
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 |
Reads the PaymentId of a Barion callback (query, form or JSON); the controller kv_barion_payments.webhook?c=<account> queues a read-back job for a payment it knows |
Database tables
Section titled “Database tables”| Table | Purpose |
|---|---|
?:kv_barion_payments_accounts |
Credentials per company (secrets sealed), last connection check, token cache |
?:kv_barion_payments_log |
Log |
?:kv_barion_payments_jobs |
Queue |
?:kv_barion_payments_transactions, ?:kv_barion_payments_refunds |
Payments and refunds |
Hooks used
Section titled “Hooks used”PHP: change_order_status_post (refund at a chosen order status), prepare_checkout_payment_methods (hides the method while the add-on cannot start payments), init_templater_post (upgrade synchronizer). Admin template hooks: orders:tabs_extra (payment tab), addons:* (license and connection blocks).
Where the docs are silent
Section titled “Where the docs are silent”The request and response shapes come from docs.barion.com (see notes/API-NOTES.md). Not documented there, so not relied on: the sign and the RelatedId of refund transactions in the payment state (the add-on sums absolute values of Succeeded refund transactions and flags what it cannot match), a payment lookup by PaymentRequestId (a start that times out leaves an unreachable Prepared payment that expires with its window), and the format of the id in the callback (query, form and JSON are all read). The sandbox could not be reached without a merchant test account: the tests run against a mock built from the doc pages.
Test the HTTP layer without the provider
Section titled “Test the HTTP layer without the provider”The base URL can be overridden for tests in config.local.php (development only):
$config['kv_barion_payments_base_url'] = 'http://127.0.0.1:11871';node tests/mock-server/server.js 11871 starts a local stand-in of the Barion API; node tests/e2e/e2e.mjs --root <store dir> --mock http://127.0.0.1:11871 runs the HTTP end-to-end test against it and refuses a store whose config.local.php does not point at that mock; php tests/unit.php runs the unit tests.
Template overrides
Section titled “Template overrides”Admin templates live in design/backend/templates/addons/kv_barion_payments/. Do not edit them in a store; they are replaced on update.