Top
Provisioning Module Overview
Provisioning Modules, also referred to as Product or Server Module, allow for the provisioning and management of products & services. The core functionality of this module is for creating reseller/customer account in Backup Server when new order is being accepted. After creating a reseller/customer, you can manage them by either activate/de-activate it from WHMCS interface.
Top
Setting up product with WHMCS
As a first step of integrating Module with WHMCS, you need to create a Product in WHMCS as below.
Top
Log into WHMCS with admin account.
Click on 'Setup' menu and goto 'Products/Services' page.
In Product/Services page, click 'Create a New Group' link. 
Enter Product Group Name and create a group. 
Top
After creating a new group, click 'Create a New Product' link which is available in the Product/Services page.

Enter Product Name and click 'Continue' button to configure Module. 
How to configure ModuleTop
Take a copy of productName.php file which is available in the below location in your backup server installation to temporary location.
<_Installation_Location>/htmlgui/whmcs/integration/ - Windows
<_Installation_Location>/sgchroot/htmlgui/whmcs/integration/ - Linux
Edit copied productName.php file & search entire file for 'productName' text and replace all existing text with text and save the changes.
Rename the productName.php into .php. [Note: Please make sure in step2 & step3, whether all letters of are lowercase and no spaces in them.]
Create a new folder in the name of under the location <WHMCS_Installation_Path>/modules/servers/ folder in the WHMCS server machine. Now, copy the .php file into folder which is just created above. Note: Folder name should be in lowercase.
Now come back to your WHMCS interface and edit your product and navigate to 'Module Settings' tab.
Map Module from the 'Module Name' drop down list.
On select your module, you will be promted to enter Module configurations.
Provide all required fields and select 'Automatically setup the product when you manually accept a pending order' option and Save the changes.

Module Fields Description
Protocal - This can be either http or https [Secured port].
HostName or IpAddress - HostName or IP Address of your Backup Server.
WebConsole Port - WebConsole Port. By default it is 6060[http] or 6061[https].
UserName - WebConsole admin level UserName.
Password - WebConsole admin level Password.
Action - This can be either 'Signup Reseller' or 'Signup Customer'. Either you can add your client as Reseller/Customer.
Reseller Name - New Customers will be created under this Reseller account in Backup Server. [Not Applicable for Signup Reseller action].
Activation Status - Enable to add Reseller/Customer with activate state.
Auto Authorization Status - Enable this option to automatically add clients when they connect to the server.
Storage Allotted - Allotted Space in Bytes.
Storage Location - This is your backup storage location. If this field is empty then will automatically assign the backup storage location.
Enable Consolidated Report - Enable Consolidated Report for Customers. [Not Applicable for Signup Reseller action].
Consolidated Report Email - Consolidated Report Recipient(s) Email Address. You can provide multiple addresses with comma separator. [Not Applicable for Signup Reseller action].
Is Auto MCAL - If Enabled, MCAL allocation will be Auto.
Allot MCAL - If you want to restrict MCAL utilization, uncheck 'Is Auto MCAL' checkbox and give MCAL value.
Bandwidth Throttling - You can either choose 'Global Configuration' or 'New Configuration'.
If 'Global Configuration' is selected, then for 'Signup Reseller' action bandwidth throttling for the reseller will be set as per the backup server's configuration and for the 'Signup Customer' action bandwidth throttling for the customer will be set as per its reseller configuration. If 'New Configuration' is selected, then you can setup bandwidth throttling specific to this reseller/customer.
Enable Throttle for new configuration - Enable/Disable throttle for reseller/customer.
Throttle Settings - You can choose either 'Always Throttle' or 'Throttle only at specified time' option if Throttle is enabled.
Throttle From - Required if Throttle only at speficied time is selected [Values should be in the hundred time hours format 0130(ie 1.30 am) , 1740(ie 5.40 pm)]
Throttle Till - Required if Throttle only at speficied time is selected [Values should be in the hundred time hours format 0130(ie 1.30 am) , 1740(ie 5.40 pm)]
Restricted Rate - It should greater than 1024 bytes and less than 9999 GB. Enter the values in Bytes. [Required if Throttle for new configuration is enabled]
Send Mail - Enable to send an account creation email from .
Retrieve Customer Pass Key - Enable this option to retrieve customer pass key from and to store it into WHMCS client account. [Applicable only for Signup Customer action]
In order to store the Customer Passkey in WHMCS, you need to create a custom client field with Field Name 'Pass Key' as shown in the screen shot below. To create a custom field, navigate to 'Setup->Custom Client Fields' page.

Top
Accepting Order in WHMCS
Now access your pending WHMCS client Orders from 'List of All Orders' page and click 'Accept Order' button as shown in the below screen shot where 'Run Module Create' option will be enabled by default. If 'Run Module Create' option is enabled then WHMCS will call Backup Server to setup a new Reseller or Customer account as mentioned in the Module Setting page.

Note: If the order is successfully accepted then corresponding reseller/customer account gets created in backup server. Afterwards, you can suspend/unsuspend those reseller/customer account from WHMCS. To use this functionalities, go to clients profile and click on 'Products/Services' tab where you can run the module commands say suspend, unsuspend, terminate. Here, suspend and terminate will de-activate the account in where as unsuspend will activate the account.
Top
How to use retrieved Customer Passkey in Welcome Email
If you would like to include the 'Customer Passkey' in your welcome Email which will be sent to your clients whenever the client order for product has been accepted, edit the welcome email template and add the below line.
Your Customer PassKey : {$client_custom_fields.0}
where $client_custom_fields.0 will replace with customer pass key value. If you have multiple custom fields for your clients in WHMCS then you need to provide the corresponding field id.
Top
Action Hook Overview
Action hook allows you to add new reseller/customer in Backup Server when specific actions occur in WHMCS. For example, this can be used for things like performing actions like when an order is placed, adding a new client and many more.
Top
Steps to Integrate with WHMCS
Step 1: Goto to below location in your backup server installation,
Example: <_Installation_Location>/htmlgui/whmcs/integration/ - Windows
<_Installation_Location>/sgchroot/htmlgui/whmcs/integration/ - Linux
Step 2: Copy the whmcsHooks.php and paste into the <WHMCS_installation_location>/includes/hooks/ folder in the WHMCS server machine.
Step 3: Edit the above file and provide your backup server authentication details to allow WHMCS hooks to invoke the API. You need to edit the below PHP variables and provide your backup server web console login details.
protocal - https or http
serverName - DomainName or IP Address of the Backup Server
port - Web Console Port Number, by default it is 6060 (http) or 6061(https)
userName - Web Console UserName
loginPassword - Web Console Password
Step 4: Next, you need to decide which function has to call when specific actions occur in WHMCS. This customization can be done in the same file where you can comment/uncomment any of the below lines to activate/deactivate the respective functions.
add_hook("ClientAdd",0,"SGSignupReseller","");
#add_hook("ClientAdd",0,"SGSignupCustomer","");
#add_hook("AcceptOrder",0,"SGSignupReseller","");
#add_hook("AcceptOrder",0,"SGSignupCustomer","");
In the above example, 'SGSignupReseller' function will be called to create a new reseller account in Backup Server when a new client is added in WHMCS.
-
Step 5: Add a new client by providing the required details.


Client has been added as reseller in Backup Server.

Top
Troubleshooting Tips
Provising Module
For any failure case, error message will shown in client order manage page itself.
Action Hook
If the client failed to add in Backup Server refer log file whmcs_error.log which will be created in '<whmcs_installation_location>/admin' location.
Top
Limitations
|