Wallet-native x402 (HTTP 402) + agent marketplace + prepaid balance + budgets/subscriptions.
- Software-first payments: APIs/agents pay each other per call using an x402-style 402 challenge.
- Payment modes:
- Subscription credits: pay once per period, receive call credits, auto-renew when due.
- Prepaid: deposit once (or dev-credit locally), then debit per call.
- Per-call receipt: submit an on-chain tx hash as payment proof.
- Flash (optimistic): sign an EIP-712 payment promise off-chain for instant access; settle later in batches.
- AutoPayOS concepts, web-first: budgets, allowlists, subscription-style recurring spend limits.
- Create Supabase tables: run supabase/schema.sql in your Supabase SQL editor.
- Copy
.env.example→.env.localand fill Supabase vars. - Install and run:
npm install npm run dev
Open:
/marketplaceto browse agents/agents/consoleto run paid calls end-to-end/settingsto set spend policies and subscriptions
NEXT_PUBLIC_SUPABASE_URL: requiredNEXT_PUBLIC_SUPABASE_ANON_KEY(orNEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY): required (browser-safe)SUPABASE_SERVICE_ROLE_KEY: recommended (server-only). If you omit it, server routes fall back to anon/publishable key and will only work if your Supabase tables allow anon writes (e.g., RLS disabled for hackathon).
NEXT_PUBLIC_RPC_URL: required only for per-call tx receipt verificationNEXT_PUBLIC_PAYMENT_CONTRACT_ADDRESS: if set, per-call tx receipts are required to send to this addressNEXT_PUBLIC_MERCHANT_ADDRESS: optional default recipient for agents (not required for prepaid/subscriptions)AFX402_OPS_KEY(orAF_X402_DEV_ADMIN_KEY): protects ops endpoints likePOST /api/ops/flash/settle(send headerx-ops-key).FLASH_SETTLEMENT_KEY: protects the public batch settlement endpointPOST /api/payments/flash/settle(send headerx-flash-settlement-key).
The settlement contract address is not predetermined — it becomes “public/global” only after you deploy it to the target chain (default: Monad Testnet). Once deployed, everyone can use the same address.
- Install deps:
npm install- Set a deployer key (do NOT commit it):
SETTLEMENT_DEPLOYER_PRIVATE_KEY(recommended)- Ensure the deployer wallet has testnet MON for gas.
- Deploy:
npm run deploy:settlementThis prints the deployed address and also updates .env.local with NEXT_PUBLIC_SETTLEMENT_CONTRACT_ADDRESS=... if the file exists.
Where to set it for a global/public app (e.g. Vercel):
- Add
NEXT_PUBLIC_SETTLEMENT_CONTRACT_ADDRESSin your hosting provider’s Project Environment Variables. - Redeploy so the client bundle gets the updated value.
Tip: You can sanity-check compilation without deploying with:
npm run deploy:settlement -- --dry-runAI agents use Gemini via Google AI Studio:
GOOGLE_GEMINI_API_KEY(server-only)- Optional:
GOOGLE_GEMINI_MODEL(defaults togemini-2.5-flash)
The repository includes a small TypeScript client in sdk/index.ts. It signs wallet-proof messages, calls the APIs, and can automatically satisfy HTTP 402 using a flash payment promise when supported.
- Example script: scripts/sdk-example.mjs
No user accounts API key required: wallet address + signature is the identity.