WHMCS Module Setup Guide

Install and configure the official xyz.am WHMCS provisioning module. Auto-create premium accounts, sync usage stats, and give your clients one-click SSO into xyz.am.

What the Module Does

The official xyz.am WHMCS module is a server provisioning module (no physical server required). When a client orders a product mapped to it, WHMCS calls xyz.am's API to:

  • Create a premium xyz.am account on order activation.
  • Suspend the account on overdue invoice or manual suspension.
  • Terminate the account on cancellation.
  • Generate one-click SSO login links for the client area.
  • Sync usage stats (profile pages, bookmarks, aliases, domains, websites, short URLs) to both the admin Service tab and the client area.

Requirements

  • WHMCS 8.0+ (uses module API v1.1).
  • PHP 7.4+ with the curl and json extensions enabled.
  • An xyz.am partner API key. Contact us if you don't have one — these aren't the same as user-facing API tokens.
  • Outbound HTTPS access from your WHMCS server to https://xyz.am/api/.

Installation

1. Upload the module

Extract the module archive and upload the xyzam/ folder to:

/path/to/whmcs/modules/servers/xyzam/
├── xyzam.php
└── xyzamclientarea.tpl
2. Install the client-area template

Copy xyzamclientarea.tpl into each client area theme that your customers use. For the default theme:

cp modules/servers/xyzam/xyzamclientarea.tpl \
   templates/twenty-one/xyzamclientarea.tpl

If you only use one theme, this is the only copy you need. The template renders the SSO button, account details, and usage summary inside the service overview tab.

3. Verify file permissions

WHMCS must be able to read the module files. On most setups:

chmod 644 modules/servers/xyzam/*.php modules/servers/xyzam/*.tpl
chown -R www-data:www-data modules/servers/xyzam/

Set Up a Product

The module declares RequiresServer = false, so you don't need to add a server entry. Configuration lives on the product itself.

1. Create the product
  1. Go to System Settings → Products/Services → Create a New Product.
  2. Set Product Type to Other.
  3. Choose a Product Group (e.g. "xyz.am Premium").
  4. Give it a name like "xyz.am Premium — Monthly".
  5. Click Continue.
2. Pick the module

On the Module Settings tab, select xyzam from the Module Name dropdown. The four config fields below appear automatically.

3. Fill in the config
FieldDefaultNotes
API Base URL https://xyz.am/api No trailing slash. Override only if you're testing against staging.
API Key (empty) Your partner API key. Stored encrypted by WHMCS.
Verify SSL On Leave on in production. Turn off only for testing self-signed certs.
HTTP Timeout (s) 15 cURL timeout. Increase if your WHMCS server has slow outbound networking.
4. Test the connection

Save the product, then click Test Connection in the Module Commands section. A green success badge means the API key is valid and reachable. A red error includes the HTTP code and a snippet of the upstream response — usually enough to diagnose.

5. Configure auto-provisioning

On the Module Settings tab, check the boxes you want WHMCS to call automatically:

  • Automatically setup the product as soon as an order is placed — usually combined with "when first payment is received" for paid plans.
  • Automatically suspend on overdue invoices.
  • Automatically terminate after the cancellation grace period.

What Each Action Does

WHMCS hookAPI callEffect on xyz.am
CreateAccount POST /api/create-user.php Creates the user (or upgrades an existing one) to premium. Sends client first/last name and email.
SuspendAccount POST /api/suspend-user.php Downgrades the user to free and clears the membership expiry.
UnsuspendAccount POST /api/unsuspend-user.php Re-promotes to premium. See note below
TerminateAccount POST /api/terminate-user.php Permanently deletes the user record.
Unsuspend endpoint: the module ships with an UnsuspendAccount hook that calls /api/unsuspend-user.php, but that endpoint isn't yet present on the xyz.am side. Until it ships, unsuspending in WHMCS will return an error and the account will stay on the free tier. Workaround: manually re-run Module → Create to bump the user back to premium, or contact us to enable the endpoint.

Admin Services Tab

When you open a client's xyz.am service in WHMCS admin, the Custom Fields area shows live data pulled from xyz.am:

  • Login to xyz.am — one-click SSO link (10-minute token).
  • Membership Statuspremium, free, etc.
  • Membership Expiry — date or "Never".
  • Credits — current credit balance.
  • Profile Pages, Bookmarks, Email Aliases, Domains/Subdomains, Websites, Short URLs — current usage counts.

Data is fetched live on every page load — no cron sync required. If a stat shows it means the upstream call failed; check the module logs.

What Clients See

In the WHMCS client area, the service detail page is replaced by xyzamclientarea.tpl. It shows:

  • A big Access Your Premium xyz.am Account button (SSO).
  • An Account Details panel — status, expiry, credits.
  • A Usage Summary panel — counts of all premium features.
  • Four Quick Actions shortcuts (Create Profile, Manage Bookmarks, Setup Domain, Shorten URLs) — all open xyz.am via SSO.

If you maintain a custom theme, the template uses standard WHMCS Smarty + Bootstrap classes, so it's safe to drop into any modern theme. To restyle, edit the <style> block at the bottom of the .tpl or override classes in your theme's CSS.

Troubleshooting

Module Logs

Every API call is logged via logModuleCall(). View them at Utilities → Logs → Module Log, then filter by Module = xyzam. Each entry shows the request URL, payload, and full response — including HTML snippets if a WAF intercepted the call.

Common errors
ErrorLikely causeFix
Missing API Key Config field left blank. Paste your partner API key on the product's Module Settings tab.
Forbidden (HTTP 403) Wrong API key, or your WHMCS IP isn't allow-listed. Double-check the key. If it's correct, contact us with your WHMCS server's outbound IP.
Invalid JSON response: ... A WAF (Cloudflare, mod_security) returned an HTML challenge page instead of letting the call through. Allow-list WHMCS-xyzam/1.1 User-Agent from your WHMCS server's IP, or temporarily disable the rule.
cURL error: SSL certificate problem Outdated CA bundle on the WHMCS server. Update your PHP CA bundle. Don't disable Verify SSL in production.
Unknown API error on Unsuspend The /api/unsuspend-user.php endpoint isn't deployed yet. See the warning under What Each Action Does.
Test Connection failed

Click Test Connection on the product's Module Commands. The button calls /api/whmcs-api.php with action=test_connection. The response body (success or error) shows in the WHMCS admin banner. If it succeeds but provisioning still fails, the issue is endpoint-specific — check the per-call entries in the module log.

Security Notes

  • The module sends the API key in both the Authorization: Bearer header and a ?key= query parameter for compatibility with WAFs that strip Authorization headers. If your hosting provider logs query strings, treat those logs as sensitive.
  • SSO login URLs are valid for 10 minutes. WHMCS doesn't cache them — every page load mints a fresh token.
  • Keep Verify SSL on. The "off" option exists only for development.
  • The partner API key gives full account-level control over xyz.am users. Rotate it if a WHMCS staff account is compromised.