Quick Installation
- Purchase the module and download
haikhavan_resellers_center-ioncube-8.2-1.0.0-install.zipfrom your VPSrv Client Area Downloads. - Upload and extract the ZIP into your WHMCS root directory so files land in
modules/addons/haikhavan_resellers_center/. - Verify PHP 8.2–8.4 with ionCube PHP Loader 14+ / 15.5+ is enabled on your server.
- Go to System Settings → Addon Modules in WHMCS Admin, click Activate next to Haikhavan Resellers Center, Product Linker & Contracts, and assign administrator role access.
Version: 1.0.0 | Module Slug: haikhavan_resellers_center | WHMCS Compatibility: 9.1.x (8.10+ compatible) | PHP: 8.2 / 8.3 / 8.4
A unified WHMCS 9.x enterprise channel-sales, service-bundling, and recurring contract platform combining Multi-Tier White-Label Resellers Center, SHA-256 Reseller REST API (api.php), Product Linker Lifecycle Cascade Engine, and Fixed-Term Recurring Contract Billing (6/12/24/36 months) with digital SHA-256 acceptance and automated Early Termination Fee (ETF) calculation.
Haikhavan Resellers Center, Product Linker & Contracts — Technical Documentation
Module Slug: haikhavan_resellers_center | Namespace: Haikhavan\ResellersCenter\ | Version: 1.0.0 | Target: WHMCS 9.1.2 (PHP 8.3+, MySQL 8.4)
1. Architecture & File Inventory
modules/addons/haikhavan_resellers_center/
├── haikhavan_resellers_center.php # WHMCS lifecycle callbacks & PSR-4 autoloader
├── api.php # Standalone White-Label Reseller REST API (SHA-256 key auth)
├── hooks.php # 8 hooks (4 Product Linker cascade hooks, Navbar, ClientProfile, HomeWidget, DailyCronJob)
├── whmcs.json # WHMCS Marketplace manifest (schema 1.0)
├── lib/
│ ├── Database.php # 8-table schema installer, tier defaults, starter linker/pricing seeders, audit logger
│ ├── ResellerService.php # Client promotion, SHA-256 API key rotation/auth, sub-accounts, payouts & formula-safe CSV
│ ├── ProductLinkerService.php # Recursion-safe lifecycle cascade engine & linker rule CRUD
│ ├── ContractService.php # Fixed-term contracts (6/12/24/36m), SHA-256 digital acceptance, ETF calculator, renewal scanner
│ ├── AnalyticsService.php # Reseller MRR, Contract CARR, leaderboard, 6-month margin series & sandbox seeder
│ ├── AdminController.php # 6-tab Admin dispatcher, CSRF-guarded AJAX API & CSV export
│ └── ClientController.php # Reseller Partner & Contracts Portal dispatcher with strict client ownership scoping
├── templates/
│ ├── admin/dashboard.php # 6-tab Admin dashboard + zero-CDN HDPI Canvas charts
│ └── client/portal.tpl # Smarty Reseller Branding, Sub-Accounts, API Key & Fixed-Term Contracts Portal
└── assets/
├── css/haikhavan_resellers_center.css # Scoped design system (.hk-rc-*)
└── js/haikhavan_resellers_center.js # Vanilla JS AJAX + HDPI HTML5 Canvas charts
2. Database Schema (mod_hk_reseller_*)
mod_hk_reseller_resellers: Multi-tier resellers (useridUNIQUE,tier,brand_name,brand_domain,brand_color,wholesale_discount_pct,default_markup_pct,billing_mode,wallet_balance,api_key_hash,api_key_prefix,status,end_clients_count,mrr_generated).mod_hk_reseller_pricing_rules: Per-reseller & tier wholesale/retail pricing catalog.mod_hk_reseller_subaccounts: Reseller end-customer sub-accounts (reseller_id,end_client_name,end_client_email,company,active_services,monthly_spend,status).mod_hk_reseller_payouts: Commission & payout statements (statement_numberUNIQUE,reseller_id,period_label,gross_sales,wholesale_cost,net_margin,commission_amount,payout_method,status,paid_at).mod_hk_reseller_product_links: Product Linker rules (parent_product_id,linked_product_id,link_type,sync_create/suspend/unsuspend/terminate,bundle_discount_pct,executions_count,enabled).mod_hk_reseller_contracts: Fixed-term recurring contracts (contract_numberUNIQUE,userid,service_id,service_label,term_months,monthly_value,etf_pct,auto_renew,status,start_date,end_date,accepted_at,accepted_ip,acceptance_hash).mod_hk_reseller_api_logs&mod_hk_reseller_audit_log: API access logs & compliance audit trail.
3. Security Model & White-Label REST API (api.php)
- Hashed API Keys: Reseller keys (
hk_rc_live_<32-hex>) are shown once upon promotion/rotation; only the SHA-256 hash (api_key_hash) and masked prefix are persisted. Incoming requests authenticate viaX-Reseller-KeyorAuthorization: Bearer <key>checked in constant time viahash_equals(). - Endpoints:
GET ?action=profile,GET ?action=products,GET ?action=clients,POST ?action=create_client,GET ?action=payouts. Missing or invalid keys return HTTP401. - CSRF & Client Isolation: Separate session CSRF tokens (
hk_rc_admin_csrf,hk_rc_client_csrf) enforced on all AJAX mutations (HTTP403on failure); contract acceptance and reseller mutations strictly verifyuserid == $_SESSION['uid']. - Formula-Safe CSV Exports: Payout CSV escapes leading
=,+,-,@characters to prevent spreadsheet formula injection. - Recursion Guard:
ProductLinkerService::$inProgressprevents circular parent-child provisioning loops.
4. WHMCS Hooks (hooks.php)
AfterModuleCreate,AfterModuleSuspend,AfterModuleUnsuspend,AfterModuleTerminate(Product Linker cascade)ClientAreaPrimaryNavbar,AdminClientProfileTabFields,AdminHomeWidgets,DailyCronJob(Contract renewal alerts & auto-renewal)