Get started

Feature

Humans free. Agents pay — with HTTP 402.

Mark a route as priced and Wayleave answers agents with 402 Payment Required and an x402-shaped challenge. Your human users never see a paywall, and Wayleave takes 0% of payments.

How pricing works

  • Set pricedPaths, e.g. { '/api/premium': 0.05 } for 5¢ per call.
  • Agents get a 402 challenge; humans pass through free.
  • Payment is confirmed by your verifyPayment function (a Coinbase x402 facilitator is included).
  • Use gate.express() or gate.handleAsync() so settlement can be awaited.
  • Turn on strictPricedPaths so only verified agents or confirmed humans cross.

Build the 402 body

gate.paymentRequirements(req) returns the same spec-shaped entry the /.well-known/x402 manifest advertises, so the two cannot disagree about the price.

Price a route for agents

import Wayleave from 'wayleave';
import { coinbaseFacilitator } from 'wayleave/x402';

const gate = new Wayleave({
  rules: {
    verified_agent: [['/api/admin', false], ['/api', true]],
    suspected_bot:  [['/api', false]],
  },
  rateLimits: { declared_agent: 10 },
  pricedPaths: { '/api/premium': 0.05 }, // agents pay 5¢/call, humans free
  strictPricedPaths: true,
  verifyPayment: coinbaseFacilitator({ /* your keys */ }),
});
app.use(gate.express());

Questions

Does Wayleave hold my funds?

No. Payments are confirmed by the payment verifier you configure; Wayleave takes 0%.

Related

Identify. Control. Monetize.

Humans browse free. Agents pay their way.