Skip to content

Developer notes

Technical reference for developers who customize Montonio Pay by Bank and Cards.

Item Value
Add-on id kv_montonio_payments
Function prefix fn_kv_montonio_payments_
Language variables kv_montonio_payments.*
CSS scope .kv-montonio-payments
PHP namespace Tygh\Addons\KvMontonioPayments
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 Montonio Stargate calls: paymentMethods(), createOrder(), getOrder(), createRefund(), and sign() (HS256 JWT with accessKey, iat, exp)
Jwt HS256 encode / verify (refuses alg other than HS256, checks exp), uuidFromSeed() for refund idempotency keys
PaymentService initialize() (POST /orders), sync() (GET /orders/:uuid read-back, amount check, refunds list), refund() (idempotent, reconciles after a timeout), chargeCurrency()
Banks Bank list of GET /stores/payment-methods for the checkout picker (cached for one hour)
Transition Montonio paymentStatus to local status to order status; never moves an order backwards
Webhook parse() verifies orderToken / refundToken (HS256, our Secret key, our Access key); slim() keeps only the ids and statuses for the queue
Transactions, Money Payment attempts and refunds; ISO 4217 minor units
Client, Accounts, Secret Client per company, connection test; credentials (test and live) sealed with AES-256-GCM
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()
Log Event log with masking (keys, bearer tokens, JWTs), filters, CSV, retention
Retention Keeps payment records on uninstall unless the purge setting is on

Everything below is from the official Montonio documentation (read 2026-11-25); the full notes with claims and fields are in notes/API-NOTES.md of the source repository.

Call Doc
Authentication: JWT HS256, claims accessKey, iat, exp; GET = Authorization: Bearer <jwt>, POST = {"data": "<jwt>"} https://docs.montonio.com/api/stargate/reference (Authentication)
Base URLs: https://stargate.montonio.com/api (live), https://sandbox-stargate.montonio.com/api (test) https://docs.montonio.com/api/stargate/overview
GET /stores/payment-methods: enabled methods, bank list (code, name, logoUrl, uiPosition, supportedCurrencies) https://docs.montonio.com/api/stargate/guides/payment-methods
POST /orders: claims merchantReference, returnUrl, notificationUrl, grandTotal, currency, locale, payment {amount, currency, method, methodOptions}, billingAddress, shippingAddress, exp; answer uuid, paymentUrl https://docs.montonio.com/api/stargate/guides/orders
GET /orders/:orderUuid: paymentStatus, grandTotal, currency, availableForRefund, isRefundableType, refunds[] https://docs.montonio.com/api/stargate/reference
POST /refunds: claims orderUuid, amount, idempotencyKey, exp; minimum 0.05, duplicate key = 400 https://docs.montonio.com/api/stargate/guides/refunds
Webhook: {"orderToken": jwt} or {"refundToken": jwt} signed with the Secret key; answer 200/201; retried 13 times over 48 hours; dedupe by order / refund UUID https://docs.montonio.com/api/stargate/guides/webhooks
Order statuses (PENDING, AUTHORIZED, PAID, VOIDED, PARTIALLY_REFUNDED, REFUNDED, ABANDONED) and refund statuses (PENDING, PROCESSING, SUCCESSFUL, REJECTED, CANCELED) https://docs.montonio.com/api/stargate/overview

Choices made where the documentation is silent: the phone of the address is not sent (the format of phoneCountry is not documented); lineItems are not sent (optional); merchantReference is the order number, with -2, -3 for further payment attempts of the same order.

Sandbox access needs a Montonio Partner System account, so the tests of this version ran against a mock built from these pages (tests/mock-server/server.js). A check against the real Sandbox is still pending.

Table Purpose
?:kv_montonio_payments_accounts Credentials per company (secrets sealed), last connection check, token cache
?:kv_montonio_payments_log Log
?:kv_montonio_payments_jobs Queue
?:kv_montonio_payments_transactions, ?:kv_montonio_payments_refunds Payments and refunds
Hook Use
change_order_status_post Queues a full refund when the order reaches the “Refund in full when the order status becomes” status
prepare_checkout_payment_methods Hides the Montonio methods while the add-on is disabled, unlicensed or not connected
init_templater_post Upgrade Synchronizer (only while an upgrade is pending)
Template hook index:styles (storefront) Loads styles.less of the bank picker

Payment processor script payments/kv_montonio_payments.php (start, return, cancel); processor template addons/kv_montonio_payments/views/orders/components/payments/montonio.tpl renders the bank picker and posts payment_info[kv_montonio_bank]. The picker is rendered inside the checkout payment step, which the full page cache never serves from the cache.

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

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

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_montonio_payments/. Do not edit them in a store; they are replaced on update.