# Magento 2

### Instructions for configuring and installing the module. <a href="#instrukciya-po-nastroike-i-ustanovke-modulya" id="instrukciya-po-nastroike-i-ustanovke-modulya"></a>

1.Download the [module archive](https://github.com/unitpay/magento2/archive/main.zip) and upload it to the site root.<br>

2\. In the shell from the site root to run the command php bin/magento setup:upgrade to install module<br>

3\. php bin/magento setup:di:compile for compiling configuration files<br>

4\. Go to the admin panel. Stores -> Configuration

<div align="left"><img src="/files/-MNxOI9jiZuBD2fxW-5n" alt=""></div>

5\. In the left menu, select Sales -> Payment Methods

<div align="left"><img src="/files/-MNxOXwjbMdjFoDzH8RO" alt=""></div>

6\. Find the unitpay module and set the settings Domain (**unitpay.ru**), Public Key, Secret Key (you can take it in the project settings in your personal account Unitpay)

<div align="left"><img src="/files/-MNxOelndkA2xsfqEQgo" alt=""></div>

7\. VAT can be set for each product. Catalogs -> Products, click on the product, choose it Tax Class

![](/files/-MNxST4vb0VpxFEsc76e)

Tax Class is configured in Stores -> Tax Rules

![](/files/-MNxSYF2CUryqr7Tk0wd)

Coverage area in Stores -> Tax Zones and Rates

![](/files/-MNxSe4gepfuRM4kKQfz)

8\. By default, delivery is valid for each product (3 products = triple the cost of delivery). To configure this, go to Stores -> Configuration.Then in the sales drop down list Sales we look for Shipping methods

![](/files/-MNxSOlEewBSrMHlgiqZ)

9\. Enter in your personal account Unitpay.ru in the project settings the payment handler. according to the template: http\://\<your\_site\_name>/unitpay/payment/callback

![](/files/Wnw0ttXsNeywkpolFQ7c)

10\. Promotional codes are also available. To set them up, go to the Marketing - Promotion - Cart Price Rules - Add new rule.

![](/files/-MflWR4yIMa6pBMo--oW)

1\) Rule name - **it's not the name of the promocode**;\
2\) Websites - using zone (can be set for certain sections of the site);\
3\) Customer groups - user groups for which this promo code is opened;\
4\) Coupon - choose Specific coupon;\
5\) Uses per Customer - the maximum number of promocode's uses for one authorized customer;\
6\) Uses per Coupon - the total maximum number of this promocode's uses;

Then open the Actions tab and set the actions for the promocode:

![](/files/-MflZgLHMK9KM5A4q5_Q)

Promocodes' options:

1. **Discount for the whole cart in %**

   Apply - Percent of product price discount, Discount Amount - discount amount,%
2. **Discount for the whole cart for a certain amount**

   Apply - Fixed amount discount for whole cart, Discount Amount - discount amount
3. **Discount for each item from the cart for a certain amount**

   Apply - Fixed amount discount, Discount Amount - discount amount

   Note: the discount on the item must be less than the cost of the product from the catalog, otherwise the promocode will work with an error - you cannot provide products with a zero amount.
4. Also, for each promo code, you can specify **free shipping**

   Free shipping - Select - For matching items only


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://help.unitpay.ru/en/modules/cms-modules/magento-2.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
