Skip to main content

Demo Store

A live demo merchant store paywalled with Crumb. Use it to test agent payments, browser wallet flows, or as a reference for building your own.

Live URL: crumb-merchant-demo.vercel.app

Available Endpoints

EndpointMethodPriceDescription
/api/servicesGETFreeService discovery — returns all endpoints and prices
/api/jokeGET$0.001Get a random programming joke
/api/searchPOST$0.001Search for information
/api/premium-factGET$0.01Get a premium curated fact

Try it with the SDK

1. Install

npm install crumb-alpha-sdk

2. Discover available services (free)

const res = await fetch('https://crumb-merchant-demo.vercel.app/api/services')
const services = await res.json()

console.log(services.endpoints)
// [
// { path: '/api/joke', method: 'GET', price: '$0.001', ... },
// { path: '/api/search', method: 'POST', price: '$0.001', ... },
// { path: '/api/premium-fact', method: 'GET', price: '$0.01', ... },
// ]

3. Pay for a resource

import { Crumb } from 'crumb-alpha-sdk'

const crumb = new Crumb({ privateKey: process.env.PRIVATE_KEY })

// Buy a joke
const joke = await crumb.fetch('https://crumb-merchant-demo.vercel.app/api/joke', {
method: 'GET',
maxPayment: 10000,
})

console.log(joke.data) // { joke: "Why do programmers..." }
console.log(joke.formattedAmount) // "0.001"
console.log(joke.txHash) // settlement tx hash

// Search (POST with body)
const search = await crumb.fetch('https://crumb-merchant-demo.vercel.app/api/search', {
method: 'POST',
body: { query: 'blockchain payments' },
maxPayment: 10000,
})

console.log(search.data)
// { query: "blockchain payments", results: [...] }

// Premium fact (higher price)
const fact = await crumb.fetch('https://crumb-merchant-demo.vercel.app/api/premium-fact', {
method: 'GET',
maxPayment: 100000,
})

console.log(fact.data) // { fact: "Honey never spoils...", tier: "premium" }

How it works

  1. Your agent calls a paywalled endpoint
  2. The server responds with 402 Payment Required and a PAYMENT-REQUIRED header containing payment options (networks, amounts, seller address)
  3. The Crumb SDK automatically signs an EIP-712 payment authorization and retries the request with a Payment-Signature header
  4. The server verifies the payment via Circle Gateway and returns the content
  5. Settlement happens through Circle's batched payment system — gasless for the buyer

Browser wallet flow

Visit crumb-merchant-demo.vercel.app and connect MetaMask to try the browser flow. Click "Buy" on any endpoint to:

  1. Trigger a 402 response
  2. Sign an EIP-712 TransferWithAuthorization in your wallet (no gas)
  3. Receive the paid content

Your wallet must be on a supported network and have USDC deposited in Circle Gateway.

Build your own

See the Merchant Setup guide to create your own paywalled API. The server code is minimal:

import express from 'express'
import { createProvider } from 'crumb-alpha-sdk'

const app = express()
app.use(express.json())

const provider = createProvider({
sellerAddress: '0xYOUR_WALLET_ADDRESS',
})

// Free endpoint for service discovery
app.get('/api/services', (req, res) => {
res.json({
name: 'My Store',
endpoints: [
{ path: '/api/resource', method: 'GET', price: '$0.01' },
],
})
})

// Paywalled endpoint
app.get('/api/resource', provider.require('$0.01'), (req, res) => {
res.json({ data: 'premium content' })
})

app.listen(3001)