
- MODX 3
- PHP 8.2
- miniShop3


Quick start — install, keys, webhook.
This page lines up the YooKassa API quick start with what msp3YooKassa does in code for MiniShop3.
| Quick start step | In msp3YooKassa |
|---|---|
POST /v3/payments with amount, capture, confirmation.type = redirect, return_url | YooKassaPayment::send() → SDK createPayment(), return_url from getReturnUrl() (success_url / fail_url or MS3 thanks page) |
| Idempotence-Key | Order UUID or generated key |
Redirect buyer to confirmation_url | Payment handler response with redirect / payment_link for the MS3 frontend |
Wait for succeeded / handle cancel | Primarily webhooks → webhook.php → WebhookHandler |
User confirmation for redirect is described under Payment process. One- vs two-stage maps to API capture: true in YooKassaPayment, false in YooKassaTwoStagePayment.
In the YooKassa dashboard, configure the notification URL for your site:
https://your-domain.com/assets/components/msp3yookassa/webhook.phpUse a test shop and test keys (test_… secret key) in msp3yookassa_shop_id and msp3yookassa_secret_key. Pay with test cards only — never real cards in test mode. That restriction comes from YooKassa.
For production, switch to live Shop ID and secret key from the Quick start guidance.
Enable msp3yookassa_payment_receipt and set msp3yookassa_vat_code. A receipt object is added to createPayment (order lines, delivery if delivery_cost > 0, customer email). See Receipt basics.
In the test shop you can use receipt verification mode in the dashboard: YooKassa simulates OFD interaction without a real fiscal receipt — useful to validate payload shape (see Testing).
The code sets tax_system_code to 1. To override, use a plugin on the receipt-line MODX event mspYooKassaOnPreparePaymentReceiptItem (defined in the extra) or extend ReceiptBuilder.
Cards, SBP, wallets, etc. are chosen on YooKassa’s side after redirect to confirmation_url. The extra does not embed the widget or a custom card form — it uses redirect, as in the Quick start example.
YooKassaPayment::send() creates a payment (capture: true), stores yookassa_payment_id in order properties, returns a redirect URL for the frontend.assets/components/msp3yookassa/webhook.php.WebhookHandler resolves the order via metadata.order_id / order_num, verifies order_hash, and on succeeded sets status_id to ms3_status_paid.success_url or the MiniShop3 thanks page.The webhook is the source of truth for payment success, not the browser redirect alone.
https://<domain>/assets/components/msp3yookassa/webhook.phpevent, object with status, id, metadata).succeeded — order set to ms3_status_paid, yookassa_payment_id updated in properties.canceled — order set to ms3_status_canceled.msp3yookassa_debug is on. They do not change the order.order_hash in metadata is compared with getOrderHash() from the active YooKassa payment handler. Follow YooKassa webhook documentation for optional signature verification. Extend webhook.php if you enable it.
YooKassa payment (two-stage) (YooKassaTwoStagePayment) uses capture: false: funds are held until capture or cancellation.
waiting_for_capture. The current webhook handler does not change the MODX order status for those — the order stays as-is until succeeded or canceled.ms3_status_paid.canceled — order gets ms3_status_canceled.Plan your workflow (e.g. confirm in the MODX manager or your own tool before running Capture).
Class: Msp3YooKassa\Processors\CaptureProcessor. File: core/components/msp3yookassa/processors/capture.class.php.
Requirements:
Msp3YooKassa\Payment\YooKassaTwoStagePayment.properties contain yookassa_payment_id.msp3yookassa_shop_id and msp3yookassa_secret_key are configured.Parameter: order_id — numeric MiniShop3 order ID.
Example PHP call:
$corePath = $modx->getOption('msp3yookassa_core_path', null, MODX_CORE_PATH . 'components/msp3yookassa/');
$response = $modx->runProcessor('capture', [
'order_id' => 123,
], [
'processors_path' => $corePath . 'processors/',
]);
if ($response->isError()) {
$modx->log(modX::LOG_LEVEL_ERROR, $response->getMessage());
} else {
// Capture succeeded. Order moved to ms3_status_paid
}Error strings come from the msp3yookassa lexicon (invalid order, wrong payment type, missing payment id, etc.).
Before each order product line is added to the receipt, a MODX system event named mspYooKassaOnPreparePaymentReceiptItem (as shipped in the extra) is fired.
Payload: order, orderProduct, item (YooKassa line array, mutable by reference). Use it to adjust descriptions, VAT, payment_subject / payment_mode.
createPayment: order UUID or generated unique value.vendor/autoload.php must be present in the component for the YooKassa SDK.