Vendor quickstart

Turn an API endpoint into an agent-payable product.

Pyrimid lets agents discover your endpoint through MCP/catalog surfaces, pay in USDC on Base, and route affiliate commissions without you building checkout, attribution, or settlement logic.

Mental model

Agent requests paid endpoint → endpoint requires x402 payment → buyer pays USDC through PyrimidRouter → Router splits protocol fee, affiliate commission, and vendor share → endpoint returns result.

1. Register vendor

Create a vendor record pointing to your service and payout address.

PyrimidRegistry.registerVendor(
  name,
  baseUrl,
  payoutAddress
)

2. List product

Define endpoint, USDC price, and affiliate commission bps. Example: 2000 = 20% affiliate share.

PyrimidCatalog.listProduct(
  vendorId,
  productId,
  endpoint,
  description,
  priceUsdc,
  affiliateBps
)

3. Gate the endpoint

Target DX for an Express-style API route. Keep your hosting; Pyrimid adds payment + attribution.

import { pyrimidGate } from '@pyrimid/sdk';

app.post('/paid/run', pyrimidGate({
  vendorId: '0x...',
  productId: 1,
  priceUsdc: 100000, // $0.10
}), async (req, res) => {
  const output = await runService(req.body);
  res.json(output);
});

4. Route payment

Buyer approves USDC, then the Router settles vendor, affiliate, and protocol in one call.

PyrimidRouter.routePayment(
  vendorId,
  productId,
  affiliateId,
  buyer,
  maxPrice
)

Minimal verification

  1. Product appears in /api/v1/catalog.
  2. Payment emits PaymentRouted on Base.
  3. /api/v1/stats increments.
  4. Vendor receives USDC.
  5. Treasury receives the 1% protocol fee.

Current example product

Vendor: Receipts
Product: onchain_0xcdef72_1
Endpoint: https://api.leoclaw.cc/analyze
Price: $0.10 USDC
Affiliate commission: 2000 bps