Spraay Payments 💧
Multi-chain batch crypto payments, payroll, swaps, price feeds, invoices, and AI inference — all through one API.
Spraay is a protocol for sending crypto to multiple wallets in a single transaction. The x402 gateway exposes 57 paid endpoints and 5 free endpoints. Every paid call costs a micropayment via the x402 HTTP payment protocol. Free endpoints require no payment.
Setup
The gateway is live at https://gateway.spraay.app. Set your env:
CODEBLOCK0
No API key needed. Payments are made per-request via x402 (HTTP 402 → pay → retry). Your agent's wallet handles this automatically if you have a Coinbase CDP wallet or any x402-compatible facilitator.
Supported Chains
Base, Ethereum, Arbitrum, Polygon, BNB Chain, Avalanche, Solana, Unichain, Plasma, BOB, Bittensor.
Payment contract (Base): INLINECODE1
Core Workflows
1. Batch Payments (the main use case)
Send tokens to multiple wallets in one transaction.
CODEBLOCK1
If you get HTTP 402, the response contains payment instructions. Pay the facilitator, then retry with the payment proof header.
2. Token Prices
CODEBLOCK2
Returns current USD price. Works for any major token symbol.
3. Token Balances
CODEBLOCK3
4. Token Swaps
CODEBLOCK4
5. ENS / Basename Resolution
CODEBLOCK5
Resolves ENS names and Base names to addresses.
6. Invoices
CODEBLOCK6
7. AI Chat Inference
CODEBLOCK7
Powered by OpenRouter. Pay-per-query via x402.
8. Payroll
CODEBLOCK8
ENS and Basename addresses resolve automatically.
Communication Endpoints (Paid)
Email
CODEBLOCK9
XMTP Messaging
CODEBLOCK10
Webhooks
CODEBLOCK11
Infrastructure Endpoints (Paid)
RPC Relay (7 chains via Alchemy)
CODEBLOCK12
IPFS Upload (via Pinata)
CODEBLOCK13
Free Endpoints (No Payment Required)
These 5 endpoints work without x402 payment:
- -
GET /api/price?symbol=ETH — Token prices - INLINECODE3 — ENS/Basename resolution
- INLINECODE4 — Gateway health check
- INLINECODE5 — List supported chains
- INLINECODE6 — List all available endpoints
x402 Payment Flow
- 1. Call any paid endpoint
- Receive HTTP 402 with payment details (amount, facilitator address, token)
- Send micropayment to the facilitator
- Retry the original request with the
X-PAYMENT header containing payment proof - Receive your response
Typical cost per call: fractions of a cent in USDC on Base.
Error Handling
- -
402 — Payment required. Follow the payment instructions in the response body. - INLINECODE9 — Bad request. Check your parameters.
- INLINECODE10 — Endpoint not found.
- INLINECODE11 — Server error. Retry after a moment.
Always check the HTTP status code before processing the response body.
Tips
- - Batch payments save 60-80% on gas vs individual transfers.
- Use the free
/api/price endpoint to calculate USD values before sending. - Resolve ENS/Basenames before batching to validate all addresses.
- Chain defaults to "base" if not specified.
- Token defaults to "USDC" if not specified.
- The gateway supports any ERC-20 token plus native ETH.
Links
- - App: https://spraay.app
- Gateway: https://gateway.spraay.app
- Docs: https://docs.spraay.app
- GitHub: https://github.com/plagtech
- Twitter: https://twitter.com/Spraay_app
- MCP Server: https://smithery.ai/server/@plagtech/spraay-x402-mcp
Spraay Payments 💧
多链批量加密支付、薪资发放、兑换、价格源、发票和AI推理——全部通过一个API实现。
Spraay是一个通过单笔交易向多个钱包发送加密货币的协议。x402网关提供57个付费端点和5个免费端点。每次付费调用通过x402 HTTP支付协议产生微支付。免费端点无需支付。
设置
网关地址为 https://gateway.spraay.app。设置环境变量:
bash
export SPRAAYGATEWAYURL=https://gateway.spraay.app
无需API密钥。通过x402(HTTP 402 → 支付 → 重试)按请求付费。如果你有Coinbase CDP钱包或任何兼容x402的促进器,你的代理钱包会自动处理。
支持的链
Base、以太坊、Arbitrum、Polygon、BNB Chain、Avalanche、Solana、Unichain、Plasma、BOB、Bittensor。
支付合约(Base):0x1646452F98E36A3c9Cfc3eDD8868221E207B5eEC
核心工作流
1. 批量支付(主要用例)
在一笔交易中向多个钱包发送代币。
bash
curl -X POST $SPRAAYGATEWAYURL/api/batch-payment \
-H Content-Type: application/json \
-d {
recipients: [
{address: 0xABC...123, amount: 10},
{address: 0xDEF...456, amount: 25},
{address: 0xGHI...789, amount: 15}
],
token: USDC,
chain: base
}
如果收到HTTP 402,响应中包含支付说明。向促进器支付,然后使用支付证明头重试。
2. 代币价格
bash
免费端点——无需x402支付
curl $SPRAAY
GATEWAYURL/api/price?symbol=ETH
返回当前美元价格。适用于任何主要代币符号。
3. 代币余额
bash
curl $SPRAAYGATEWAYURL/api/balance?address=0xABC...&chain=base
4. 代币兑换
bash
curl -X POST $SPRAAYGATEWAYURL/api/swap-quote \
-H Content-Type: application/json \
-d {
tokenIn: ETH,
tokenOut: USDC,
amount: 1.0,
chain: base
}
5. ENS / Basename解析
bash
免费端点
curl $SPRAAY
GATEWAYURL/api/resolve?name=vitalik.eth
将ENS名称和Base名称解析为地址。
6. 发票
bash
curl -X POST $SPRAAYGATEWAYURL/api/create-invoice \
-H Content-Type: application/json \
-d {
recipient: 0xABC...123,
amount: 500,
token: USDC,
chain: base,
memo: 三月咨询发票
}
7. AI聊天推理
bash
curl -X POST $SPRAAYGATEWAYURL/api/ai/chat \
-H Content-Type: application/json \
-d {
message: 解释DeFi流动性挖矿,
model: openrouter/auto
}
由OpenRouter提供支持。通过x402按查询付费。
8. 薪资发放
bash
curl -X POST $SPRAAYGATEWAYURL/api/batch-payment \
-H Content-Type: application/json \
-d {
recipients: [
{address: alice.eth, amount: 3000},
{address: bob.base, amount: 2500},
{address: 0xCCC...999, amount: 4000}
],
token: USDC,
chain: base,
memo: 2026年3月薪资
}
ENS和Basename地址会自动解析。
通信端点(付费)
电子邮件
bash
curl -X POST $SPRAAY
GATEWAYURL/api/email/send \
-H Content-Type: application/json \
-d {
to: team@company.com,
subject: 支付确认,
body: 已在Base上向12个收款人发送了50,000 USDC的批量支付。
}
XMTP消息
bash
curl -X POST $SPRAAY
GATEWAYURL/api/xmtp/send \
-H Content-Type: application/json \
-d {
to: 0xRecipient...,
message: 您500 USDC的付款已通过Spraay发送。
}
Webhooks
bash
curl -X POST $SPRAAY
GATEWAYURL/api/webhook/send \
-H Content-Type: application/json \
-d {
url: https://your-app.com/webhook,
payload: {event: payment_complete, txHash: 0x...}
}
基础设施端点(付费)
RPC中继(通过Alchemy支持7条链)
bash
curl -X POST $SPRAAY
GATEWAYURL/api/rpc/relay \
-H Content-Type: application/json \
-d {
chain: base,
method: eth_blockNumber,
params: []
}
IPFS上传(通过Pinata)
bash
curl -X POST $SPRAAY
GATEWAYURL/api/ipfs/pin \
-H Content-Type: application/json \
-d {
content: 来自Spraay的问候!,
name: my-file.txt
}
免费端点(无需支付)
这5个端点无需x402支付即可使用:
- - GET /api/price?symbol=ETH — 代币价格
- GET /api/resolve?name=vitalik.eth — ENS/Basename解析
- GET /api/health — 网关健康检查
- GET /api/chains — 列出支持的链
- GET /api/endpoints — 列出所有可用端点
x402支付流程
- 1. 调用任意付费端点
- 收到HTTP 402响应,包含支付详情(金额、促进器地址、代币)
- 向促进器发送微支付
- 使用包含支付证明的X-PAYMENT头重试原始请求
- 收到响应
每次调用的典型成本:Base上USDC的几分之一美分。
错误处理
- - 402 — 需要支付。按照响应体中的支付说明操作。
- 400 — 错误请求。检查参数。
- 404 — 端点未找到。
- 500 — 服务器错误。稍后重试。
在处理响应体之前,始终检查HTTP状态码。
提示
- - 批量支付相比单独转账可节省60-80%的Gas费。
- 使用免费的/api/price端点在发送前计算美元价值。
- 在批量处理前解析ENS/Basename以验证所有地址。
- 如果未指定,链默认为base。
- 如果未指定,代币默认为USDC。
- 网关支持任何ERC-20代币以及原生ETH。
链接
- - 应用:https://spraay.app
- 网关:https://gateway.spraay.app
- 文档:https://docs.spraay.app
- GitHub:https://github.com/plagtech
- Twitter:https://twitter.com/Spraay_app
- MCP服务器:https://smithery.ai/server/@plagtech/spraay-x402-mcp