A production-quality reference implementation of Pincer’s x402-sponsored access flow.
pincer-x402-starter is an early-stage Python project in the AI payments / x402 ecosystem, focused on payment, solana, x402. It currently has 2 GitHub stars and 0 forks, and sits alongside related tools like solana-x402-payment, ag402, Agent402, magpie-x402, AgentFund, P-Link-MCP.
The standard implementation for Pincer's x402-sponsored access protocol.
This project demonstrates a complete, production-ready flow where content access acts as a lead generation mechanism for sponsors. Instead of users paying for content directly, sponsors subsidize the cost in exchange for high-intent leads, with settlement occurring on-chain.
Resources:
| Resource | Description |
|---|---|
| 🚀 Product Demo | Experience the Pincer protocol in action. |
| 📊 Pitch Deck | Overview of the vision and business model. |
| 📂 Audit Reports | Comprehensive security evaluation. |
| 📦 Pincer SDK | Official Python SDK on PyPI. |
| 📖 Human Docs | Integration guide for developers. |
| 🤖 Agent Skill | Protocol instructions for AI agents. |
| 📡 API Reference | Technical API |
The fastest way to get the demo running.
# Clone the repository
git clone https://github.com/pincerclaw/pincer-x402-starter.git
cd pincer-x402-starter
# Run the setup script (installs uv, dependencies, sets up virtualenv)
make setup
Copy the example environment file and add your wallet keys:
cp .env.example .env
nano .env
Required: Set
TREASURY_SVM_PRIVATE_KEY(Solana) orTREASURY_EVM_PRIVATE_KEY(Base) to enable real on-chain settlement. If left blank, the system runs in Simulation Mode.
For a full end-to-end flow, you need to run three separate services (Facilitator, Resource Server, Merchant Server).
The easiest way is to use our combined runner:
uv run scripts/run_all.py
In a new terminal window, run the agent to simulate a user requesting content:
make demo
How the components interact to deliver sponsored free access.
sequenceDiagram
participant User as Agent/User
participant Resource as Resource Server
participant Pincer as Pincer (Facilitator)
participant Merchant as Merchant (Sponsor)
Note over User, Resource: Phase 1: Access & Sponsorship
User->>Resource: 1. Request Content (GET /recommendations)
Resource-->>User: 402 Payment Required + Quote
User->>User: 2. Sign Payment Proof (Off-chain)
User->>Resource: 3. Resubmit with Proof
Resource->>Pincer: 4. Verify Payment Integrity
Pincer-->>Resource: Valid + Inject Sponsor Offers
Resource-->>User: 200 OK (Content + Sponsor Offers)
Note over User, Merchant: Phase 2: Conversion & Rebate
User->>Merchant: 5. Transact with Sponsor (using Session ID)
Merchant-->>User: Order Confirmed
Merchant->>Pincer: 6. Webhook: "Conversion Happened"
Pincer->>Pincer: 7. Validate Budget & Signature
Pincer->>User: 8. Send Rebate (On-chain Settlement)
src/resource/)Represents a premium API or content platform.
src/pincer/)The core infrastructure.
src/merchant/)Represents a sponsor's backend.
src/agent/)A reference implementation of a client utilizing the x402 protocol.
GET /recommendations
X-Correlation-Id (optional){
"restaurants": [...],
"sponsors": [
{
"sponsor_id": "camp-123",
"merchant_name": "Shake Shack",
"offer_text": "Free Fries with Burger",
"rebate_amount": 5.0,
"rebate_asset": "USDC",
"checkout_url": "http://.../checkout?session_id=..."
}
]
}
POST /webhooks/conversion
For merchants to report successful conversions.
X-Webhook-Signature (HMAC-SHA256){
"webhook_id": "wh-uuid",
"session_id": "sess-uuid",
"timestamp": "2024-01-01T12:00:00Z",
"user_address": "0x...",
"purchase_amount": 25.0,
"purchase_asset": "USD",
"merchant_id": "my-store"
}
Key environment variables in .env:
| Variable | Description |
|---|---|
PINCER_URL |
URL of the Pincer service (Required) |
RESOURCE_URL |
URL of the Resource server (Required) |
MERCHANT_URL |
URL of the Merchant server (Required) |
TREASURY_EVM_PRIVATE_KEY |
Private key for sending EVM rebates (Base) |
TREASURY_SVM_PRIVATE_KEY |
Private key for sending SVM rebates (Solana) |
WEBHOOK_SECRET |
Shared secret for signing merchant webhooks |
To verify that the entire system is properly configured and connected:
# Run the connectivity test script
uv run python scripts/test_payment.py
This script checks:
If you see errors related to TREASURY_SVM_PRIVATE_KEY, ensure you have generated a Solana wallet or set the keys in .env. By default, the system runs in Simulation Mode if keys are missing, but on-chain settlement requires them.
If you are running on Solana Devnet, you'll need test SOL for transactions. Use the Solana Faucet.
The demo uses ports 4021, 4022, and 4023. Ensure these ports are available on your machine.
Explore these standalone scripts to understand specific integrations:
Buyer Flow: examples/x402_buyer_flow.py
Resource Server: examples/x402_resource_integration.py
PincerPaymentMiddleware.Sponsor Reporting: examples/sponsor_integration.py
uv run python examples/sponsor_integration.py [session_id]x402 payment on solana
Zero latency! Zero code change! Empower your AI agent with payment ability via x402 protocol! (Openclaw, Claude code, Cursor, Langchain, CrewAI, AutoGen...)
500+ pay-per-call web tools + skill packs for AI agents — every one tested, priced, and settled on-chain. Paid in USDC over x402 on 8 chains, or free via proof-of-work on the pure-CPU tools. Self-hostable, MCP-native, deterministic. Plus the open x402 index (Find / Route / Leaderboard).
Collateral that can still sell itself — Magpie's x402 agent API: borrow SOL programmatically on Solana.
Fundraising infrastructure for AI agents on Solana — x402 payments, milestone escrow, on-chain reputation. REST + WebSocket + MCP + ACP.
x402 client implementation (x402-fetch), HTTP 402 server implementation and Model Context Protocol (MCP) for P-Link.io : pay, send and receive money with agents
Open Source AI trading agent that operates autonomously across 1000+ markets - Polymarket, Kalshi, Binance, Hyperliquid, Solana DEXs, 5 EVM chains. Scans for edge, executes instantly, manages risk while you sleep. Agent commerce protocol for machine-to-machine payments. Self-hosted. Built on Claude.
DePIN for Vintage Hardware — Proof-of-Antiquity blockchain where old machines outmine new ones. AI-powered hardware fingerprinting, 15+ CPU architectures, Solana bridge (wRTC). $0 VC.
Drop-in OpenAI Python client with transparent x402 payment support.
Client SDK for the Vybe x402 API. Pay-per-call USDC over HTTP and prepaid-credit WebSocket streaming for Vybe's Solana analytics API. Built for AI agents.
Drop-in OpenAI Typescript client with transparent x402 payment support.
Autonomous AI BD Agent for SolCex Exchange: 24/7 Cross-Chain Token Scoring & Payments 2026