WHMCS module

The module connects WHMCS to the panel: WHMCS sells game servers, the panel creates and runs them. Each WHMCS service is one game server in the panel; each WHMCS client is a panel account with the Customer role and the same e-mail.

Requirements: WHMCS 8.x (PHP 7.4–8.3 with cURL), the panel reachable from the WHMCS server over HTTPS.

Installation

  1. Download gamepanel-whmcs-<version>.zip from Downloads and unpack it into the WHMCS root. You should end up with modules/servers/gamepanel/gamepanel.php.
  2. In the panel, issue an API key: Access → API keys, name whmcs, scope admin. The gmk_… key is shown once — copy it right away.
  3. In WHMCS open System Settings → Servers → Add New Server: - Hostname — the panel domain, e.g. panel.example.com (a full URL such as https://panel.example.com:8443 works too); - Module — Game Panel; - Password — the API key (if it doesn't fit, put it in Access Hash); - Secure — on (HTTPS).

Click Test Connection — it checks that the key works and has admin rights.

  1. Create a product (System Settings → Products/Services). On the Module Settings tab choose Game Panel and the server group, then fill in: - Plan — the panel plan the server is created with; the list is loaded from the panel; - Location — where to place the server; empty means any suitable node; - External ID prefix — leave whmcs- unless several WHMCS installations share one panel.

The plan defines both the game and the server's resources, so create a panel plan for each product — see Your first game server.

What the module does

  • Create — finds the client's panel account by e-mail or creates one (password = the service password) and creates a server with the product's plan and location. The server's number in the panel is the prefix + the service ID, e.g. whmcs-1042.
  • Suspend / Unsuspend — suspends and resumes the server; the client sees the suspension reason in the panel.
  • Terminate — deletes the server.
  • Upgrade / Downgrade — moves the server to the new product's plan.
  • Change Password — changes the password of the client's panel account. A client has one account for all their services.
  • Login to control panel — a one-time sign-in link, valid for 5 minutes.
  • Start / Stop / Restart — admin buttons on the service page.

The admin service page in WHMCS shows the server ID (a link into the panel), status, node, address and the client's account. The client area shows the status, the address players connect to and an Open control panel button.

Create is safe to repeat: if the panel already has a server with this service's number, the module uses it instead of creating a second one. Terminate on a service whose server is already gone succeeds too.

Per-order values

  • A configurable option named plan_id or location_id overrides the product setting. The option value is the panel ID, e.g. a sub-option loc_fra|Frankfurt.
  • Configurable options or custom fields named var_<key> set server settings, e.g. a custom field var_motd. When both are set, the custom field wins.

Setting keys are in the game catalog — see Game catalog. The module sends the values as an administrator, so the settings' access levels don't apply to them. Don't let customers pick in the order what you sell separately — pin slots in the plan, for example.

E-mails to customers

The panel doesn't e-mail customers. Messages such as "server ready", "server suspended" or "backup failed" are sent by WHMCS, which learns about events from the panel's webhooks — see HTTP API and webhooks.

Notes

  • An e-mail that belongs to a panel administrator or staff member, or to a disabled account, is refused at Create — sort it out in the panel and retry.
  • If the client already has a panel account, WHMCS doesn't know its password: the service password field is cleared and the client signs in with Open control panel.
  • Changing a client's e-mail in WHMCS doesn't change the panel account; that client's new services would get a new account.
  • Every call to the panel goes to the WHMCS Module Log (the API key is masked). Look there first when Create fails.