How It Works
- Agent sends a request without a payment proof
- Gateway checks for a PayStream session credit — if available, debit and proceed
- If no session, returns HTTP 402 with payment options (one per chain per facilitator)
- Agent selects a chain, pays USDC on-chain, retries with proof header
X-Payment-Proofcarries the tx hash;X-Payment-Chainspecifies the chain- SpentProofsStore prevents replay (10-minute TTL)
- Facilitator verifies the payment
- If overpayment occurs, excess becomes PayStream session credit
Supported Chains
Using @lucid-fdn/pay
The@lucid-fdn/pay package provides a drop-in fetch() wrapper that auto-handles 402 responses:
.png?fit=max&auto=format&n=VsjUqn6fLqEhBiuI&q=85&s=8b4c7e6431e9a6af1ef23b77bb4ff5fd)
.png?fit=max&auto=format&n=VsjUqn6fLqEhBiuI&q=85&s=d5651a45e4bfbabc33f74e146af3f94a)