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
| Endpoint | Method | Price | Description |
|---|---|---|---|
/api/services | GET | Free | Service discovery — returns all endpoints and prices |
/api/joke | GET | $0.001 | Get a random programming joke |
/api/search | POST | $0.001 | Search for information |
/api/premium-fact | GET | $0.01 | Get 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
- Your agent calls a paywalled endpoint
- The server responds with
402 Payment Requiredand aPAYMENT-REQUIREDheader containing payment options (networks, amounts, seller address) - The Crumb SDK automatically signs an EIP-712 payment authorization and retries the request with a
Payment-Signatureheader - The server verifies the payment via Circle Gateway and returns the content
- 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:
- Trigger a
402response - Sign an EIP-712
TransferWithAuthorizationin your wallet (no gas) - 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)