Module: Enhance WHMCS Provisioning Module
Component: Module Create / Order Acceptance
Summary
When a website domain already exists in Enhance (e.g. pre-created or manually transferred to a client before WHMCS provisioning), the module receives a 409 Conflict response from the Enhance API and treats it as a fatal error, leaving the WHMCS order permanently in Pending status instead of recognising the service as already provisioned and marking it Active.
Environment
- Control Panel: Enhance
- Billing System: WHMCS
- Integration: Official Enhance module for WHMCS
Steps to Reproduce
- In Enhance, manually create a website for a domain (e.g.
securitygold.es) under the reseller/admin account.
- In WHMCS, register the client and create a hosting order for that same domain.
- Client completes payment — WHMCS triggers
Module Create on Payment.
- The Enhance module calls
POST /api/orgs/{orgId}/websites to provision the website.
- Enhance returns
409 Conflict because the domain already exists.
- WHMCS logs
Module Create Failed and leaves the order in Pending status.
- Every subsequent manual attempt to accept the order also fails with
Already provisioned.
Actual Behavior
The module receives the following API response from Enhance:
HTTP 409 Conflict
{"code": "already_exists", "detail": "domain"}
WHMCS Activity Log:
Running Module Create on Payment
Module Create Failed - Service ID: 21 - Error: [409] Client error:
`POST https://cp.hosturbo.net/api/orgs/57b2df38-f914-414e-844a-6716e91b80e3/websites`
resulted in a `409 Conflict` response: {"code":"already_exists","detail":"domain"}
All subsequent manual attempts to accept the order return:
Module Create Failed - Service ID: 21 - Error: Already provisioned
The order remains stuck in Pending indefinitely. The service in Enhance is fully operational, but WHMCS has no way to know this without manual admin intervention.
Expected Behavior
When the Enhance API returns 409 Conflict with "code": "already_exists" for the domain, the module should interpret this as "service already exists and is operational" and:
- Mark the WHMCS service status as
Active.
- Mark the order as accepted/completed.
- Optionally log a warning indicating the domain was pre-existing, for transparency.
This is consistent with how well-behaved provisioning modules handle idempotency — a resource already existing should not be treated as a failure during provisioning.
Root Cause Analysis
The module does not differentiate between:
- A
409 caused by a legitimate conflict that should block provisioning.
- A
409 caused by the domain already being correctly provisioned, which should be treated as a success.
In this specific case, the organisation was successfully created by the module on first call (as confirmed in the Enhance activity log at 2026-03-28T20:09:00Z), but the subsequent website creation failed with 409 because the domain had been pre-created and manually transferred to the client in Enhance before the WHMCS order was paid.
Use Case Context
This situation is not an edge case. It is a common and valid operational workflow for hosting providers who:
- Migrate existing clients to WHMCS and pre-create their sites in Enhance manually.
- Transfer ownership of a site in Enhance to a newly registered client before the WHMCS provisioning fires.
- Test or set up client environments in Enhance ahead of the billing cycle.
In all these scenarios, the current module behaviour causes unnecessary friction, requires manual admin intervention to resolve, and may confuse clients who see their order stuck as Pending despite their service being fully active.
Suggested Fix
In the module's create function, catch 409 Conflict responses from the Enhance API and check if the resource already exists. If so, treat the provisioning as successful rather than raising an exception.
Pseudocode:
try {
$response = $enhanceApi->createWebsite($orgId, $domain);
} catch (ClientException $e) {
if ($e->getResponse()->getStatusCode() === 409) {
// Domain already exists — treat as already provisioned
return ['success' => true, 'already_provisioned' => true];
}
throw $e;
}
Workaround (for other users hitting this issue)
- Verify the domain and organisation exist correctly in the Enhance panel.
- In WHMCS, navigate to the affected client → Services → find the service.
- Manually change the service status from
Pending to Active and save.
- Mark the order as accepted if it remains in Pending state.
Additional Notes
- The Enhance activity log confirms the client organisation was successfully created via API token at
2026-03-28T20:09:00.914602Z, proving the provisioning partially succeeded before the 409 was returned.
- The website in Enhance was fully operational throughout — only the WHMCS order status was incorrect.
- No data loss or service disruption occurred; the issue is purely a state synchronisation problem between WHMCS and Enhance.