Knowledge Base

Billing Flow Overview — From Hourly Sample to Invoice Line

This is the end-to-end picture of how a byte downloaded from a client's bucket becomes a line on their invoice. The details of each stage are in the Usage Billing Plugin and Package Setup & Pricing articles.

The flow

  1. Hourly collection — the cron samples every active storage service: egress/ingress counters straight from the storage server (MinIO/RustFS metrics), disk usage from Prometheus. Raw samples are stored as snapshots.
  2. Continuous rollup — after each pass, snapshots are aggregated into a per-bucket, per-month rollup: total egress, average storage (GiB-month), and — where billing is enabled — the billable overage and a money amount at the package's prices. Samples that cross a month boundary are split proportionally, so month totals are exact.
  3. Visibility — rollups are always visible: to staff on the S3 Usage pages, and to the client on their Usage tab (current + previous month, with the estimated amount). Nothing has been invoiced yet.
  4. Month closes — once a calendar month ends, its rollup is a closed month awaiting billing. Unbilled closed months keep recalculating with current package prices until they are invoiced.
  5. Invoice append — when Blesta generates an invoice that contains the storage service (typically the renewal invoice) and invoice integration is enabled, the plugin appends one line per unbilled closed month: egress overage and/or disk overage. The rollup is stamped with the invoice ID so it can never be billed twice.
  6. After billing — a billed rollup is frozen. If its numbers ever change afterwards (late data, price edits), it is flagged for admin review instead of being silently re-billed.

What stops a charge

A month is only billed when all of these hold — otherwise it stays visible but uninvoiced:

  • Plugin toggles ON (collection + the egress and/or disk calculation + invoice integration),
  • Package fields ON (Billing Per Use / Bill Unlimited Disk Usage) with a price set,
  • The rollup is not flagged "review required" (missing samples, quota conflicts, or post-billing changes always flag; flagged months wait for a human).

Rollout advice

Enable collection first and let it run for a while. Review the rollups and estimated amounts on the S3 Usage pages. Only then enable invoice integration — from that point, all unbilled closed months (including the ones you just reviewed) are appended to the next invoices.

Please rate this article to help us improve our Knowledge Base.

0 0