Docs
Private x402, in minutes.
Ring402 speaks standard x402 on Solana with a shielded scheme. If you know x402, you know Ring402.
The flow
| Step | What happens |
|---|---|
| 1. Ask | The agent calls a paid route and gets a 402 with the price in accepts. |
| 2. Sign | The agent signs a one time authorization with its own Ed25519 key. |
| 3. Retry | The agent sends the same request with the X-PAYMENT header. |
| 4. Seal | Ring402 verifies it and settles a private transfer inside a Privacy Ring. |
| 5. Serve | The route returns the data with an X-PAYMENT-RESPONSE header. |
Open an agent vault
POST https://ring402.cash/v1/agents
{ "publicKey": "your agent public key" }
You get a deposit address. Fund it with SOL or USDC and it moves into the agent's private balance.
Sign a payment
import { buildPayment, encodeHeader } from './x402.js'
const res = await fetch(url)
const { accepts } = await res.json()
const payment = buildPayment(accepts[0], agentSecretKey)
const paid = await fetch(url, { headers: { 'X-PAYMENT': encodeHeader(payment) } })
Charge for a route
app.get('/signal',
paywall({ merchantId: 'm_yourid', price: '0.01', asset: 'USDC' }),
(req, res) => res.json(signal()))
Routes
| Route | Use |
|---|---|
| GET /supported | Schemes and assets Ring402 settles. |
| POST /verify | Check a payment against its requirements. |
| POST /settle | Verify and settle a payment privately. |
| POST /v1/agents | Open an agent vault. |
| GET /v1/agents/:key | Deposit address and private balance. |
| POST /v1/merchants | Add an API and get a merchant ID and secret. |
| POST /v1/merchants/:id/withdraw | Withdraw earnings to any Solana address. |
Payment payload
{
"x402Version": 1,
"scheme": "shielded",
"network": "solana",
"payload": {
"authorization": { "from", "to", "asset", "value", "validAfter", "validBefore", "nonce", "resource" },
"signature": "base58 Ed25519 signature"
}
}