Admin

WHMCS Account Provisioning

How WHMCS provisions hosting accounts via the Opterius module and API.

Last updated 1775606400

When a client orders a hosting product linked to the Opterius module, WHMCS calls the module's CreateAccount function, which calls the Opterius Panel API, which in turn instructs the Agent to create the account on the server.

Provisioning Flow

Client orders product
    → WHMCS CreateAccount hook fires
    → Opterius WHMCS module calls Panel API: POST /api/accounts
    → Panel validates request and calls Agent: POST /accounts/create
    → Agent creates Linux user, web directories, nginx vhost, PHP-FPM pool, DNS zone
    → Panel returns success to module
    → WHMCS marks service as Active
    → WHMCS emails client their account details

The full chain typically completes in under 10 seconds.

What WHMCS Sends

WHMCS passes the following to the module when creating an account:

Parameter Description
username Generated from the client's first name or the domain, truncated to 8 chars
domain The client's chosen domain name
password Account password (set by client or auto-generated)
package The WHMCS configurable option or package name

Package Mapping

WHMCS package names must be mapped to Opterius package names. Configure this in the WHMCS product settings under Module Settings.

In your WHMCS product: Products/Services → [product] → Module Settings:

Field Value
Package Name The exact name of the package in Opterius Panel

The package name must match exactly (case-sensitive) the name of an existing package in Server Mode → Packages. If the name does not match, account creation will fail with a Package not found error.

Tip: Create your Opterius packages first, then copy the exact names into WHMCS product settings. Avoid renaming packages in Opterius after linking them to WHMCS products — update both sides if you rename.

Handling Failures

If any step in the provisioning chain fails, WHMCS marks the service as Failed and logs the error. To diagnose:

  1. Check WHMCS → Utilities → Logs → Module Log — shows the exact API request and response.
  2. Check the Panel's activity log in Server Mode → Activity — shows whether the Panel received the request.
  3. Check the agent log on the server:
journalctl -u opterius-agent -n 100

To manually re-trigger provisioning after fixing the issue: in WHMCS admin area → client → product → Module Commands → Create.

Username Conflicts

If WHMCS generates a username that already exists on the server, the Panel returns a conflict error. WHMCS does not auto-retry with a different username. Resolve this by:

  • Manually setting a different username in the WHMCS service record before re-running Create.
  • Deleting the conflicting account on the Panel if it is stale.

Related