What it does
The module talks to the PanelFi REST API (https://HOST:2087/api/v1) with an API token. It creates, suspends, unsuspends, terminates and changes accounts, syncs usage, and gives customers one-click sign-in. It has no dependencies other than the curl extension.
Install
- Copy the
modules/servers/panelfifolder to<whmcs>/modules/servers/panelfi. - In the server panel create an API token under Manage API Tokens (see API tokens and API shell). Use an administrator token, not a read-only one. A reseller's token can create hosting accounts for that reseller but cannot create resellers.
- In WHMCS go to System Settings > Products/Services > Servers and add a server: Module PanelFi; Hostname (or the IP field); Access Hash the API token (it can instead go in Password; the Access Hash is used first); Secure ticked for HTTPS; Port 2087; leave Username empty.
- Press Test Connection. WHMCS reports the PanelFi error if it fails.
- Create a server group if you want one, then create a product with module PanelFi and set the options below.
Product options
| Option | Meaning |
|---|---|
| Package name | Exact name of a PanelFi package. Hosting products need it. |
| Reseller product | Tick to create a reseller login instead of a hosting account. |
| Reseller: max accounts | Accounts the reseller may create. 0 or empty is unlimited. |
| Reseller: disk (MB) | Total disk the reseller may hand out in packages. 0 or empty is unlimited. |
| Reseller: bandwidth (MB) | Total monthly bandwidth the reseller may hand out. 0 or empty is unlimited. |
| Accept self-signed certificate | Skip certificate verification for this product's calls. |
Turn on "Automatically setup the product as soon as you receive payment" or the option you prefer; the module does not change how WHMCS triggers actions.
What each action does
| WHMCS action | PanelFi call |
|---|---|
| Create | POST /accounts with username, domain, password, email and package; the account's IP is saved as the service's dedicated IP. Reseller product: POST /resellers. |
| Suspend | POST /accounts/{user}/suspend (the reason is passed on). Reseller: POST /resellers/{name}/suspend, which also suspends the reseller's accounts. |
| Unsuspend | POST .../unsuspend. For a reseller, only the accounts the reseller's suspension suspended come back. |
| Terminate | DELETE /accounts/{user}. Reseller: DELETE /resellers/{name}?new_owner=<token owner>; the reseller's accounts are not deleted, they move to the owner of the API token. |
| Change Password | POST .../password |
| Change Package | POST /accounts/{user}/package. Reseller: POST /resellers/{name}/limits with the product's limits. |
| Usage update | GET /accounts?fields=usage |
| Log in to control panel | POST /accounts/{user}/login returns a one-time link, valid for 60 seconds. |
| Server sync / import | GET /accounts fills the WHMCS Import / Sync list. |
Every call is written to the WHMCS Module Log (System Logs, Module Log, with module logging on). The API token and passwords are masked. On failure the module returns the PanelFi error text, for example no package named Gold.
Reseller products
A reseller product creates a PanelFi reseller login with the limits you set; it does not create a hosting account. The reseller signs in at https://HOST:2087/ with the service username and password and creates their own customers and packages inside the limits. PanelFi has no one-time sign-in for resellers, so "Log in to the control panel" opens the sign-in page. Reseller accounts need a PanelFi edition that includes resellers; if the server refuses, the error says so.
Single sign-on and usage sync
- Customers: the client area shows Log in to control panel (one-time link) and Webmail (
https://HOST:2096/). Staff get the same link from the service page. - Staff: "Open the PanelFi server panel" opens the admin sign-in page; staff use their own administrator login.
- Usage: WHMCS runs
UsageUpdatefrom its daily cron. The module reads disk and bandwidth for all accounts in one call and updatesdiskusage,disklimit,bwusage,bwlimitandlastupdateintblhosting(MB). Disk includes databases; bandwidth is the current month; a limit of 0 is unlimited. Reseller services are skipped. - The service page in the WHMCS admin shows status (and suspend reason), package, IP, owner, disk and bandwidth against limits, and last login.
Self-signed certificates
Certificates are verified by default. If the panel uses a self-signed certificate, enter allow-self-signed in the Username field of the WHMCS server, or tick Accept self-signed certificate on the product. Prefer installing a real certificate (see Custom and hostname certificates). If Secure is unticked the token travels unencrypted, so use that only on a trusted network.
Troubleshooting
- "Could not reach the PanelFi server": check the hostname, that port 2087 is open from the WHMCS server, and the Secure setting.
- "invalid or expired API token": wrong, revoked or expired. Resetting an administrator's password revokes that administrator's tokens.
- "this token is read-only": create a token without the read-only option.
- "only a server administrator can manage resellers": use an administrator token for reseller products.
- "the owner of this token can no longer sign in": the token's owner is suspended or removed.
- "too many failed attempts": wait, then retry with the right token.
- "no package named ...": the product's package name must match exactly.
- Usage shows zero: disk is measured on a schedule, so a new account shows zero until the first check.
Looking for the module that sells and manages PanelFi licenses? That is a separate WHMCS licensing module; see Partner program and licensing.