Skip to content

Developer notes

Technical reference for developers who customize NETOPIA Payments.

Item Value
Add-on id kv_netopia_payments
Function prefix fn_kv_netopia_payments_
Language variables kv_netopia_payments.*
CSS scope .kv-netopia-payments
PHP namespace Tygh\Addons\KvNetopiaPayments
Preset payment (generated by kv new --kind integration)
Class Role
Client\BaseClient HTTP (cURL, TLS verification, timeouts), JSON, error mapping, masked logging (OAuth is not used: NETOPIA takes a static API key)
Client\Api The NETOPIA calls: payment/card/start, operation/status, operation/credit, healz
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 JWT (RS512) check of the IPN and event ids; the controller kv_netopia_payments.webhook?c=<account> stores the event as a job
PaymentService Start (hosted page), read-back, order status, refunds; request mapping (address, products, countryNumeric, charge)
Transition NETOPIA status number to local status to order status
Table Purpose
?:kv_netopia_payments_accounts Credentials per company (secrets sealed), last connection check, token cache
?:kv_netopia_payments_log Log
?:kv_netopia_payments_jobs Queue
?:kv_netopia_payments_transactions, ?:kv_netopia_payments_refunds Payments and refunds

PHP hooks: change_order_status_post (refund when an order reaches the chosen status), prepare_checkout_payment_methods (hides the method while unlicensed or not connected), init_templater_post (self-healing upgrade, only while an upgrade is pending). Template hooks: orders:tabs_extra (order tab), addons:manage and addons:tabs_content (licence cards), index:styles (admin CSS).

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

$config['kv_netopia_payments_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_netopia_payments/. Do not edit them in a store; they are replaced on update.

NETOPIA API reference (what is used and where it is documented)

Section titled “NETOPIA API reference (what is used and where it is documented)”

Every call below is taken from the NETOPIA OpenAPI specification (https://secure.sandbox.netopia-payments.com/spec, “OpenAPI”), the developer portal (https://doc.netopia-payments.com/docs/payment-api/v2.x/start/start-strc, “Starting a payment”, “Sample Response”, “Errors & Statuses”) and, where the portal is silent, the official PHP SDK and WooCommerce plugin of NETOPIA (https://github.com/netopiapayments/composer src/IPN.php, https://github.com/netopiapayments/WooCommerce v2/lib/*.php). The complete table with doc sections is in notes/API-NOTES.md.

Call Endpoint Source
Start (hosted page) POST {base}/payment/card/start, header Authorization: <API key>, body config / payment / order; the answer carries payment.ntpID and payment.paymentURL OpenAPI paths./payment/card/start, schema StartRequest, Payment.paymentURL; WooCommerce plugin lib/request.php (instrument type only, no card data)
Status read-back POST {base}/operation/status {posID, ntpID, orderID} OpenAPI paths./operation/status, schema ExpireRequest, StatusResponse; PHP SDK Status.php
Refund POST {base}/operation/credit {ntpID, amount} (decimal units) OpenAPI paths./operation/credit, schema OperationRequest
Health GET {base}/healz OpenAPI paths./healz
IPN (verified with the key of the Connection page, default: the public key of the official NETOPIA WooCommerce plugin, wc-netopiapayments-gateway.php line 801; the verified values are the fallback when the status call is unavailable) POST JSON to the notify URL; header Verification-token = JWT RS512 (iss “NETOPIA Payments”, aud = POS signature, sub = base64 SHA-512 of the body); answer JSON {errorType, errorCode, errorMessage} PHP SDK IPN.php; body: OpenAPI NotifyRequest

Known documentation gaps (stated here so nobody has to guess): the OpenAPI text marks operation/status and operation/credit as “will be available at a future date”; the answer of the hosted-page start is not shown in the portal (the add-on reads payment.ntpID and payment.paymentURL as the Payment schema defines them and refuses to continue without both); the public key for IPN signatures is not published on the portal pages we read (the official plugin ships one inside its source). Status codes: portal “Errors & Statuses” lists 3, 5, 12, 15; the others come from the SDK constant list.