# Create a wallet
$ curl -X POST https://pay.prim.sh/v1/wallets \
-H "X-402-Payment: $TOKEN"
{ "id": "wal_m8x3k7", "balance": "0.00",
"deposit_ln": "lnbc...", "deposit_base": "0x..." }
# Fund it (deposit via Lightning or Base L2)
# ... send to deposit address ...
# Pay another agent's service
$ curl -X POST https://pay.prim.sh/v1/wallets/wal_m8x3k7/pay \
-H "X-402-Payment: $TOKEN" \
-d '{"to": "https://spawn.prim.sh/v1/instances",
"amount": "0.012"}'
# Create a charge (agent sells a service)
$ curl -X POST https://pay.prim.sh/v1/charges \
-H "X-402-Payment: $TOKEN" \
-d '{"amount": "0.05", "description": "API call",
"wallet": "wal_m8x3k7"}'
{ "id": "chg_k2m8x9", "payment_request": "lnbc50n1p...",
"status": "pending" }
Agent builds a service. Charges other agents via x402. Revenue goes to its pay.sh wallet. No Stripe, no bank account, no human in the loop.
Human funds a wallet with $50. Agent spends it across spawn.sh, relay.sh, ring.sh. Balance visible via API. Auto-stop when budget hits zero.
Agent earns money → splits revenue: 80% to human's wallet, 20% to operating reserve. Programmable finance.
Agent A hires Agent B. Funds locked in escrow. On delivery + verification, funds release. Trustless agent-to-agent contracting.
Pay $0.001 per API call. Pay $0.0001 per event. Lightning makes sub-cent payments viable. The unit economics of agent services.
Agent has a pay.sh wallet. Needs to call any x402 service on the internet. pay.sh handles the payment flow automatically. One wallet, every x402 service.
# Wallets
POST /v1/wallets # Create wallet
GET /v1/wallets # List wallets
GET /v1/wallets/:id # Balance + deposit addresses
GET /v1/wallets/:id/txns # Transaction history
# Spending
POST /v1/wallets/:id/pay # Pay an x402 endpoint
POST /v1/wallets/:id/send # Send to another wallet or address
POST /v1/wallets/:id/withdraw # Withdraw to external LN/L2
# Receiving
POST /v1/charges # Create payment request
GET /v1/charges/:id # Check payment status
# Escrow
POST /v1/escrow # Lock funds
POST /v1/escrow/:id/release # Release to recipient
POST /v1/escrow/:id/refund # Refund to sender
# Budget controls
PUT /v1/wallets/:id/limits # Set spend limits (per-hour, per-day)
| Action | Cost | Notes |
|---|---|---|
| Wallet | Free | No monthly fee |
| Deposit | Free | Lightning or Base L2 |
| x402 payment (outbound) | 0.5% | Of transaction amount |
| Charge (inbound) | 1.0% | Of received amount |
| Wallet-to-wallet | Free | Within pay.sh |
| Withdrawal | Network fee | Lightning or Base L2 |
| Escrow | 0.5% | On release |