WHMCS module
Install the VaultPanel provisioning module for WHMCS to create, suspend, upgrade and remove hosting accounts, with single sign-on and disk usage.
The VaultPanel module for WHMCS sells VaultPanel hosting from WHMCS. Each WHMCS service is one VaultPanel hosting account: WHMCS creates it when an order is paid, suspends and unsuspends it with the invoices, changes its plan on upgrades, sets its password, removes it on termination, signs the customer in with Log in to VaultPanel, and shows its disk usage.
The module works through the billing API. It is MIT licensed.
Requirements
- WHMCS 8, on PHP 7.4 or newer with the curl extension.
- A VaultPanel address with a certificate WHMCS trusts. Set a panel domain under System > Panel Domain (for example
cp.example.com); the self-signed certificate of the panel's own port is refused. See Panel HTTPS and domain. - At least one hosting plan, created under Hosting > Hosting Plans.
Install
Download the module
Download vaultpanel-whmcs.zip and check it against the published SHA256SUMS:
curl -sSO https://installer.vaultpanel.net/downloads/vaultpanel-whmcs.zip
curl -sSO https://installer.vaultpanel.net/downloads/SHA256SUMS
sha256sum -c --ignore-missing SHA256SUMSUnzip it and copy its modules/servers/vaultpanel folder into your WHMCS folder, so the module is at modules/servers/vaultpanel/vaultpanel.php inside WHMCS.
Create a billing API key
In VaultPanel, open Hosting > Billing API, click New API key, name it WHMCS and copy the key. It starts with vpk_ and is shown once.
Add the server in WHMCS
In WHMCS, open System Settings > Servers > Add New Server:
| Field | Value |
|---|---|
| Hostname | The panel domain, such as cp.example.com. |
| Module | VaultPanel |
| Password (or Access Hash) | The vpk_ API key. |
| Secure | Ticked. Leave the port empty for 443. |
Click Test Connection, which lists the panel's plans with the key. Save, and put the server in a server group.
Create a product
Open System Settings > Products/Services and create a product of type Hosting Account. On Module Settings:
| Setting | Value |
|---|---|
| Module Name | VaultPanel, with the server group from the previous step. |
| Plan | The VaultPanel hosting plan of this product. The list comes from your panel. |
| Server ID | Optional: the id of the VaultPanel server new accounts go on. Empty lets VaultPanel choose (the plan's server group, then the least busy server). |
Choose Automatically setup the product as soon as the first payment is received.
What it does
| WHMCS | VaultPanel |
|---|---|
| Create | A hosting account on the product's plan with billing id whmcs-<service id>, named after the client, with the client's email. The service password is used when it has at least 12 characters; otherwise the customer signs in from WHMCS, or sets one with VaultPanel's invite. The service's username becomes the email the customer signs in with. Running Create again for the same service is safe. |
| Suspend / Unsuspend | Turns the account's websites off, stops its apps and pauses its cron jobs, with the suspension reason; and back on. |
| Terminate | Removes the account and everything it owns: websites, apps, databases and their files and backups. Running it again finishes what was left. |
| Change Package | Moves the account to the new product's plan. Nothing is deleted when it is over the smaller plan's limits; new resources are refused. |
| Change Password | Sets the VaultPanel password (at least 12 characters) and signs the customer out elsewhere. |
| Log in to VaultPanel | A sign-in link that works once, for two minutes. It skips the customer's two-factor code, like the password the billing system can set. Suspended accounts get none. |
| Usage update (WHMCS cron) | Disk usage and limit in MB for every service on the server (0 means no limit). VaultPanel does not count bandwidth. |
| Client area | Status, plan, server, usage against the plan's limits, and the sign-in button. |
| Admin service tab | The VaultPanel account id (linking to it in VaultPanel), status, plan, server and usage. |
Every call is recorded in VaultPanel's audit log as the API key, and in WHMCS's module log (System Logs > Module Log) with the key and passwords hidden.
Limits
- VaultPanel has one hosting account per email address, so a client can have one VaultPanel service. A second service for the same client fails with that reason.
- No domain is set up on order: the customer adds websites in VaultPanel.
- Moving a service to another server in WHMCS does not move the account between VaultPanel servers.
- If a service's VaultPanel account was removed, Create does not bring it back: create a new service for a new account.
Troubleshooting
| Message | Fix |
|---|---|
| Paste a VaultPanel billing API key (it starts with vpk_) into this server's Password or Access Hash. | The server's Password or Access Hash does not hold a vpk_ key. Create one under Hosting > Billing API. |
| VaultPanel offers no hosting plans yet. | Create a plan under Hosting > Hosting Plans, and make sure Offered for new accounts is on. |
| Choose the VaultPanel plan in the product's Module Settings first. | Pick a Plan on the product's Module Settings tab. |
| VaultPanel already has an account for … (the client's email) | The client already has a VaultPanel service, or a staff user or another customer signs in with that email. |
| Certificate or connection errors on Test Connection | WHMCS must reach the panel over HTTPS with a trusted certificate: use the panel domain, not the IP address and port 8090. |