Basic concepts and requirements
Hetzner Datacenter module WHMCS
Order now | Download | FAQ
Requirements for the successful operation of the module
- Minimal WHMCS version 8+
- Hetzner API
The logic of the module.
You can offer your clients virtual machines from Hetzner. The module allows you to deploy almost any service based on Hetzner.
Creating a new Account.
- Checking the module license
- Generating the server name in the format
NameServer-[*user_id*]-[*service_id*]
- Generating data to create a server
- Sending data via API and creating a server
Package change
- The package change function allows you to enable and disable backups
Suspending an Account
- Checking the module license
- Selecting the suspension method: server shutdown or enabling firewall rules
- Executing the suspension via API
Unsuspending an Account
- Checking the module license
- Selecting the restoration method: server power on or restoring firewall rules
- Executing the restoration via API
Terminating an Account
- Checking the module license
- Deleting the server via API
- Updating information in the WHMCS database
Client Area
The module provides clients with the ability to manage virtual machines through the WHMCS client area, including functions for creating, suspending, restoring, and deleting servers, as well as managing backups and snapshots.
Automatic Pricing & Rounding — how prices are generated
The module can automatically calculate and maintain product prices. You define the rules once; the module keeps prices in sync.
- Base price source: Hetzner Cloud API pricing (currency is taken from
/pricing.currency
), not hard-coded EUR. - Base mode: Choose Net or Gross as the starting point for calculations.
- Margin: Set a percentage margin; it is applied to the Hetzner base price.
- Currencies & periods (bulk): Select one or more currencies and billing cycles (Monthly, Quarterly, Semi-Annually, Annually, Biennially). A live preview table shows resulting prices before saving.
- Rounding policy (unified): Always round up to ISO-4217 minor units (0/2/3 decimals). The monthly price is rounded first; then it’s multiplied by the period factor and rounded again. The UI preview and server-side logic are identical.
- Apply Bulk Pricing: Creates or updates the necessary
tblpricing
rows in WHMCS for the selected currencies and periods. - Daily sync (cron): When enabled, the module fetches fresh Hetzner base prices once per run and automatically re-applies your margin and rounding rules, keeping prices consistent every day.
- Persistence & safety: Your bulk pricing configuration is stored per product and merged safely so other saved fields are not overwritten. Detailed actions are logged to the Module Log with
traceId
.
Notes: setup fees are not changed by automatic pricing; only recurring prices are updated according to your selection. Make sure WHMCS currency rates are configured.
Stock Control & Availability — automatic enable/disable
The module can manage product availability based on the Hetzner API. If a configuration becomes unavailable at the provider, the product is automatically marked as out of stock; when it reappears, availability is restored.
- Provider awareness: On scheduled sync and on admin actions, the module checks availability of server types, images, placement groups and networks returned by the Hetzner API.
- Auto disable: If a previously offered configuration is no longer available in the API, the module enables WHMCS
stockcontrol
for the affected product and setsqty
to0
— the offer becomes unavailable to order. - Auto enable: When the configuration becomes available again in the API, the module restores
stockcontrol
/qty
to the last saved values, re-enabling orders. - Manual recovery tools: In the product settings there is a Clear and Reset button and an AJAX action
restore_saved_stockcontrol
to restore values from the saved record. Logged states: input, not_found, updated_product, deleted_saved, done, error. - Safety first: The module never deletes your custom settings; it only toggles availability and qty according to provider state. All changes are written to the Module Log.
Scope: stock control affects ordering only. Existing services are not terminated or suspended because of provider stock changes.
No Comments