Every WHMCS product that uses the module runs in one of two modes, set by the Account Type config option on the product. Line creates an IPTV line on the panel; it is the default and the common case. Sub-Reseller creates a reseller account on the panel; useful when you resell reseller accounts on top of your own.

The two modes share the same lifecycle hooks (CreateAccount, Suspend, Unsuspend, Renew, ChangePassword, Terminate, ChangePackage) but each hook maps to a different panel call in each mode. This page enumerates the exact mapping so you can predict what will happen at every step.

Line mode

The default and by far the most common configuration. Each WHMCS service under a Line product corresponds to one row on the panel's lines table, addressable by its numeric id.

CreateAccount

Fires when WHMCS moves a service to the Active state after the first invoice is paid. The module runs the following steps in order:

  1. Read the product's config options: Panel, Package, Bouquets, Max Connections.
  2. Generate a username and a password with the generators configured in the addon's General Settings (or take the values WHMCS supplied on the service if you disabled auto-generation).
  3. Render the notes template with the client's fields ({service_id}, {client_id}, {client_name}, {client_email}, {client_phonenumber}, {product_name}).
  4. If the panel entry's Key type is Admin, pick up Admin owner member_id from the panel entry.
  5. POST to /panel-api/v1/lines with a body of {package_id, member_id, username, password, bouquets[], max_connections, notes}. On a reseller key member_id is omitted and the panel infers ownership from the token. On a reseller key max_connections is also omitted; the panel would refuse it anyway.
  6. Persist the returned id, username, password and expires_at on the WHMCS service, and mirror the credentials into tblhosting so the customer sees them in their client area.
  7. If the WHMCS billing cycle is not one-time or free, sync tblhosting.nextduedate to the panel's exp_date.

The line is now live on the panel and visible to the customer in the WHMCS client area, complete with the M3U URL if you configured one on the panel entry.

Suspend and Unsuspend

Fires when WHMCS moves the service to Suspended (unpaid invoice, admin action, or a dunning rule) or back to Active.

  • Suspend. POST to /panel-api/v1/lines/{id}/disable. The panel flips enabled=false and the customer can no longer stream. No credits are charged, and the line is preserved on the panel with its username, password and history intact.
  • Unsuspend. POST to /panel-api/v1/lines/{id}/enable. The panel flips enabled=true and streaming resumes immediately.

Neither action changes the line's expiry date. If the line's expiry is in the past, the customer still cannot stream after Unsuspend; you need a Renew for that.

Renew

Fires when a renewal invoice is paid, or when an admin runs a manual renewal on the service.

  1. POST to /panel-api/v1/lines/{id}/renew with {package_id} set to the product's current package.
  2. The panel adds one cycle worth of duration to the line's exp_date and returns the new value.
  3. The module writes the new expiry back into tblhosting.nextduedate.

The module does not send bouquets on Renew. If you have changed the product's bouquet selection and want the change on the line, use the Sync line to panel button on the service's Admin tab (see below).

ChangePassword

Fires when the customer clicks Change Password in the client area, or when an admin resets it.

The module inspects the value WHMCS passed. If it is 8 to 32 alphanumeric characters, it is honored as-is. Otherwise the module generates a fresh password with the addon's Password Generator settings. Either way, the module POSTs to /panel-api/v1/lines/{id}/reset-password with {password} and updates the WHMCS record.

Terminate

Fires when the customer or an operator cancels the service.

POST to /panel-api/v1/lines/{id}/delete. The panel removes the line permanently. The module then unlinks the WHMCS service from the panel record so a later re-provisioning (with a fresh order) starts clean.

Terminate is permanent on the panel side. If the customer changes their mind after cancellation, you have to re-provision, which creates a brand new line with brand new credentials. The old username and password cannot be recovered.

ChangePackage (WHMCS product change)

Fires when an operator switches the WHMCS service to a different product. The module's behavior splits on whether the new product points at the same panel package or a different one.

  • Same panel package_id. The module calls POST /lines/{id}/update with the new bouquets, notes and (admin key only) max_connections. The line keeps its id, its username, its password, its history and its expiry; only the configuration changes.
  • Different panel package_id. The panel API does not accept package_id on the update endpoint, and the module refuses the change with a clear error: Package changes on an existing line are not supported by the panel API. Please terminate and re-provision. The WHMCS service is left linked to the old panel line so you can decide what to do next; nothing on the panel changes.

The reason the refusal is loud instead of silent is that a partial migration where the WHMCS product says "Package B" but the panel line is still on "Package A" would confuse renewals, expiry math and the customer's expectations. Terminating and re-provisioning gives you a clean state on both sides.

Sync line to panel

Not a WHMCS lifecycle hook. A custom admin button on the service page that runs the same call ChangePackage runs in the same-package branch: POST /lines/{id}/update with the current bouquets, notes and max_connections. Use it when you edit the product's config options without changing the product, or when you want a quick way to force the panel line to match the WHMCS product without waiting for the next renewal.

Sub-Reseller products do not expose this button.

What the customer sees

For a Line product, the WHMCS client area service page renders the module's client template. The card shows:

  • Username and Copy button.
  • Password with a Show/Hide toggle and a Copy button.
  • Line status (Active or Suspended, as reported by the panel).
  • Expiry date.
  • The M3U URL, if the panel entry has one.
  • Active Connections table with current stream, IP, country and elapsed seconds. The table is populated by a browser-side call to the panel via the module, so it reflects real-time activity, not the state at page load.

If the CreateAccount hook has not completed yet (for example, the invoice was just paid), the card shows a "Your IPTV line is not ready yet" notice and no fields.

Sub-Reseller mode

Set Account Type to Sub-Reseller on a product to have every order create a reseller account on the panel instead of a line. This mode is only usable with an admin key. See Reseller vs Admin Keys for the full rationale.

CreateAccount

Fires when WHMCS moves a service to Active after the first invoice is paid.

  1. Read the product's config options: Panel, Credits, Sub-Reseller Member Group. The Package and Bouquets options are ignored in this mode.
  2. Verify the WHMCS client has an email address. Sub-reseller accounts require one; the module refuses to proceed with A client email address is required to provision a Sub-Reseller account. if the field is empty.
  3. Generate a username and a password with the addon's generators.
  4. POST to /panel-api/v1/resellers with {username, password, email, credits, notes, member_group_id}. The credits field is only sent when non-zero; the member_group_id field is required and comes from the product's Sub-Reseller Member Group option.
  5. Persist the returned id, username and credits on the WHMCS service, and mirror the credentials into tblhosting.

The new reseller account is now visible in the addon's Sub-Resellers tab, with its username, email, member group and credit balance.

If the Sub-Reseller Member Group option is missing or set to a group id that does not exist on the panel, the create call returns The panel rejected the request values. and the service stays in a pending state. Fix the group id on the product's Module Settings tab and re-run the CreateAccount from the service page.

Suspend, Unsuspend and Terminate

Fires when WHMCS moves the service to Suspended or Terminated, or back to Active.

The panel API does not currently expose a reseller status field. POST /resellers/{id}/update accepts fields like username, email, member_group_id, notes and password but not a boolean for enabling or disabling the account. As a result, the module cannot toggle a reseller account by API today.

When any of these three actions fires on a Sub-Reseller product, the module:

  1. Attempts the toggle. The panel returns 200 but the account is unchanged.
  2. Re-reads the reseller record and observes that the status did not change.
  3. Raises a clear error: The panel API does not support changing a reseller status. Please disable this account manually from the panel and try again.
  4. Preserves the WHMCS to panel link, so the service still knows which reseller account it belongs to. Nothing is unlinked. The action is safe to retry after you have completed the change in the panel.

To disable a sub-reseller today, log in to your panel, find the reseller under Users, and disable them there. The WHMCS service continues to track the same account and picks up the state correctly on the next reconciliation.

When the panel gains an official reseller status endpoint, the module will start honoring Suspend, Unsuspend and Terminate automatically. No configuration change on your side will be needed.

Renew

Fires when a renewal invoice is paid.

If the product's Credits option is greater than zero, the module POSTs to /panel-api/v1/resellers/{id}/billing/adjust with {delta: <credits>, reason: "WHMCS renewal service #<id>"}. The panel adds the delta to the reseller's balance and returns the new balance.

If the product's Credits option is zero, the renewal is a no-op on the panel side (nothing to add) and the module simply updates the WHMCS service status to Active.

ChangePassword

Fires when the customer clicks Change Password, or when an admin resets it.

The password validation and generation logic is identical to Line mode: honor a WHMCS-supplied 8-to-32 alphanumeric password, generate one otherwise. The module then POSTs to /panel-api/v1/resellers/{id}/update with {password} and updates the WHMCS record.

ChangePackage

Not supported for Sub-Reseller products. The module refuses with Package changes are not supported for Sub-Reseller products. because packages are a Line concept and do not apply to reseller accounts.

What the customer sees

For a Sub-Reseller product, the client area card shows:

  • Username and Copy button.
  • Password with Show/Hide and Copy.
  • Status (Active or Suspended, driven by WHMCS).
  • Credit balance (only shown for Sub-Reseller products).
  • Login instructions pointing at the panel's reseller area if you configured them in the addon settings.

The Active Connections table and the M3U URL are not shown for Sub-Reseller products; both are Line-only concepts.

See also

  • Configure. How to pick the Account Type and set the config options each mode needs.
  • Reseller vs Admin Keys. Why Sub-Reseller products require an admin key and which lifecycle actions are unreachable on the panel API today.
  • Troubleshooting. Common failures for each mode and how to resolve them.