Homie Dev Docs

Payments & monetization

Marketplace flows use offchain credits for checkout UX, settlement in USDh (USDhome), and x402-style payment headers for fine-grained pricing. Fee policy is governance-adjustable; protocol economics are defined in instructions/whitepaper-v2.md (§9–10). Display values below mirror src/constants/economics.ts.

Credits → USDh settlement

Users spend credits quickly; settlements and treasury routing are denominated in USDh. Orchestration checks user credit balance, may create a reservation, and attaches payment headers when invoking a paid agent (genkit/tools/a2aClient.ts).

Protocol marketplace commission (whitepaper §10.3)

Tiered marketplace commission in USDh (governance-adjustable). Constants: base 12%.

  • Trailing 30-day volume per agent: <$50,000/mo → 12%; $50,000–$250,000/mo → 8%; >$250,000/mo → 5%
  • 0% for free agents

Treasury routing (whitepaper §10.2)

Monthly cycle (conceptual): 60% buyback / 40% USDh to stakers; of HOAM bought, 70% burn / 30% to stakers. See whitepaper for full policy text.

Shipped service fee

The fee base is the posted service price: a positive price_per_action, or a positive pricing_amount when price per action is not positive. A price of 0 is a 0% fee. The fee is not applied to a sale price, loan amount, or insurance premium.

When that price is positive and revenue_share_percentage is null or 0, the platform fee is 12%. A stored positive revenue_share_percentage stays as stored. Call reservation, the developer dashboard, per-agent analytics, payout claim, and scripts/settle-x402-transactions.ts use that same helper. Unpaid claims use this rate. A call that already has a settlement_id is not paid again.

The whitepaper 8% and 5% volume tiers above are not charged. There is no top-agent bonus.

x402 / HTTP 402

Micropayment flows can use HTTP 402-style responses and x402 headers. The marketplace integration also generates an X-PAYMENT authorization header after reserving credits.

typescript
// Homie may attach X-PAYMENT after reserving credits (see genkit/tools/a2aClient.ts).
// Your route can still enforce HTTP 402 for explicit paywalls if your product
// uses the x402 pattern alongside the marketplace flow.

import { NextRequest, NextResponse } from "next/server";

export async function POST(request: NextRequest) {
  const payment = request.headers.get("x-payment");
  if (!payment) {
    return new NextResponse(
      JSON.stringify({ error: "Payment required" }),
      {
        status: 402,
        headers: { "Content-Type": "application/json" },
      }
    );
  }
  return NextResponse.json({ ok: true });
}

Developer payouts (canonical flow)

  1. End-user credits: users hold USDhome credits (offchain balance in users.credit_balance) for fast checkout.
  2. Paid agent call: orchestration may reserve credits and attach X-PAYMENT when invoking a priced agent (genkit/tools/a2aClient.ts).
  3. Settlement: protocol intent is USDh-denominated settlement and treasury routing per whitepaper §9–10. This app's per-call path takes the shipped service fee above from the posted service price. Volume tiers are not charged.
  4. Developer visibility: list agents via Marketplace APIs. GET /api/marketplace/developer/dashboard/payments returns recorded revenue plus pending and settled payout totals for the signed-in developer.
  5. Wallet: register a Base-compatible wallet on the agent for settlement destinations as required by your listing flow.

Claim: POST /api/marketplace/developer/payouts/claim is authenticated as the developer. The server uses SETTLEMENT_PRIVATE_KEY to call facilitator settle() and push USDh only to that developer's marketplace_agents.wallet_address values. Only unsettled credit_history agent_call rows older than 7 days are included, and those rows receive a settlement_id. The settlement wallet must already hold the USDh. This does not call withdrawFromX402 or treasury claimDistribution.