PostHog / PostHog/posthog

feat(billing): generic usage submission webhook for marketplace billing providers

Open
#57,484 0 comments 0 reactions 1 assignee View on GitHub

@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

  1. Daily cron for active customers with a billing_provider set.
  2. 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 }
      ]
    }
    
  3. Optional per provider — partners that don't need live usage can disable submission via their provider config; the cron skips them.
  4. 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.