# ShopCMS

**The Module Setup and Installation Instruction**

1. Download the [archive](https://github.com/unitpay/shopcms-module/archive/master.zip) with the module.
2. Copy the contents of the Unitpay directory from the archive to the root of your site.
3. Go to Modules -> Payment modules and click Install.
4. Click Edit next to the installed Unitpay module.
5. Enter DOMAIN (unitpay.money), PUBLIC KEY, and SECRET KEY which you can get in your Unitpay.money personal account.
6. Select the statuses which will be assigned to the order in case of successful or failed payment.
7. Save your changes.
8. Go to Settings -> Payment options and add a new payment option - Unitpay.
9. Add the following code to core/includes/helper.php file:

```
// 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\. Clear your cache by deleting the contents of the cache folder.

11\. In your Unitpay.ru personal account, enter the address of the payment handler http\://\<your site address>/ndex.php?unitpay=yes

12\. VAT is set inside the module settings Modules - > Payment Modules -> Unitpay Separately for goods and separately for delivery, possible options: 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/en/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.
