WHMCS module
Install the HF Panel module in WHMCS to create, suspend, upgrade and delete hosting accounts, with one-click sign-in for customers.
The HF Panel module for WHMCS manages HF Panel hosting accounts from your WHMCS installation. WHMCS creates the account when an order is accepted, suspends it when an invoice is overdue, moves it to another package on an upgrade and deletes it when the service is terminated. Customers open their Control Panel with one click from the WHMCS client area.
The module talks to the token API with an API token. It uses the same calls as the Billing integration page describes.
What you need
- WHMCS 8 with PHP 8.1 or newer and the PHP cURL extension
- HF Panel 1.0.0 or newer
- a Read & change API token from Server Admin, or from the Reseller Panel to sell as a reseller
1. Download and install the module
- Download WHMCS module from the Integrations part of the install page:
https://hostfog.io/download/#integrations. - Unzip it into your WHMCS folder. The files go to
modules/servers/hfpanel/.
The module needs no database changes and no other files.
2. Make an API token in HF Panel
- Sign in to Server Admin (or the Reseller Panel).
- Open your name at the top right › Password & security › API tokens.
- In Name, type
WHMCS, and choose Read & change. - In Allowed IPs, type your WHMCS server's IP address.
- Type your password and click Create token, then click Copy token. It is not shown again.
Important: treat the token like a password. A reseller's token manages only that reseller's customers and stays within the reseller's account limit and privileges.
3. Add the server in WHMCS
In WHMCS, open Configuration › System Settings › Servers and click Add New Server.
| WHMCS field | What to enter |
|---|---|
| Module | HF Panel |
| Hostname | api.yourdomain.com. On a server without the separate API address, type the panel's address, panel.yourdomain.com |
| Access Hash | the API token, hf_… |
| Port | tick Override with Custom Port and enter 2087, or 8443 for the panel's address |
| Secure | ticked. HF Panel answers only HTTPS, and the module checks the server's certificate |
Leave Username and Password empty. Click Test Connection. It succeeds when the token works and has Read & change access. Then click Save Changes.
The module picks the address from the host name: a name that starts with api. uses https://api.yourdomain.com:2087/v1,
any other name uses the old address https://panel.yourdomain.com:8443/api/v1.
4. Make a product
- Open Configuration › System Settings › Products/Services and create a product of the type Shared Hosting.
- On the Module Settings tab, choose HF Panel as the module and pick the server group.
- Choose the Package. The list comes from your HF Panel server, so make the packages first under Server Admin › Accounts › Packages.
- Tick Welcome email if HF Panel should also email the customer their sign-in details.
- Choose when WHMCS creates the account, for example Automatically setup the product as soon as the first payment is received, and click Save Changes.
Each product matches one HF Panel package. To sell an upgrade, make one product per package and allow upgrades between them.
5. Test it
- Place a test order for the product with a domain, as a customer or from Orders › Add New Order.
- Accept the order. On the service, the module's Create runs.
- Check that the account appears in Server Admin under Accounts.
- In the WHMCS client area, open the service and click Log in to Control Panel.
- Try Suspend, Unsuspend and Change Package on the service, then Terminate to clean up.
Every call is written to System Logs › Module Log when module logging is switched on. The token and passwords are masked.
What each action does
| WHMCS action | What happens in HF Panel | API call |
|---|---|---|
| Create | makes the hosting account with the product's package and the order's domain | POST /v1/accounts |
| Suspend | suspends the account: its websites, email and logins stop | POST /v1/accounts/{username}/suspend |
| Unsuspend | switches the account back on | POST /v1/accounts/{username}/unsuspend |
| Terminate | deletes the account with all its websites, email and databases | DELETE /v1/accounts/{username} |
| Change Package | moves the account to the package of the new product | POST /v1/accounts/{username}/package |
| Change Password | sets the service's password for the Control Panel and SFTP | POST /v1/accounts/{username}/password |
| Log in to Control Panel | opens the customer's Control Panel, signed in, with a one-time link that works for 2 minutes | POST /v1/accounts/{username}/login |
| Daily usage update | stores disk space used and allowed, and this month's bandwidth, on each active or suspended service | GET /v1/accounts/{username}/usage |
| Test Connection | checks the token and its access | GET /v1/me |
| Open HF Panel (server list) | opens the panel's sign-in page; you sign in with your own login | GET /v1 |
Username and password
- HF Panel usernames are 3–16 lower-case letters and numbers, starting with a letter. When the service has no username,
or one HF Panel would refuse, the module makes one from the domain (
example.combecomesexamplecom) and adds a number when it is taken. - A password must be 8–128 characters, without quotes (
'), backslashes or control characters. When the service's password does not fit, HF Panel makes a strong random one. - The module saves the username and password it used back to the service, so the client area and the welcome email show the right ones.
The client area and the admin area
- The client area shows the username, disk space and this month's bandwidth from the last usage update, with the buttons Log in to Control Panel and Email accounts.
- On the admin's service page, the module shows the account as HF Panel sees it: status, package, disk space, domains, server and last sign-in.
Troubleshooting
| Message | What to do |
|---|---|
Unknown or deleted token. |
Copy the token again into Access Hash. Make a new one if it was deleted. |
This token is read-only. Make a "Read & change" token. |
Make a Read & change token and use it instead. |
This token cannot be used from <address>. |
Add that address to the token's Allowed IPs. |
Too many failed attempts from this IP. Try again in 15 minutes. |
A wrong token was tried too often. Fix the token, then wait 15 minutes. |
HF Panel did not answer with JSON (HTTP 403). |
The host name or port is wrong: use api.yourdomain.com with port 2087, or the panel's address with port 8443. |
Could not reach HF Panel at … |
Check the host name, the port and that your WHMCS server may connect to it. A certificate error means the server's certificate is not valid yet. |
No such account. |
The service's username is not on the server, or belongs to a customer the token may not manage. |
No such package: … |
Pick the package again in the product's Module Settings. |
This needs another administrator's approval first. … |
Deleting accounts needs a second administrator. Delete the account in HF Panel, then mark the service terminated in WHMCS. |
This account is suspended. |
A suspended account cannot sign in. Unsuspend it first. |
The control panel licence needs attention: … |
Renew or fix the HF Panel licence. |
Tip: for any other message, open System Logs › Module Log. The answer from HF Panel shows the exact reason.