Veyto

Hosted payment example

One governed payment against a hosted Veyto sandbox — agent, guardrails, a real Base Sepolia settlement, a signed receipt, and a deliberate Blocked.

It boots no Veyto backend. Veyto is a URL.

bash
npm install
export VEYTO_API_URL=https://sandbox.veyto.io
export VEYTO_API_KEY=…                 # your Veyto sandbox key
export VEYTO_PAYER_PRIVATE_KEY=0x…     # a THROWAWAY Base Sepolia key, funded with test USDC
npm run pay

Fund the key at faucet.circle.com (choose Base Sepolia). You do not need ETH — the facilitator submits the transaction and pays the gas. You sign.

⚠️ Use a throwaway key. Your key stays in this process and Veyto never receives it, but there is no reason to point a key with real value at a testnet demo.

Dependencies

@veyto/sdk and viem are what an integration needs. express is only for the little x402 test merchant in merchant.mjs — in real use you pay somebody else's endpoint and you do not need it.

What it proves

  1. your API key authenticates against the hosted API;
  2. an agent is created and given guardrails;
  3. payingFetch runs the whole flow;
  4. Veyto returns unsigned EIP-3009 material and your process signs it;
  5. USDC moves from your address on Base Sepolia;
  6. a signed receipt comes back carrying its policy_digest;
  7. a second payment is Blocked by the daily cap, with no money moved.

Options

variabledefault
VEYTO_PAYEE_ADDRESSa fresh throwaway address
VEYTO_FACILITATOR_URLhttps://x402.org/facilitator
VEYTO_RPC_URLhttps://sepolia.base.org
VEYTO_AMOUNT_MINOR10000 ($0.01)
VEYTO_MERCHANT_PORT4081

If your deployment sits behind an edge gateway that authenticates callers, set CF_ACCESS_CLIENT_ID and CF_ACCESS_CLIENT_SECRET; with a public edge they are unused.

The source

filewhat it is
pay.mjsthe example itself — agent, guardrails, payment, Blocked, receipt
merchant.mjsa throwaway x402 endpoint to pay, so the example needs nobody else
package.jsonthe three dependencies

Save the three into a directory and run them exactly as above.