1.8 KiB
1.8 KiB
WHMCS usage billing (Phase F)
GameCloud aggregates immutable usage from usage_records and exposes WHMCS-compatible metrics.
Metrics
| Key | Source |
|---|---|
runtime_minutes |
Sum of metered runtime |
memory_gib_minutes |
RAM × runtime (GiB-minutes) |
cpu_core_minutes |
Runtime × plan CPU cores |
storage_gib_days |
Allocated disk × period days |
backup_storage_gib_days |
Completed backup sizes |
egress_gib |
Reserved (0 until metering) |
extra_port_days |
Reserved (0) |
priority_queue_minutes |
Queue priority weighted runtime |
managed_service_units |
Reserved (0) |
API
| Method | Path | Purpose |
|---|---|---|
GET |
/integrations/whmcs/services/:id/usage |
Period metrics + UsageUpdate values |
POST |
/integrations/whmcs/services/:id/usage/adjustments |
Post-export corrections |
Query parameters:
periodStart/periodEnd— ISO-8601 UTC (default: current UTC month)testMode=true— draft export, no billing event
Responses are idempotent per installation, service, period, and test mode. Each export stores a contentHash for audit.
Adjustments
Corrections never mutate historical raw usage_records. Submit metric deltas via the adjustments endpoint; the export status becomes ADJUSTED.
PHP module
hexagamecloud_MetricProvider()— returnsmetricsfor WHMCS usage metricshexagamecloud_UsageUpdate()— returnsdiskusageandbandwidthfor classic billing
Both call GET .../usage on GameCloud.
Test mode
Set testMode in the API query or enable test mode in the product config. Test exports use status DRAFT and do not emit usage_period_closed events.
Pricing
All prices remain in WHMCS. GameCloud only supplies measured quantities.