### Complete Payment Widget Integration Example Source: https://docs.moneta.ru/assistant/v1/index.print.html This comprehensive example integrates the script, defines options, sets up callbacks for payment status, and renders the payment form. It demonstrates a full setup for accepting payments. ```html
``` ```javascript ``` ```javascript ``` -------------------------------- ### Example Step-Check Request URL Source: https://docs.moneta.ru/assistant/v1/step-checks/index.print.html This is an example of a GET request URL for a step-check. It includes standard parameters and a custom field. ```http checkUrl?MNT_COMMAND=STEP&MNT_ID=9003&MNT_AMOUNT=123.45&STEP=PRE&MNT_CURRENCY_CODE=RUB&MNT_TEST_MODE=0&MNT_SIGNATURE=bc2125c3cddfcf7380cc5f0f9c480927&CUSTOMFIELD%3A101=120000 ``` -------------------------------- ### Example Request and Response Source: https://docs.moneta.ru/assistant/v1/step-checks An example of a Step Checks request and its corresponding XML response. ```APIDOC ## Example Request ``` checkUrl?MNT_COMMAND=STEP&MNT_ID=9003&MNT_AMOUNT=123.45&STEP=PRE&MNT_CURRENCY_CODE=RUB&MNT_TEST_MODE=0&MNT_SIGNATURE=bc2125c3cddfcf7380cc5f0f9c480927&CUSTOMFIELD%3A101=120000 ``` ``` ```APIDOC ## Example Response ```xml 9003 206 123.45 bc1f70d760203ff5039896ded453449e 102Moscow ``` ``` -------------------------------- ### Example Check URL Request Source: https://docs.moneta.ru/assistant/v1/step-checks/index.html An example of a GET request to the 'Check URL' endpoint. It includes various parameters for a step-based data retrieval. ```url checkUrl?MNT_COMMAND=STEP&MNT_ID=9003&MNT_AMOUNT=123.45&STEP=PRE&MNT_CURRENCY_CODE=RUB&MNT_TEST_MODE=0&MNT_SIGNATURE=bc2125c3cddfcf7380cc5f0f9c480927&CUSTOMFIELD%3A101=120000 ``` -------------------------------- ### Example: Verification Request and Response Source: https://docs.moneta.ru/assistant/v1/index.print.html A practical example demonstrating a verification request and its corresponding XML response, including signature calculation. ```APIDOC ## Example: Verification Request and Response Verification request for order `FF790ABCD`, account `54600817`, amount 120.25, without operation number: ``` checkURL?MNT_COMMAND=CHECK&MNT_ID=54600817&MNT_TRANSACTION_ID=FF790ABCD&MNT_AMOUNT=120.25&MNT_CURRENCY_CODE=RUB&MNT_TEST_MODE=0&MNT_SIGNATURE=ea2d49048bdf11857f1b50270aedbc8d ``` String for MD5 (concatenated, without separators): ``` CHECK54600817FF790ABCD120.25RUB0QWERTY ``` where `QWERTY` is the data integrity check code. Example of merchant response: ```xml 54600817 FF790ABCD 402 Order created, but not paid 120.25 5ebb58862cf8781b62bcc2cc8d66913e nameJohn Smith emailJohn.Smith@gmail.com ``` String for response MD5 (concatenated): ``` 40254600817FF790ABCDQWERTY ``` The `name` and `email` fields from `MNT_ATTRIBUTES` are saved in the operation. ``` -------------------------------- ### Example Interaction Source: https://docs.moneta.ru/assistant/v1/check-requests/index.print.html Provides a concrete example of a check request and the corresponding XML response, including signature calculation for both. ```APIDOC ## Example Interaction ### Description This section illustrates a typical check request for an order and the expected XML response from the store, demonstrating the signature calculation process for both. ### Check Request Example Verifies an order with ID `FF790ABCD`, account `54600817`, amount 120.25, without an operation ID: ``` checkURL?MNT_COMMAND=CHECK&MNT_ID=54600817&MNT_TRANSACTION_ID=FF790ABCD&MNT_AMOUNT=120.25&MNT_CURRENCY_CODE=RUB&MNT_TEST_MODE=0&MNT_SIGNATURE=ea2d49048bdf11857f1b50270aedbc8d ``` String for MD5 (concatenated, without separators): ``` CHECK54600817FF790ABCD120.25RUB0QWERTY ``` where `QWERTY` is the data integrity check code. ### Response Example Example response from the store: ```xml 54600817 FF790ABCD 402 Order created, but not paid 120.25 5ebb58862cf8781b62bcc2cc8d66913e nameJohn Smith emailJohn.Smith@gmail.com ``` String for response MD5 (concatenated): ``` 40254600817FF790ABCDQWERTY ``` The `name` and `email` fields from `MNT_ATTRIBUTES` are saved with the operation. ``` -------------------------------- ### Example XML Response Source: https://docs.moneta.ru/assistant/v1/check-requests This is an example of a valid XML response from a merchant to Moneta.ru Assistant. It includes transaction details, result code, and a calculated MNT_SIGNATURE. ```xml 54600817 FF790ABCD 402 Order created, but not paid 120.25 5ebb58862cf8781b62bcc2cc8d66913e nameJohn Smith emailJohn.Smith@gmail.com ``` -------------------------------- ### Example Call to Set Widget Body Class Source: https://docs.moneta.ru/assistant/v1/index.print.html This is an example of how to call the `setBodyClass` function to apply a custom theme to the payment widget. ```javascript setBodyClass('custom-theme-dark'); ``` -------------------------------- ### Example Check Request URL Source: https://docs.moneta.ru/assistant/v1/check-requests/index.html An example of a check request URL with parameters for a specific transaction, including signature generation. ```url checkURL?MNT_COMMAND=CHECK&MNT_ID=54600817&MNT_TRANSACTION_ID=FF790ABCD&MNT_AMOUNT=120.25&MNT_CURRENCY_CODE=RUB&MNT_TEST_MODE=0&MNT_SIGNATURE=ea2d49048bdf11857f1b50270aedbc8d ``` -------------------------------- ### Example Verification Request URL Source: https://docs.moneta.ru/assistant/v1/index.print.html This is an example of a verification request URL for a specific transaction, including all necessary parameters and the calculated MNT_SIGNATURE. ```http checkURL?MNT_COMMAND=CHECK&MNT_ID=54600817&MNT_TRANSACTION_ID=FF790ABCD&MNT_AMOUNT=120.25&MNT_CURRENCY_CODE=RUB&MNT_TEST_MODE=0&MNT_SIGNATURE=ea2d49048bdf11857f1b50270aedbc8d ``` -------------------------------- ### Example Step-Check Response XML Source: https://docs.moneta.ru/assistant/v1/step-checks/index.print.html This is an example of a valid XML response from a provider after a step-check request. It includes transaction details, result code, and attributes for the next step. ```xml 9003 206 123.45 bc1f70d760203ff5039896ded453449e 102Moscow ``` -------------------------------- ### Example MD5 String for Response Source: https://docs.moneta.ru/assistant/v1/check-requests/index.html The string used to generate the MD5 signature for the example Moneta.ru response. This includes relevant response parameters concatenated. ```text 40254600817FF790ABCDQWERTY ``` -------------------------------- ### Example Call to Set Custom Theme Source: https://docs.moneta.ru/assistant/v1/customization/deep This example demonstrates how to call the `setBodyClass` function with a specific CSS class name to apply a custom dark theme to the payment widget. ```javascript setBodyClass('custom-theme-dark'); ``` -------------------------------- ### Signature String Example Source: https://docs.moneta.ru/assistant/v1/payment-request/index.print.html Example of the string used for MD5 signature calculation, concatenating payment details and a check code. For test mode, '1' is used instead of '0' before the check code. ```text 54600817FF790ABCD120.25RUB0QWERTY ``` -------------------------------- ### Example MD5 String for Check Request Source: https://docs.moneta.ru/assistant/v1/check-requests/index.html The string used to generate the MD5 signature for the example check request. This includes all relevant parameters concatenated. ```text CHECK54600817FF790ABCD120.25RUB0QWERTY ``` -------------------------------- ### Example Check URL Response Source: https://docs.moneta.ru/assistant/v1/step-checks/index.html An example of an XML response from a 'Check URL' request. It contains transaction details, a result code, and custom attributes. ```xml 9003 206 123.45 bc1f70d760203ff5039896ded453449e 102Moscow ``` -------------------------------- ### Example widgetSize message format Source: https://docs.moneta.ru/assistant/v1/customization/deep This is an example of the `widgetSize` message format sent from the payment form iframe to the parent window. It includes the message type and the current dimensions of the widget. ```json { "m_type": "widgetSize", "width": 300, "height": 64 } ``` -------------------------------- ### Example Check Request URL Source: https://docs.moneta.ru/assistant/v1/check-requests This is an example of a check request URL for a specific transaction. Note the inclusion of MNT_SIGNATURE, which is calculated based on the provided parameters. ```http checkURL?MNT_COMMAND=CHECK&MNT_ID=54600817&MNT_TRANSACTION_ID=FF790ABCD&MNT_AMOUNT=120.25&MNT_CURRENCY_CODE=RUB&MNT_TEST_MODE=0&MNT_SIGNATURE=ea2d49048bdf11857f1b50270aedbc8d ``` -------------------------------- ### Example Moneta.ru XML Response Source: https://docs.moneta.ru/assistant/v1/check-requests/index.html A sample XML response from Moneta.ru for a specific transaction, including transaction details, result code, and attributes. ```xml 54600817 FF790ABCD 402 Order created, but not paid 120.25 5ebb58862cf8781b62bcc2cc8d66913e nameJohn Smith emailJohn.Smith@gmail.com ``` -------------------------------- ### Example Merchant Response XML Source: https://docs.moneta.ru/assistant/v1/index.print.html This is an example of a complete XML response from a merchant for a payment transaction, including transaction details, result code, and optional attributes. ```xml 54600817 FF790ABCD 402 Order created, but not paid 120.25 5ebb58862cf8781b62bcc2cc8d66913e nameJohn Smith emailJohn.Smith@gmail.com ``` -------------------------------- ### Example Pay URL Request Source: https://docs.moneta.ru/assistant/v1/pay-notification This example shows a typical Pay URL request with payment notification parameters. The MNT_SIGNATURE is generated by concatenating all values and the data integrity check code. ```http payURL?MNT_ID=54600817&MNT_TRANSACTION_ID=FF790ABCD&MNT_OPERATION_ID=123456&MNT_AMOUNT=120.25&MNT_CURRENCY_CODE=RUB&MNT_TEST_MODE=0&MNT_SIGNATURE=69bdf9bd91820b8f7b4c4b25d3d22dfa ``` -------------------------------- ### Example of sending widgetSize message Source: https://docs.moneta.ru/assistant/v1/customization/deep This is an example of a `widgetSize` message that might be sent from the payment form iframe. It specifies the message type and the widget's width and height in pixels. ```json {"m_type":"widgetSize","width":360,"height":740} ``` -------------------------------- ### Signature String Example Source: https://docs.moneta.ru/assistant/v1/payment-request/index.html Illustrates the string concatenation used for generating the MNT_SIGNATURE. For test mode, '1' replaces '0' before the integrity check code. ```plaintext 54600817FF790ABCD120.25RUB0QWERTY ``` -------------------------------- ### Подключение скрипта MONETA.Assistant Source: https://docs.moneta.ru/assistant/v1/widget-settings/index.html Добавьте этот скрипт на страницу, где будет происходить оплата. Исходный код доступен на GitHub. ```html ``` -------------------------------- ### Отрисовка платёжной формы Source: https://docs.moneta.ru/assistant/v1/widget-settings/index.html Используйте `Assistant.Builder` для создания и отрисовки платёжной формы. Форма может быть встроена в указанный HTML-элемент или отображена в модальном окне. ```javascript let assistant = new Assistant.Builder(); assistant.build(options, 'payment-form'); ``` -------------------------------- ### Example Successful XML Response Source: https://docs.moneta.ru/assistant/v1/pay-notification This is an example of a successful XML response to a payment notification. The MNT_SIGNATURE is calculated from the result code, store ID, transaction ID, and the data integrity check code. ```xml 54600817 FF790ABCD 200 29807c8e5d82198b5c4360e6ec711cce ``` -------------------------------- ### Calculate MNT_SIGNATURE without Optional Fields Source: https://docs.moneta.ru/assistant/v1/index.print.html Example of MNT_SIGNATURE calculation when MNT_OPERATION_ID, MNT_AMOUNT, and MNT_SUBSCRIBER_ID are absent. These fields are omitted as empty strings. ```text MNT_SIGNATURE = MD5( MNT_COMMAND + MNT_ID + MNT_TRANSACTION_ID + MNT_CURRENCY_CODE + MNT_TEST_MODE + КОД_ПРОВЕРКИ_ЦЕЛОСТНОСТИ_ДАННЫХ) ``` -------------------------------- ### Step Checks Request Source: https://docs.moneta.ru/assistant/v1/step-checks MONETA.Assistant sends verification requests to the provider's 'Check URL' using GET or POST. The response must be in XML format. Multiple requests may be sent per order. ```APIDOC ## Request Parameters - **MNT_COMMAND** (string) - For data retrieval requests, this should be `STEP`. - **MNT_ID** (string) - Provider identifier in the MONETA.RU system. - **MNT_AMOUNT** (number) - Actual amount excluding MONETA.RU commission. Optional if not provided in the HTML form. - **MNT_CURRENCY_CODE** (string) - ISO currency code. Optional. - **MNT_TEST_MODE** (string) - `1` for test mode, `0` for real mode. Optional. - **MNT_SIGNATURE** (string) - Request signature. - **STEP** (string) - The name of the current parameter input step (e.g., `PRE`). - **CUSTOMFIELD:** (string) - Data passed in the request for additional data retrieval. Parameters starting with `CUSTOMFIELD:` are considered custom fields. ``` ```APIDOC ## Signature Generation (Request) ``` MNT_SIGNATURE = MD5( MNT_COMMAND + MNT_ID + MNT_AMOUNT + MNT_CURRENCY_CODE + MNT_TEST_MODE + INTEGRITY_CHECK_CODE) ``` - `MNT_AMOUNT` in the signature should have two decimal places. - If `MNT_AMOUNT` is absent in the request, it is skipped during signature calculation (empty string). - In test mode, `1` is used in the signature; otherwise, `0`. **Note:** If the amount is not in the request: ``` MNT_SIGNATURE = MD5( MNT_COMMAND + MNT_ID + MNT_CURRENCY_CODE + MNT_TEST_MODE + INTEGRITY_CHECK_CODE) ``` The provider must form a string with their data and request fields, calculate MD5, and compare it with the `MNT_SIGNATURE` in the request. ```