Hybrid x402 + Stripe gateway for AI agent commerce.
Agents pay USDC via x402. Spraay executes multi-chain DeFi operations. Stripe settles the fiat equivalent into the merchant's dashboard — with tax, reporting, refunds, and fraud protection built in.
Agent (wallet) Merchant
│ │
│ 1. POST /batch-payment │
│ 2. x402: pay $0.01 USDC │
│ │
▼ │
┌────────────────────┐ │
│ x402 Middleware │ │
│ (verify payment) │ │
└────────┬───────────┘ │
│ │
▼ │
┌────────────────────┐ │
│ Spraay Gateway │ │
│ (on-chain exec) │ │
│ 13 chains, 76+ │ │
│ DeFi primitives │ │
└────────┬───────────┘ │
│ │
▼ ▼
┌────────────────────┐ ┌──────────────────┐
│ Base / Ethereum │ │ Stripe Dashboard │
│ Solana / Bitcoin │ │ PaymentIntent │
│ + 9 more chains │ │ Tax · Refunds │
└────────────────────┘ │ Reporting · API │
└──────────────────┘
AI agents need to pay for services. The internet has two payment rails:
- Crypto (x402) — instant, global, no accounts, perfect for agents
- Fiat (Stripe) — tax compliant, enterprise-ready, merchants already use it
This hybrid gateway bridges both. The agent pays crypto. The merchant sees fiat. Everyone's happy.
git clone https://github.com/plagtech/spraay-stripe-machine-payments.git
cd spraay-stripe-machine-payments
npm install
cp .env.example .env
# Fill in PAY_TO_ADDRESS and STRIPE_SECRET_KEY
npm run dev| Method | Path | x402 Price | What happens |
|---|---|---|---|
POST |
/batch-payment |
$0.01 USDC | Spraay sends tokens to multiple recipients → Stripe records fiat |
POST |
/payroll |
$0.05 USDC | Spraay runs crypto payroll → Stripe creates invoice record |
POST |
/ai/inference |
$0.03 USDC | Spraay calls AI model (43+ providers) → Stripe tracks usage |
POST |
/rtp/task |
$0.05 USDC | Spraay hires a robot via RTP → Stripe records the transaction |
GET |
/discover |
Free | Returns full endpoint catalog and architecture info |
curl http://localhost:4021/discoverReturns endpoint catalog, pricing, supported chains, and Stripe integration details.
import { withPaymentInterceptor } from "@x402/axios";
import axios from "axios";
const api = withPaymentInterceptor(
axios.create({ baseURL: "http://localhost:4021" }),
walletClient // agent's wallet
);
// Agent pays $0.01 USDC → Spraay batch sends → Stripe records
const result = await api.post("/batch-payment", {
chain: "base",
token: "USDC",
recipients: ["0xAlice...", "0xBob...", "0xCharlie..."],
amounts: ["10.00", "25.00", "15.00"],
});{
"txHash": "0xabc123...",
"recipients": 3,
"totalAmount": "50.00",
"chain": "base",
"stripe": {
"stripe_payment_intent_id": "pi_3abc123...",
"stripe_status": "requires_capture"
}
}The PaymentIntent shows up in the merchant's Stripe Dashboard with:
- Amount in USD
- Metadata (chain, number of recipients, Spraay endpoint)
- Full tax calculation, refund, and reporting tooling
PAY_TO_ADDRESS=0xYourAddress
STRIPE_SECRET_KEY=sk_test_...
NETWORK=eip155:84532
FACILITATOR_URL=https://x402.org/facilitatorPAY_TO_ADDRESS=0xYourAddress
STRIPE_SECRET_KEY=sk_live_...
NETWORK=eip155:8453
FACILITATOR_URL=https://api.cdp.coinbase.com/platform/v2/x402Stripe machine payments must be enabled for your account — request access here.
Spraay is a multi-chain batch payment protocol and x402 gateway. It provides 76+ paid API endpoints across 16 categories and 13 blockchains:
- Batch Payments — send tokens to hundreds of recipients in one tx
- Payroll — recurring crypto payroll
- Token Swaps — DEX routing across chains
- Bridge — cross-chain asset transfers
- AI Inference — 43+ models via BlockRun
- Robot Task Protocol (RTP) — hire robots for physical tasks
- Agent Wallets — managed wallets for AI agents
- Escrow, Staking, NFTs, Governance, Oracle, ENS — and more
Live gateway: gateway.spraay.app · Docs: docs.spraay.app · MCP Server: @plagtech/spraay-x402-mcp
Stripe's machine payments support lets merchants accept payments from AI agents. Combined with Spraay:
- Agent side: pays USDC via x402 (no account, no API key, no subscription)
- Merchant side: sees every payment in Stripe Dashboard (USD, with tax/reporting)
- Execution: Spraay handles the actual DeFi operation on-chain
This is the "best of both worlds" — crypto speed for agents, fiat compliance for businesses.
- coinbase/x402 — The x402 protocol
- Stripe Machine Payments — Stripe's agent payment docs
- Spraay Gateway — Live API (76+ endpoints)
- Spraay MCP Server — 60+ tools for AI agents
- Spraay Docs — Full endpoint reference
MIT