VetoVetoDocs
SDK · CLI · MCP

createCheckout()

The SDK's front door. Resolves a sparse merchant config into a fully-defaulted checkout handle whose methods map 1:1 to the wire endpoints and MCP tools.

createCheckout(config) is the one call a merchant makes. It resolves a sparse CheckoutConfig into a fully-defaulted handle — minting a receipt-signing key if you didn't supply one, wiring the default in-memory store, and defaulting the rails to [x402, mock].

import { createCheckout, BALANCED } from '@veto-protocol/checkout';

const checkout = createCheckout({
  merchant: { id: 'acme', name: 'Acme Corp', domain: 'shop.acme.example' },
  catalog: [
    { sku: 'widget', name: 'Blue Widget', price: { amount: '12.50', currency: 'USD' }, available: true },
  ],
  receiving: { x402: { chain: 'base', address: '0xYourAddress', asset: 'USDC' } },
  policy: BALANCED(),
});

The handle

Every method maps 1:1 to a wire endpoint (and to an MCP tool):

MethodEndpoint
manifest()GET /.well-known/agentic-checkout.json
catalog()GET /agent/catalog
createSession(body)POST /agent/checkout
settle(id, body)POST /agent/checkout/{id}/settle
getSession(id)GET /agent/checkout/{id}
verifyReceipt(jws)offline receipt verification
receiptPublicJwk() / receiptJwks()the published verifying key

CheckoutConfig

FieldNotes
merchant{ id, name, domain }.
catalogA CatalogItem[] or a (possibly async) function for dynamic inventory.
receivingNon-custodial per-rail destinations — your address.
policyA MerchantPolicy (start from a preset).
railsDefaults to [x402, mock] when omitted.
storeA SessionStore; defaults to in-memory MemoryStore.
trustedIssuers{ veto: { jwksUrl?, jwks? } } for mandate verification.
receiptSigningKeySeedB64base64 32-byte Ed25519 seed; autogenerated if absent.
sessionTtlSecondsDefault 900.
taxRateDefault 0.
intentMatcherOptional (intent, cart) => 0..1 score for intent policy.
onEventOptional fire-and-forget terminal telemetry hook.

Hosted and self-hosted merchants run the identical SDK — only the store differs. Use loadCheckoutConfig() to compile persisted rows into the exact CheckoutConfig the handle consumes.