Skip to content

Automate vendor billing on the hosted platform - #1

Open
adityaaa-IIT-BHU wants to merge 3 commits into
mainfrom
claude/more-work-needed-t5sp46
Open

Automate vendor billing on the hosted platform#1
adityaaa-IIT-BHU wants to merge 3 commits into
mainfrom
claude/more-work-needed-t5sp46

Conversation

@adityaaa-IIT-BHU

Copy link
Copy Markdown
Owner

keymaker cloud can now charge vendors for the agent traffic it serves,
closing the next roadmap milestone:

  • billing-init --platform creates the platform Stripe meter + metered
    price and writes /cloud.config.json in one command
  • POST /v1/tenants (with billing_email) creates a Stripe customer for
    the vendor and subscribes them to the metered price; the response
    carries billing: { customer_id, subscription_id, metered_event }, and
    a Stripe failure never blocks provisioning
  • every metered agent call on a tenant (hosted /mcp + verify) emits a
    platform meter event against the vendor's customer via a new onMeter
    hook on keymakerGateway, so usage becomes monthly vendor invoices
  • provisioned tenants now set meter_at_gateway: their upstreams aren't
    keymaker-protected, so the gateway is the only place hosted MCP calls
    could be counted (dashboard usage was silently 0 for /mcp before)
  • landing form asks for a billing email when billing is on; dashboard
    shows the vendor's customer + subscription

Covered by four new tests (mock Stripe + mock upstream); docs updated
in HOSTING.md and the README roadmap.

Co-Authored-By: Claude Fable 5 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_017UDRyxKdTxgMNJaGthzkjN

claude added 3 commits July 31, 2026 14:27
keymaker cloud can now charge vendors for the agent traffic it serves,
closing the next roadmap milestone:

- billing-init --platform creates the platform Stripe meter + metered
  price and writes <data>/cloud.config.json in one command
- POST /v1/tenants (with billing_email) creates a Stripe customer for
  the vendor and subscribes them to the metered price; the response
  carries billing: { customer_id, subscription_id, metered_event }, and
  a Stripe failure never blocks provisioning
- every metered agent call on a tenant (hosted /mcp + verify) emits a
  platform meter event against the vendor's customer via a new onMeter
  hook on keymakerGateway, so usage becomes monthly vendor invoices
- provisioned tenants now set meter_at_gateway: their upstreams aren't
  keymaker-protected, so the gateway is the only place hosted MCP calls
  could be counted (dashboard usage was silently 0 for /mcp before)
- landing form asks for a billing email when billing is on; dashboard
  shows the vendor's customer + subscription

Covered by four new tests (mock Stripe + mock upstream); docs updated
in HOSTING.md and the README roadmap.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017UDRyxKdTxgMNJaGthzkjN
…ed invoices

Close the revenue loop on keymaker cloud. Vendor billing previously
created a subscription with no payment method on file — invoices could
never collect. Now it's the standard self-serve SaaS funnel:

- provisioning puts every vendor on a FREE plan (Stripe customer, no
  card): free_calls_per_month metered calls, tracked per tenant in
  platform.json with serialized writes
- past the cap, hosted POST /mcp answers 402 Payment Required with an
  upgrade link; discovery, signup, and verify stay open
- GET/POST /t/<id>/upgrade (admin-token gated) mints a Stripe Checkout
  session — card on file + metered subscription; once paid it becomes a
  billing-portal redirect instead
- POST /v1/stripe/webhook (signature-verified, timing-safe, 5-min
  tolerance) flips the plan: checkout.session.completed → metered,
  customer.subscription.deleted → back to free
- meter events only fire for metered-plan tenants, so free traffic is
  counted but never billed
- billing-init --platform gains --free-calls, writes the cap into
  cloud.config.json, and prints the webhook setup steps
- dashboard shows plan + monthly usage + the right billing link; the
  landing form's provision output shows the plan

Vendor billing tests rewritten around the funnel (8 tests: free
provision, cap → 402, checkout, webhook upgrade + metering, churn back
to free, bad signature, billing off, Stripe failure). 37 tests passing.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017UDRyxKdTxgMNJaGthzkjN
…unch kit

- startCloud resolved publicUrl from the requested port before listen, so
  port 0 advertised http://localhost:0 URLs; resolve after bind instead
- fly.toml and render.yaml now carry the STRIPE_SECRET_KEY /
  STRIPE_WEBHOOK_SECRET wiring needed for vendor billing in production
- docs/launch-kit.md: go-live checklist, pricing defaults, channel plan,
  Show HN + social drafts, and a personalized outreach table built from
  the 2026-07-28 agent-readiness scan

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017UDRyxKdTxgMNJaGthzkjN
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants