============= cPanel plugin ============= The cPanel plugin adds support for creating and selling cPanel shared hosting products. .. contents:: :local: Creating cPanel servers ======================= To allow clients to order cPanel hosting products first we need to add one or more cPanel servers in Fleio: Go to **Servers -> Groups** and create a new server group if no group exists. .. image:: /_static/images/plugins/cpanel/createNewServerGroupButton.png :width: 40% .. image:: /_static/images/plugins/cpanel/createNewServerGroup.png :width: 40% This group will hold cPanel servers on which new shared hosting accounts will be created. Go to **Servers -> Server list** and create a new server. .. image:: /_static/images/plugins/cpanel/createServer.png Set a meaningful name for the server, select the group this server will belong to, set it's status to **Enabled** and set the server type to **cPanel server** Set the WHM URL, username, usually root and the access key. *Please make sure you enter the server access key and not the password.* Follow the `WHM API Authentication Guide `_ to generate a new API token Once the cPanel servers and groups are set, we can create our Fleio shared hosting products. Creating cPanel Fleio Products ============================== Add new cpanel product ---------------------- Go to the **Billing -> Products** page where we will create a new product group and a cPanel shared hosting product. .. image:: /_static/images/plugins/cpanel/createProductGroupButton.png :width: 20% .. image:: /_static/images/plugins/cpanel/createProductButton.png :width: 20% Creating a group requires a name and a description. Once created, click on the **Create product** button. Next go to the *Create product* page .. image:: /_static/images/plugins/cpanel/cPanelProdConf.png On the create product page: * give the new product a name * set an internal code to something meaningful like SH_Basic The internal code should be a simple and easy to remember code, like an alias for this product. * add a description * billing Type should remain to Prepaid * select the previously created group for this product * select the **cPanel Billing** as a *Module* * set the product status to **Private** (more on this below) * select Shared Hosting for **Product type** * the **Price model** for a cPanel shared hosting account should be set to **Fixed plus dynamic** * auto setup may be set to either **On first payment** if you wish for automatic creation of accounts on payment of **When pending order is accepted** if manual activation is desired * set the server group to the one that we previously configured * set the cPanel plan to the desired plan (note that you need to have this plan in WHM) If you wish to apply taxes to this product and you have *Billing Tax Rules* defined, check the **Apply taxes to this product**. Otherwise this option can be left unchecked. Once done, click on the **Create** button to create the new product. This product will not be available for order yet since it's status is set to **Private**. We did this in order to first create additional configurable options needed for a cPanel shared hosting account like pricing a domain name and if a dedicated IP is desired or not. Add billing cycles ------------------ Go to **Billing -> Products** and click on the name of the new cPanel product created. .. image:: /_static/images/plugins/cpanel/prodDetailsNoCycles.png When no billing cycle exists for a product, you can click on the *ADD BILLING CYCLE* button (middle button in the top right corner) to show the cycle creation dialog. .. image:: /_static/images/plugins/cpanel/cycleCreate.png On the new billing cycle dialog, let's create a *Monthly* billing cycle by selecting the following: * Cycle set to Month * Cycle multiplier set to 1 (one Month) * Currency to your desired currency for the price * Auto calculate prices is only available when more than one currency is set in Fleio and the default currency already has a price set in which case the price will be set based on the exchange rates. * Set the price in *Fixed price* and the *Setup fee* if desired * Check the *Setup fee entire quantity* to apply the setup fee only once when multiple products of the same type are selected and if setup fee has a price. * Set the status of this cycle to public to allow any client to order this product with this cycle Once created the cycle will appear on the product details page. You can create as many cycles as you wish, usually Monthly, Quarterly, Semi-annual and Yearly are popular choices. To create additional cycles, click on the upper right *Add cycle* icon. Note that if you wish to allow clients to order in multiple currencies, you need to create the cycles for each currency. If multiple cPanel products exists and you wish to allow clients to upgrade/downgrade to another product, you can access the *UPGRADES* tab and select the appropriate products. The *CONFIGURABLE OPTIONS* tab does not have any configurable options yet, however, we need to create at least one configurable option for the domain associated with the cPanel account. Add configurable options ------------------------ To create the domain and dedicated IP configurable options, go to *Billing -> Config. Options* and click on the **Create option** button. .. image:: /_static/images/plugins/cpanel/createConfigOption.png We'll first add the domain option by setting the *Display text* to **Domain name** and the internal name to **domain_name**. The cPanel module expects a **domain_name** option and as such the internal name is mandatory to be set to **domain_name**. Enter additional text as **Help text** and set the *Display widget* to *Text input* and the status to *Public*. Also check the *Required* checkbox as the domain name is required for a new cPanel account. Click on **SAVE AND CONTINUE** to save this option and to add new cycles to it. For a configurable option to appear when a product is ordered, billing cycles are required in this version of Fleio. The billing cycles should be set for all created currencies in Fleio and a price of 0 (zero). .. image:: /_static/images/plugins/cpanel/optionBillingCycle.png Add option billing cycles to match the billing cycles of the newly created product by going to the product details page. .. image:: /_static/images/plugins/cpanel/prodDetailsConfOpt.png Once added, the product status can be set to *Public* since we saved it previously as *Private* An additional configurable option with the code *dedicated_ip* and a widget of *Yes/No* can be associated with the product, to allow clients to request a dedicated IP address. The product is now ready to be ordered by clients. cPanel manage 2 licensing module ================================ Cpanel manage2 module adds support for creating and selling cPanel licenses. Before adding a new product in Fleio, we recommend you to go trough all cPanel manage2 faq, which is available here: https://docs.cpanel.net/manage2/admin/manage2-faq/ By doing this, you will also be able to gather all the information that you will need to configure in Fleio, in order to sell cpanel licenses. Add a new cPanel manage2 product -------------------------------- Go to the **Billing -> Products** page where we will create a new cPanel Manage2 product. .. image:: /_static/images/plugins/cpanel/createCpanelManage2Product.png On the create product page: * give the new product a name * set an internal code to something meaningful like SH_Basic The internal code should be a simple and easy to remember code, like an alias for this product. * add a description * billing Type should remain to Prepaid * select the previously created group for this product (cPanel) * select the **cPanel Manage2 module** as a *Module* * set the product status to **Public** * select Generic for **Product type** * the **Price model** for a cPanel license should be set to **Fixed plus dynamic** * auto setup may be set to either **On first payment** if you wish for automatic creation of accounts on payment of **When pending order is accepted** if manual activation is desired * set the cPanel package ID and cPanel group ID The cPanel package ID and cPanel group ID will be gathered from your manage2 account. If you wish to apply taxes to this product and you have *Billing Tax Rules* defined, check the **Apply taxes to this product**. Otherwise this option can be left unchecked. Once done, click on the **Create** button to create the new product. This product will not be available to order since it does not have any billing cycles. .. image:: /_static/images/plugins/cpanel/createCpanelManage2ProductNoCycles.png Add billing cycles ------------------ Depending on how you want to sell the licensing, you will have to setup the billing cycles. For example purposes, we have configured a monthly billing cycle. .. image:: /_static/images/plugins/cpanel/CpanelManage2ProductAddCycle.png Additional configurations and permissions ----------------------------------------- You will have to add the cPanel manage 2 credentials in the `settings.py` file, using the following variables: .. code-block:: bash CPANEL_USERNAME = "REPLACEME" CPANEL_PASSWORD = "REPLACEME" After editing the ``settings.py`` file, you must restart the ``fleio`` services. See :ref:`restart-fleio`. Lastly, you will have to authorize the fleio server public IP in manage2 interface, by following this guide: https://docs.cpanel.net/manage2/admin/manage2-faq/#how-do-i-add-an-access-ip-address-on-my-account The licence is now ready to be ordered by your clients.