VetoVetoDocs
Getting Started

Test mode

Run the entire acceptance gate offline with the mock rail — no chain, no network, no install — so you can test policy decisions deterministically.

The mock rail makes the whole flow runnable offline. It does structural validation only and always "captures" successfully, so you can exercise the acceptance gate — caps, rate limits, mandate requirements, reputation, intent — deterministically in tests and demos, without a chain or any external service.

rails defaults to [x402, mock] when you omit it, so mock is available out of the box. Pass rail: 'mock' when creating a session to use it.

Drive the gate directly

gate.test.ts
import { createCheckout, STRICT } from '@veto-protocol/checkout';

const checkout = createCheckout({
  merchant: { id: 'acme', name: 'Acme', domain: 'shop.acme.example' },
  catalog: [{ sku: 'pro', name: 'Pro plan', price: { amount: '49.00', currency: 'USD' }, available: true }],
  receiving: { mock: { account: 'acct_test' } },
  policy: STRICT(), // requires a mandate for ANY spend → expect a rejection with no mandate
});

const created = await checkout.createSession({
  agent_id: '11111111-1111-1111-1111-111111111111',
  items: [{ sku: 'pro', qty: 1 }],
  rail: 'mock',
});

const settled = await checkout.settle(created.body.session_id, { payment: { mock: true } });
// STRICT requires a mandate over $0 → rejected
console.log(settled.status);        // 'rejected'
console.log(settled.body.reason_codes); // ['MANDATE_REQUIRED'] (and/or REPUTATION_TOO_LOW)

What mock does and does not do

mockx402
Runs the full acceptance gate
Issues a signed merchant receipt
Requires a chain / wallet
Captures real funds✅ (via injected facilitator)

Mock never moves money — never use it as a production rail. It exists to make the gate testable. For real settlement, see Go live with x402 + CDP.

Run the bundled example pair

The example pack ships a stub merchant and a buyer agent you can run with no install:

npm run stub   # node --experimental-strip-types examples/stub-merchant/server.ts
npm run buy    # node --experimental-strip-types examples/buyer-agent/buy.ts