feat(billing): generic usage submission webhook for marketplace billing providers
Open
@MattBro is already working on this.
Since May 4, 2026.
enhancement
- Dominant language
- Python
- Stars
- 39.9k
- Forks
- 3.4k
- Avg merge
- 6h 51m
- Merged PRs (30d)
- 232
Description
Problem
Marketplace partners that want to show real-time usage to their users in their own UI need PostHog to submit projected period usage on a daily cadence. Today this is hardcoded for Vercel. Generalize so any partner with Customer.billing_provider set gets routed through their MarketplaceBillingProviderClient.submit_usage().
What needs to happen
- Daily cron for active customers with a
billing_providerset. - Normalized usage payload — generic shape, lifted from Vercel's, that all providers receive:
{ "timestamp": "...", "eod": "...", "period": { "start": "...", "end": "..." }, "billing": [ /* line items projected for current period */ ], "usage": [ { "name": "Events", "type": "total", "units": "events", "dayValue": 0, "periodValue": 0 } ] } - Optional per provider — partners that don't need live usage can disable submission via their provider config; the cron skips them.
- Retry semantics on partner-API outage — softer than invoices (a missed daily push isn't critical) but observable.
Reference
- Existing Vercel implementation:
billing/billing_providers/clients/vercel.py:submit_usage - Existing formatter:
billing/billing_providers/formatters/vercel.py
Parent
Part of #57482.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.