# ShopCMS

### Инструкция по настройке и установке модуля.

1\. Скачайте [архив](https://github.com/unitpay/shopcms-module/archive/master.zip) модуля.

2\. Скопируйте содержимое директории "unitpay" из архива в корень вашего сайта.

3\. Перейдите в "Модули" -> "Модули оплаты" и нажмите "Инсталлировать".

4\. Нажмите "Редактировать" напротив установленного модуля "Unitpay".

5\. Введите DOMAIN - unitpay.ru, PUBLIC KEY и SECRET KEY, которые вы можете взять из личного кабинета Unitpay.ru.

![](/files/-MOb9Gd5yuUeTUmMzicq)

6\. Выберите статусы, в которые будет устанавливаться заказ после успешной оплаты либо ошибки.

7\. Сохраните изменения.

8\. Перейдите в "Настройки"->"Варианты оплаты" и добавьте новый вариант оплаты "Unitpay".

9\. В файл core/includes/helper.php добавьте следующий код:

```
// Helper for Unitpay
// Result Url - index.php?unitpay=yes
if(isset($_GET["unitpay"])){
    $data = $_GET;
    $params = $data['params'];
    $orderID = (int)$params['account'];
    $q = db_query( "select paymethod  from ".ORDERS_TABLE." where orderID=".$orderID);
    $order = db_fetch_row($q);
    if ( $order )
    {
        $paymentMethod = payGetPaymentMethodById( $order["paymethod"] );
        $currentPaymentModule = modGetModuleObj( $paymentMethod["module_id"], PAYMENT_MODULE );
        if ( $currentPaymentModule != null ) $result = $currentPaymentModule->after_payment_php( $_GET );
    }else{
        header('Content-Type: application/json');
        $result = array('error' =>
            array('message' => 'Order not present')
        );
        $result = json_encode($result);
        die($result);
    }
}

<br>
```

10\. Очистите кеш, для этого удалите содержимое папки cache.

11\. В личном кабинете Unitpay.ru введите адрес обработчика платежей  http\://<адрес вашего сайта>/index.php?unitpay=yes

12\. НДС задается внутри настроек модуля Модули - > Модули оплаты -> Unitpay\
Отдельно для товаров и отдельно для доставки, возможные варианты: vat0, vat10, vat20, none


---

# 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/modules/cms-modules/shopcms.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.
