How a provisioning module works
A module is a PHP file in /modules/servers/ with functions WHMCS calls at set points in a service's life.
- 01
The seven core functions are create, suspend, unsuspend, terminate, renew, change password and change package. Each must return exactly the word success or an error message that staff will see.
- 02
WHMCS decides when a function runs: create after the order is paid, suspend by the cron job when overdue, unsuspend once the overdue invoice is paid. The module only handles talking to the panel or hypervisor.
- On success
- WHMCS changes the service status itself, and after creation sends the client a welcome email.
- Up to 24 settings
- A product passes settings configoption1 to configoption24 to the module, e.g. node and template.
From payment to a running VPS
The run with a Proxmox module: from payment to the email with access data.
- Long operations
- Proxmox returns a task id and the clone runs in the background. The module stores it, and a job that checks the status finishes the work.
Module functions and panel calls
The same WHMCS function is a different call in each panel.
| WHMCS function | Proxmox VE | Pterodactyl |
|---|---|---|
| CreateAccount | POST .../qemu/{vmid}/clone, then start | POST /api/application/servers |
| SuspendAccount | POST .../status/stop or suspend | POST /servers/{id}/suspend |
| UnsuspendAccount | POST .../status/start | POST /servers/{id}/unsuspend |
| ChangePackage | PUT .../config and .../resize | PATCH /servers/{id}/build |
| TerminateAccount | DELETE .../qemu/{vmid} | DELETE /servers/{id} |
Proxmox paths start with /api2/json/nodes/{node}.
Proxmox and Pterodactyl from the module side
The two most common WHMCS module targets at hosting companies.
| Proxmox VEVPS and LXC containers | Pterodactylgame servers | |
|---|---|---|
| Authentication | an API token with its own permissions and expiry | a Bearer application key |
| Creating a service | a background task with a UPID | the server at once in the panel, installed by Wings |
| Duplicate protection | a fixed VMID from the service id | the external_id field |
| Official WHMCS module | none published, we write one | Yes |
05
What we watch out for with WHMCS
Details from the docs that decide whether automation leaves services half-done.
- 01
Module
Exactly success
WHMCS treats a function as successful only on that word. Anything else is an error staff will see.
- 02
Secrets out of the log
logModuleCall gets a list of values to scrub, so passwords and tokens never land in the Module Log.
- 03
An alert on failure
The AfterModuleCreateFailed hook passes the failure reason. We send it straight to the support channel.
- 04
API access by IP
The WHMCS API accepts requests only from allowed IPs by default. An outside integration needs an entry or an access key.
- 05
Hooks in a module
The hooks.php file is detected when the module is activated. One added later needs the product settings saved again.
Example: VPS hosting on Proxmox with WHMCS
The rollout, step by step.
- Company
- A small VPS host with a Proxmox VE cluster
- Today
- VMs set up by hand after every payment
- Goal
- A VPS ready minutes after payment, with no one involved
- 1
Templates and products
Each OS gets a VM template, and WHMCS products point to the template, node and resources.
- 2
A narrowly scoped token
The module gets a Proxmox API token with rights only to the nodes and VMs it needs, with an expiry date.
- 3
Module and completion job
CreateAccount clones the template, and a background job waits for the clone, sets the password and starts the VM.
- 4
Buttons in the client area
VM start, stop and restart as custom module functions, shown with the service in the WHMCS client area.
Order, payment, VM and an access email with no manual work, and overdue accounts end in automatic suspension.
WHMCS with modules or Flaem
Flaem is a panel for hosting companies. WHMCS with a good module is often enough.
A provisioning module, hooks and SSO to the panel, in your current WHMCS.
A panel with provisioning on your nodes, with the store and wallet built in.
- 01 WHMCS with modules
- 02 Flaem
When
- You already run WHMCS with clients, invoices and payments.
- You only lack automation for one or two panels.
- You want one panel for the store, billing and servers.
- You are launching a new host and want one panel from day one.
WHMCS with modules
When
- You already run WHMCS with clients, invoices and payments.
- You only lack automation for one or two panels.
A provisioning module, hooks and SSO to the panel, in your current WHMCS.
Flaem
When
- You want one panel for the store, billing and servers.
- You are launching a new host and want one panel from day one.
A panel with provisioning on your nodes, with the store and wallet built in.
WHMCS and provisioning glossary
Terms from this page: module, hook, provisioning and related ones.
- Provisioning
- Setting up a service automatically after an order: an account, VM or game server.
- Server module
- A PHP file in /modules/servers/ through which WHMCS talks to the panel.
- Hook
- A function called on a WHMCS event, e.g. after a failed service creation.
- UPID
- A Proxmox task id used to check whether an operation has finished.
Common questions about WHMCS
The main questions about WHMCS modules: fixes, nodes, sign-in, cost and code.
Our ready module misbehaves. Can you fix it?
How long does it take?
How much does a WHMCS module for Proxmox or Pterodactyl cost?
Will the module handle several Proxmox nodes?
Can the client get into the panel without a second password?
Will the WHMCS module code be mine?
How do you check a WHMCS module before launch?
What if the WHMCS module stops working?
What if WHMCS, Proxmox or Pterodactyl changes its API?
Sources
Technical details come from the WHMCS and Proxmox VE documentation.
Describe your project.
A free quote comes back within an hour during working hours.