Skip to content

Developer notes

Technical reference for developers who customize Yoco Payments.

Item Value
Add-on id kv_yoco_payments
Function prefix fn_kv_yoco_payments_
Language variables kv_yoco_payments.*
CSS scope .kv-yoco-payments
PHP namespace Tygh\Addons\KvYocoPayments
Preset payment (generated by kv new --kind integration)
Class Role
Client\BaseClient HTTP (cURL, TLS verification, timeouts), JSON, error mapping, masked logging
Client\Api The Yoco Checkout API: create / get / expire / refund checkout, list / register / delete webhook (bearer secret key, Idempotency-Key on POST)
PaymentService Start (create checkout), read-back sync, cancel, refunds, refund notifications; one GET_LOCK per payment shared by all of them
Transition, Transactions, Money Status mapping, payment and refund rows, minor units
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 Signature check (webhook-id . webhook-timestamp . body, HMAC-SHA256 with the base64 decoded secret, three minute window), event reduction without card data; the controller `kv_yoco_payments.webhook?c=&m=<test
Table Purpose
?:kv_yoco_payments_accounts Credentials per company (secrets sealed), last connection check, token cache
?:kv_yoco_payments_log Log
?:kv_yoco_payments_jobs Queue
?:kv_yoco_payments_transactions, ?:kv_yoco_payments_refunds Payments and refunds

PHP: change_order_status_post (refund at a chosen order status), prepare_checkout_payment_methods (hides the method when the add-on or ZAR is not available), init_templater_post (upgrade synchronizer). Template hooks: orders:tabs_extra (payment tab), the add-on page hooks of the license card. Every Yoco call and field is listed with its documentation page in notes/API-NOTES.md.

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

$config['kv_yoco_payments_base_url'] = 'http://127.0.0.1:11860/api';

node tests/mock-server/server.js 11860 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_yoco_payments/. Do not edit them in a store; they are replaced on update.