Paymenter HestiaCP Extension
A Paymenter server extension that provisions HestiaCP web hosting accounts: one Paymenter service becomes one Hestia user with one web domain, with suspend / unsuspend / terminate, Test Connection, and a client area that shows the panel login, the account password, and the DNS instructions.
v0.2.0 — Cloudflare for-SaaS automation: after the Hestia account is
created, the extension also adds the customer domain as a Cloudflare custom
hostname (zone-scoped token, SSL and Certificates: Edit) so the site becomes
reachable once the customer points their CNAME at your fallback origin
hostname (cf_fallback_origin, e.g. sites.example.com).
A Cloudflare failure never fails provisioning and never deletes the account —
the service is flagged for a Retry instead. See DESIGN.md §12.
Built for Paymenter 1.5.9 and HestiaCP 1.10.5 (Smith and Tech).
Design spec: DESIGN.md.
Screenshots
Design previews of the extension (from the design mockup — see
screenshots/README.md). Real in-Paymenter screenshots
(server setup, Test Connection, product config, client area) will replace these
once Phase 1 is installed and proven.
Phase 1 scope
- Server setup: panel URL + access key + secret key; Test Connection.
- Web-domain-only provisioning: create a Hestia user + one web domain.
- Suspend / unsuspend / terminate (terminate = suspend + 14-day grace, no delete).
- Hestia user packages pulled live into the product config.
- Client area: panel username, domain, package, status, panel password, an Open Control Panel button, and DNS instructions.
- Rollback: if adding the web domain fails, the just-created panel user is deleted again.
- Cloudflare for-SaaS (v0.2.0): the customer domain is added as a Cloudflare custom hostname at provisioning; its status (pending / waiting for DNS / active / needs attention) shows on the service page and is refreshed on every view. Terminate deletes the hostname; suspend changes nothing in Cloudflare.
Out of Phase 1: upgrades / package changes, password regeneration, SSL,
DNS zones, mail, databases, the deferred deletion pass, and the bundle flow.
See DESIGN.md §10.
Install
- Copy
extensions/Servers/HestiaCP/into Paymenter'sextensions/Servers/. - Run
composer dump-autoloadin the Paymenter root (the classmap must pick up the new classes). - In Paymenter admin → Servers, create the server entry with extension
HestiaCPand fill in:panel_url— e.g.https://hestia.example.com(no trailing slash)access_key— Hestia access-key ID (20 chars), created for theadminusersecret_key— Hestia secret key (40 chars), stored encryptedshared_ip— optional; blank lets Hestia pick the shared IPcf_zone_id— Cloudflare zone ID of the for-SaaS zone (optional; enables the Cloudflare step)cf_api_token— scoped Cloudflare API token (Zone: SSL and Certificates: Edit, the for-SaaS zone only, no IP filtering), stored encryptedcf_fallback_origin— display only, e.g.sites.example.com
- Click Test Connection. Do not proceed until it passes.
- Link the hosting products to this server entry and set each product's
package_namefrom the live select.mail_accountsmust be 0.
Hestia access key (create at install time)
- Panel → admin user → Access Keys (or
v-add-access-key admin '*' <comment>). - Grant exactly the Phase 1 command set from
DESIGN.md§4.4:v-list-user-packages,v-add-user,v-add-web-domain,v-list-user,v-list-web-domains,v-suspend-user,v-unsuspend-user,v-delete-user. - Server Settings → Security → API: enable (admin), and allowlist the
Paymenter host's source IP unless
allow-allis used. - Enter the key pair on the Paymenter server record. Never paste the secret into chat, a file, or this repo.
Layout
extensions/Servers/HestiaCP/
├── HestiaCP.php # main class (extends App\Classes\Extension\Server)
├── Src/
│ ├── ApiClient.php # Hestia REST API transport (POST /api/)
│ ├── HestiaClientInterface.php
│ ├── CloudflareClient.php # Cloudflare for-SaaS Custom Hostnames transport
│ ├── CloudflareClientInterface.php
│ ├── CloudflareAutoSync.php # 15-minute automatic status recheck
│ ├── SiteService.php # create/suspend/unsuspend/terminate + rollback
│ ├── PackageService.php # product config -> package mapping
│ ├── PropertiesStore.php # per-service mapping in service properties
│ ├── DnsInstructions.php # shared CNAME / apex text
│ └── Exceptions/ # one file per exception class (autoload rule)
└── resources/views/ # client-area views (status, dns, suspension)
Rules that must not be broken
- One Paymenter service = exactly one Hestia user. Never share a panel user.
- Terminate never deletes. Deletion is a separate, future, gated pass.
- Mail is excluded at launch; a product with
mail_accounts != 0refuses to provision. - Apex domains are refused at launch (subdomains +
wwwonly). - The package comes only from product settings — never let a checkout value override it (GHSA-5q4q-834j-g8g4).
- Log domain + service ID only. Never log a credential or a customer password.





