{"id":50523238,"url":"https://github.com/ds1/pincerpay-agent-demo","last_synced_at":"2026-06-03T06:04:11.820Z","repository":{"id":339245063,"uuid":"1160599190","full_name":"ds1/pincerpay-agent-demo","owner":"ds1","description":"Interactive demo: AI agents paying for APIs with x402 + PincerPay","archived":false,"fork":false,"pushed_at":"2026-02-18T21:21:20.000Z","size":60,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-02-18T22:07:21.896Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://pincerpay-agent-demo.vercel.app","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ds1.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-18T06:16:16.000Z","updated_at":"2026-02-18T21:21:23.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/ds1/pincerpay-agent-demo","commit_stats":null,"previous_names":["ds1/pincerpay-agent-demo"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/ds1/pincerpay-agent-demo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ds1%2Fpincerpay-agent-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ds1%2Fpincerpay-agent-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ds1%2Fpincerpay-agent-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ds1%2Fpincerpay-agent-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ds1","download_url":"https://codeload.github.com/ds1/pincerpay-agent-demo/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ds1%2Fpincerpay-agent-demo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33850652,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-03T02:00:06.370Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-06-03T06:04:09.549Z","updated_at":"2026-06-03T06:04:11.812Z","avatar_url":"https://github.com/ds1.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PincerPay Agent Demo\n\n**[demo.pincerpay.com](https://demo.pincerpay.com)**\n\nInteractive playground and CLI demo showing the **agent developer experience** — what it looks like for an AI agent to discover, pay for, and consume a paid API using the [x402 protocol](https://github.com/coinbase/x402) and [PincerPay](https://pincerpay.com).\n\n## Why This Exists\n\nThe merchant side of PincerPay has a full dashboard, onboarding wizard, and docs. But the other half of the story — **\"I'm building an AI agent that needs to call a paid API, what does that look like?\"** — didn't have a clear answer. This demo fills that gap with:\n\n- A **web playground** where you can simulate the full x402 payment flow step-by-step\n- A **CLI walkthrough** that shows the same flow in the terminal\n- A **landing page** that explains the value prop in 30 seconds\n\nIt runs entirely in simulation mode by default — no wallet, no devnet tokens, no facilitator needed. Just `npm install \u0026\u0026 npm run dev`.\n\n## Quick Start\n\n```bash\nnpm install\nnpm run dev\n```\n\nOpen [http://localhost:3000](http://localhost:3000) and click **Open Playground**, or try the [Guided Demo](https://demo.pincerpay.com/playground?tour=1) to walk through the full flow with narration.\n\n## What the Demo Shows\n\n### The x402 Payment Flow\n\nEvery API request follows this 6-step flow, animated in real time:\n\n```\n1. Agent sends HTTP request       →  GET /api/weather\n2. Server returns 402 challenge   →  \"Pay 0.001 USDC on Solana\"\n3. Agent signs payment             →  Wallet authorizes USDC transfer\n4. Facilitator verifies signature  →  Checks payment proof is valid\n5. Payment settles on-chain        →  USDC transferred, tx confirmed\n6. Data delivered                  →  Agent receives API response\n```\n\nThe key insight: **the agent's code is just `agent.fetch(url)`** — PincerPay handles the 402 challenge, payment signing, and retry automatically under the hood.\n\n### Spending Policies\n\nAgents don't have unlimited wallets. The demo shows how spending policies work:\n\n- **Per-request limit**: Agent refuses to pay more than X USDC for a single request\n- **Daily budget**: Agent tracks cumulative spend and stops when the budget is exhausted\n- **Error handling**: When a request exceeds policy, the flow stops at step 3 with a clear error\n\nTry it: set max per request to 0.001 USDC, then try to call `/api/premium-analytics` (0.10 USDC).\n\n### Mock Merchant Endpoints\n\n| Endpoint | Price | What It Returns |\n|----------|-------|-----------------|\n| `GET /api/weather` | 0.001 USDC | Weather data (city, temp, forecast) |\n| `GET /api/market-data` | 0.01 USDC | Crypto prices (BTC, ETH, SOL) |\n| `GET /api/research` | 0.05 USDC | AI research summary with sources |\n| `GET /api/premium-analytics` | 0.10 USDC | Analytics dashboard data |\n\nThese span 2 orders of magnitude in price to show micropayments ($0.001) through small payments ($0.10).\n\n## Demo Modes\n\n### Simulation (default)\n\nNo real crypto, no funded wallet, no facilitator. A simulation engine generates realistic flow steps with timing, fake Solana addresses, and fake transaction hashes. Works completely offline.\n\n### Live (`DEMO_MODE=live`)\n\nReal `@pincerpay/agent` SDK calling a real Express merchant server, with actual on-chain USDC settlement on Solana devnet.\n\n```bash\ncp .env.example .env.local\n# Fill in AGENT_SOLANA_KEY, MERCHANT_ADDRESS, FACILITATOR_URL\nDEMO_MODE=live npm run dev:live\n```\n\n## CLI Demo\n\nTerminal-based walkthrough with spinners and colored output:\n\n```bash\n# Interactive — choose endpoints one at a time\nnpm run demo:cli\n\n# Run all 4 endpoints sequentially\nnpm run demo:cli -- --all\n```\n\n## Talking Points\n\nUse these when demoing PincerPay or presenting the agent payment story.\n\n### The Problem\n\n\u003e \"AI agents are great at calling APIs. But when those APIs cost money, there's no good way for an agent to pay. Today you either pre-purchase credits, hardcode API keys with billing attached, or build custom payment logic per provider. None of these scale to a world where agents call hundreds of different paid APIs autonomously.\"\n\n### The x402 Solution\n\n\u003e \"x402 turns payments into an HTTP-native concern. When an agent hits a paid endpoint, the server returns HTTP 402 — the same status code the web has reserved for payments since 1999 but never used. The 402 response includes exactly what to pay: amount, token, chain, and where to send it. The agent signs the payment, attaches proof, and retries. The server verifies and delivers the data.\"\n\n\u003e \"This is like how 401 Unauthorized works for auth — but for money. The agent doesn't need to know anything about the merchant's billing system. It just needs a wallet.\"\n\n### Why PincerPay\n\n\u003e \"PincerPay is the infrastructure that makes x402 work in production. Three pieces:\"\n\u003e\n\u003e 1. **Merchant SDK** — One middleware to add x402 pricing to any API endpoint. `app.get('/api/weather', pay('0.001'), handler)`.\n\u003e 2. **Agent SDK** — One wrapper around fetch. `agent.fetch(url)` handles 402 challenges automatically.\n\u003e 3. **Facilitator** — Verifies payment signatures and settles on-chain. Merchants don't touch crypto directly.\n\n### Why Not Cards?\n\n\u003e \"Card rails charge ~3% per transaction and settle in 1-3 days. For a $0.001 micropayment, the fee would be 30x the payment itself. USDC on Solana settles in 400ms for fractions of a cent. And there's no PCI compliance burden — no card numbers, no sensitive data.\"\n\n### The Spending Policy Story\n\n\u003e \"Agents with wallets need guardrails. PincerPay's agent SDK enforces spending policies — per-request caps and daily budgets — before the agent ever signs a payment. If a malicious API tries to charge $100 for weather data, the agent just says no. This is how you give an agent a credit card without giving it an unlimited credit card.\"\n\n### The Bigger Picture\n\n\u003e \"We think agent-to-agent payments are a trillion-dollar infrastructure layer. Today it's agents paying for APIs. Tomorrow it's agents hiring other agents, agents bidding on compute, agents settling contracts — all with instant USDC settlement, no human in the loop. PincerPay is the payment rail for that economy.\"\n\n## Project Structure\n\n```\n├── src/\n│   ├── app/\n│   │   ├── page.tsx                 # Landing page\n│   │   └── playground/\n│   │       ├── page.tsx             # Interactive playground\n│   │       └── actions.ts           # Server action (sim or live)\n│   ├── components/\n│   │   ├── agent-config.tsx         # Wallet + spending policy config\n│   │   ├── endpoint-picker.tsx      # API endpoint browser\n│   │   ├── flow-visualizer.tsx      # Step-by-step flow animation\n│   │   ├── response-panel.tsx       # API response display\n│   │   └── spend-tracker.tsx        # Budget usage tracker\n│   └── lib/\n│       ├── types.ts                 # Shared TypeScript types\n│       ├── demo-endpoints.ts        # Mock endpoint definitions\n│       ├── simulate.ts              # Simulation engine\n│       └── execute-live.ts          # Live mode execution\n├── server/\n│   └── merchant.ts                  # Express merchant (live mode)\n├── cli/\n│   └── demo.ts                      # CLI demo script\n└── package.json\n```\n\n## Tech Stack\n\n- **Next.js 15** + Tailwind CSS v4 + TypeScript\n- **Simulation engine** — Async step generator with realistic timing\n- **chalk** + **ora** for CLI output\n- **@pincerpay/agent** + **@pincerpay/merchant** (optional, for live mode)\n\n## How PincerPay Works\n\nPincerPay is an on-chain payment gateway for the agentic economy built on the **x402 protocol** (by Coinbase, 5,400+ GitHub stars).\n\n**For merchants**: Add a middleware to your API. One line per endpoint sets the price. PincerPay handles verification and settlement.\n\n```typescript\napp.get(\"/api/weather\", pay(\"0.001\"), (req, res) =\u003e {\n  res.json({ temp: 68, conditions: \"Sunny\" });\n});\n```\n\n**For agents**: Wrap your fetch. PincerPay handles 402 challenges, payment signing, and retry.\n\n```typescript\nconst agent = await PincerPayAgent.create({\n  chains: [\"solana\"],\n  solanaPrivateKey: process.env.AGENT_SOLANA_KEY,\n});\n\nconst data = await agent.fetch(\"https://api.example.com/weather\");\n```\n\n**Settlement**: USDC on Solana (primary), Base, or Polygon. No card rails. No 3% fees. Instant finality.\n\n## Links\n\n- [Live Demo](https://demo.pincerpay.com) — Try the playground and guided tour\n- [PincerPay](https://pincerpay.com) — Main project + merchant dashboard\n- [x402 Protocol](https://github.com/coinbase/x402) — HTTP 402 payment standard by Coinbase\n- [Solana](https://solana.com) — Primary settlement chain\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fds1%2Fpincerpay-agent-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fds1%2Fpincerpay-agent-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fds1%2Fpincerpay-agent-demo/lists"}