WHMCS Module Setup
- Prerequisites: WHMCS 8.0+, PHP 7.3+,
cURLextension enabled, a Patchstack Developer or Enterprise plan (required for App API access), SSH access with WP-CLI installed on each cPanel server you want to auto-deploy to.
Technical integration
Section titled “Technical integration”The module is a standard WHMCS provisioning module (modules/servers/patchstack)
plus optional hooks. It plugs into the four WHMCS module commands — Create,
Suspend, Unsuspend, Terminate — so every billing event drives a corresponding
action against the Patchstack App API.
On Create it registers the customer’s site, stores OAuth credentials, and (if
enabled) SSH-deploys the Patchstack plugin to the correct WordPress installation.
Suspend/Unsuspend toggle protection state. Terminate removes the site from
Patchstack when the service is cancelled. For how the underlying provisioning API
works, see the Patchstack integration guide.
Multi-server support is built around WHMCS’s own server management. You configure one Patchstack API server record (carrying only your App API token) and point the Patchstack product at it via a Server Group. Your existing cPanel servers are used as-is: when a customer buys Patchstack, the module looks up the customer’s active hosting service, identifies which cPanel server it lives on, and reads SSH credentials from that server record. Two servers or two hundred — there’s no per-server product configuration.
The client area covers five explicit states from “just ordered” to “protected”, including the two edge cases the module handles without support intervention: multiple WordPress installs on one account (customer picks which one), and external hosting with no SSH access (customer gets a one-click pre-configured plugin download). Once a site has pinged Patchstack at least once, the client area exposes a single-sign-on link into the Patchstack dashboard — no second password to manage.
Configure Patchstack — hosting-provider walkthrough
Section titled “Configure Patchstack — hosting-provider walkthrough”The manual steps a hosting provider takes inside WHMCS to wire up Patchstack Protection, end to end. Every step is meant to be run against your real WHMCS admin UI, with the values captured as you go.
Step 1 — Get your Patchstack App API Token
Section titled “Step 1 — Get your Patchstack App API Token”- Log in to the Patchstack Dashboard.
- Navigate to Settings → Integrations.
- Click Generate Token (or copy your existing App API token).
- Copy the token somewhere safe now — you enter it as the server Access Hash in Step 3. Once you navigate away, you may not be able to view the same token again.
For details on the token (UserToken) and what it authorizes, see the
Patchstack App API documentation.
Step 2 — Activate Payments (Bank Transfer)
Section titled “Step 2 — Activate Payments (Bank Transfer)”- Open Settings → Apps & Integrations (
https://your-whmcs.example.com/admin/index.php?rp=/admin/apps). - Click Browse.
- Go to the Payments section.
- Find and click Bank Transfer.
- Click to activate it.
- Save changes.
Step 3 — Configure the Patchstack API Server
Section titled “Step 3 — Configure the Patchstack API Server”This server record stores only your Patchstack App API token — it does not represent a cPanel server.
- Navigate to Setup → Products/Services → Servers (
https://your-whmcs.example.com/admin/configservers.php). - Click Add New Server, then Go to Advanced Mode.
- Configure:
| Field | Value |
|---|---|
| Name | Patchstack API |
| Hostname | api.patchstack.com |
| Module | Patchstack Protection |
| Access Hash | your App API token (from Step 1) |
- Click Test Connection to verify, then Save.
Step 4 — Create a Server Group
Section titled “Step 4 — Create a Server Group”- Navigate to Setup → Products/Services → Servers (
https://your-whmcs.example.com/admin/configservers.php). - Click Create New Group.
- Name it
Patchstack Protection Group. - Add your Patchstack API server into the group, then Save.
Step 5 — Configure cPanel Servers for SSH
Section titled “Step 5 — Configure cPanel Servers for SSH”The module reads SSH credentials directly from each cPanel server record (not from the product). For each cPanel server in your infrastructure:
- Navigate to Setup → Products/Services → Servers (
https://your-whmcs.example.com/admin/configservers.php). - Open an existing cPanel server (or add one) and set:
| Field | Value / notes |
|---|---|
| Module | cPanel |
| Hostname / IP Address | the server’s IP (enter the IP, not a hostname) |
| Username | root |
| Password | SSH password — for password auth; leave blank if using a key |
| API Token | SSH private key (PEM) — for key auth; leave blank if using a password |
- Save, and repeat for each cPanel server.
Step 6 — Create a Product Group
Section titled “Step 6 — Create a Product Group”- Navigate to Setup → Products/Services → Products/Services (
https://your-whmcs.example.com/admin/configproducts.php). - Click Create a New Group and configure:
| Field | Value |
|---|---|
| Product Group Name | Patchstack Protection Product Group |
| Order Form Template | Standard Cart |
| Available Payment Gateways | Bank Transfer |
- Save.
Step 7 — Create the Patchstack Product
Section titled “Step 7 — Create the Patchstack Product”- Navigate to Setup → Products/Services → Products/Services (
https://your-whmcs.example.com/admin/configproducts.php). - Click Create a New Product:
| Field | Value |
|---|---|
| Product Type | Other |
| Product Group | Patchstack Protection Product Group |
| Product Name | Patchstack Protection |
| Module | Patchstack Protection |
| Create as Hidden | Unchecked |
- Click Continue, then configure the tabs:
- Details — Require Domain: Checked
- Pricing — Payment Type:
Free(for testing; set real pricing in production) - Module Settings — Server Group:
Patchstack Protection Group· Auto Deploy Plugin: Checked · “Automatically setup the product as soon as the first payment is received”: Selected
- Click Save Changes.
Step 8 — Custom Fields (automatic)
Section titled “Step 8 — Custom Fields (automatic)”- Open the Custom Fields tab.
- Click Save Changes — the module creates the required custom fields on save; they appear in the tab afterward.
Testing a full order end to end
Section titled “Testing a full order end to end”Place a test order end to end to confirm the module provisions correctly. This
assumes you’ve completed Steps 1–8 above and have access to a cPanel/WHM test
server. Throughout this section, replace <your-cpanel-server-ip> with your test
server’s IP and <your-test-domain> with a domain that resolves to it (for
example, an nip.io wildcard domain).
Test Step 1 — Create a cPanel Server Group and Hosting Product
Section titled “Test Step 1 — Create a cPanel Server Group and Hosting Product”In production the hosting provider already has cPanel hosting products and server groups in WHMCS. In a test environment you create them to simulate this.
Create the server group
- Navigate to Setup → Products/Services → Servers (
https://your-whmcs.example.com/admin/configservers.php). - Click Create New Group.
- Name it
Hosting Servers. - Add the cPanel test server into the group, then Save.
Create the product group and product
- Navigate to Setup → Products/Services → Products/Services (
https://your-whmcs.example.com/admin/configproducts.php). - Click Create a New Group, name it
Hosting, and Save. - Click Create a New Product and configure:
| Field | Value |
|---|---|
| Product Type | Shared Hosting |
| Product Group | Hosting |
| Product Name | cPanel Hosting |
| Module | cPanel |
| Create as Hidden | Checked |
- Click Continue, then Save Changes.
- The product reloads — open the Module Settings tab and configure:
| Field | Value |
|---|---|
| Server Group | Hosting Servers |
| Module Settings | Automatically setup the product when you manually accept a pending order |
- Click Save Changes.
Test Step 2 — Order cPanel Hosting (WHMCS auto-provisions)
Section titled “Test Step 2 — Order cPanel Hosting (WHMCS auto-provisions)”WHMCS creates the cPanel account automatically when the order is accepted, just as in production. The cPanel username is stored on the service record automatically — no manual entry needed.
- Navigate to Clients (
https://your-whmcs.example.com/admin/clients.php) and click the test client. - Click Add New Order.
- Select the cPanel Hosting product.
- Set the domain to
wpsite.<your-test-domain>. - Leave Order Status as
Pending. - Click Submit Order.
- Navigate to Orders (
https://your-whmcs.example.com/admin/orders.php), check the order, and click Accept Order.
WHMCS calls WHM to create the cPanel account and records the username on the hosting service automatically.
Next, install WordPress on the provisioned cPanel account (via WHM/cPanel), then return here for the next step.
Test Step 3 — Order Patchstack Protection
Section titled “Test Step 3 — Order Patchstack Protection”- Navigate to the Patchstack Protection store page (
https://your-whmcs.example.com/index.php?rp=/store/patchstack-protection-group). - Click Order Now for the Patchstack Protection product.
- Click I will use my existing domain and update my nameservers.
- Enter a placeholder domain such as
example.com(WHMCS may not allow yournip.iotest domain at checkout — we correct it in the next step). - Click Checkout and complete the order.
Test Step 4 — Correct the Domain
Section titled “Test Step 4 — Correct the Domain”- Navigate to Clients (
https://your-whmcs.example.com/admin/clients.php) and open the test client. - Go to the Products/Services tab and select the Patchstack order.
- Update the Domain field to
wpsite.<your-test-domain>. - Click Save Changes.
Test Step 5 — Accept Order
Section titled “Test Step 5 — Accept Order”- Navigate to Orders (
https://your-whmcs.example.com/admin/orders.php). - Check the order.
- Click Accept Order.
If Auto Deploy Plugin is enabled, the module attempts SSH deployment
automatically. Check Utilities → Logs → Module Log filtered by patchstack to
see the deployment result.
Further information
Section titled “Further information”- Patchstack App dashboard — log in to manage the App API token and review provisioned sites.
- Patchstack App → Settings → Integrations — generate or rotate the App API token.
- Patchstack App API — the provisioning API the module calls under the hood.
- Patchstack integration guide — how site provisioning and the plugin lifecycle work end to end.
- WHMCS Server Management documentation — official WHMCS guide for the underlying server-record infrastructure this module relies on.
- Module support. For technical questions about the module itself, contact
support@patchstack.com.