Add blockchain micropayments to any API in 10 lines of code.
The Zynapse Payment SDK makes it quick and easy to build an excellent payment experience for your API-based and usage-based digital products. We provide powerful integration tools that handle Solana micropayments, with plans for advanced features like multi-party payment splitting, privacy-preserving transactions, and multi-coin acceptance.
Charge per API call on chain of your choice with automatic multi-party revenue splitting.
This SDK enables x402 micropayments for APIs. Protect any endpoint with on-chain payments that automatically split across multiple wallets.
Use Cases:
- API monetization (AI, data, compute)
- Usage-based billing ($0.001 - $10 per call)
- Autonomous agent payments (bots paying bots)
- Multi-stakeholder revenue splits (creator/referrer/platform/DAO)
Key Features:
- ✅ x402 protocol (HTTP 402 Payment Required)
- ✅ Automatic payment splitting across wallets
- ✅ TEE-secured payment verification
- ✅ Autonomous payment agents
- ✅ Multi-chain (Solana, Base, Ethereum soon)
Install:
pnpm install @zynapse/node @solana/web3.js dotenvSetup (5 minutes): Create .env:
MERCHANT_SOL_ADDRESS=your_solana_pubkey
SOLANA_RPC_URL=https://api.devnet.solana.comCreate server.js:
import express from 'express';
import { initSolanaPaywall } from '@zynapse/node';
import { LAMPORTS_PER_SOL } from '@solana/web3.js';
const app = express();
app.use(express.json());
// Protect your endpoint
initSolanaPaywall({
app,
path: '/api/inference',
payTo: process.env.MERCHANT_SOL_ADDRESS,
priceLamports: Math.floor(0.01 * LAMPORTS_PER_SOL), // 0.01 SOL
rpcUrl: process.env.SOLANA_RPC_URL,
});
// Your API logic (runs after payment verified)
app.post('/api/inference', async (req, res) => {
const result = await yourLogic(req.body);
res.json({ ok: true, result });
});
app.listen(4060, () => console.log('✅ Paid API running'));Run:
node server.jsTest:
curl -X POST http://localhost:4060/api/inference \
-d '{"input": "test"}' \
-H "Content-Type: application/json"Response: 402 Payment Required 🎉 Done! Your API now requires payment.
Automatically split revenue across multiple wallets:
initSolanaPaywall({
app,
path: '/api/inference',
payTo: ESCROW_ADDRESS,
priceLamports: Math.floor(0.01 * LAMPORTS_PER_SOL),
rpcUrl: SOLANA_RPC_URL,
splits: [
{ address: CREATOR_WALLET, percent: 60 }, // Creator
{ address: REFERRER_WALLET, percent: 20 }, // Affiliate
{ address: PLATFORM_WALLET, percent: 10 }, // Platform fee
{ address: LIQUIDITY_POOL, percent: 10 } // Token buyback
]
});Use Cases:
- Affiliate commissions
- Platform fees
- DAO funding
- Token buyback mechanisms
🎯 Examples
- Client → POST /api/endpoint
- Server → 402 Payment Required (if no payment)
- Client → Pay on Solana/Base blockchain
- Client → Retry with payment proof header
- Server → Verify on-chain & execute
- (Optional) Split payment across wallets
| Network | Status | Use Case |
|---|---|---|
| Solana Devnet | ✅ Live | Testing |
| Solana Mainnet | 🚧 Q4 2025 | Production |
| Base Sepolia | ✅ Live | Testing |
| Base Mainnet | 🚧 Q4 2025 | Production |
| Ethereum | 🚧 Q1 2026 | Production |
AI Inference:
initSolanaPaywall({
app,
path: '/api/inference',
payTo: MERCHANT_WALLET,
priceLamports: Math.floor(0.01 * LAMPORTS_PER_SOL),
rpcUrl: SOLANA_RPC_URL,
});
app.post('/api/inference', async (req, res) => {
const result = await callAIModel(req.body.prompt);
res.json({ ok: true, result });
});Autonomous Agent:
import { createSolanaAutonomousFetch } from '@zynapse/node';
const { fetchWithPayment } = createSolanaAutonomousFetch({
secretKey: process.env.AGENT_WALLET_SECRET,
rpcUrl: SOLANA_RPC_URL
});
// Agent automatically handles payment
const response = await fetchWithPayment('https://api.example.com/paid');See examples/ for complete working code.
-
Zynapse Multichain (this example) is your canonical template.
-
All logic routes through a single, reusable server.mjs:
- Products in, paid endpoints out.
-
The Admin widget is your no-code/low-code layer to define products.
-
The Solana Pixtral widget is a concrete consumer showing autonomous wallet-powered access.
-
To support any new API:
- Define a product.
- Add a backend implementation branch in registerHandlerForProduct.
- Reuse the same paywall + config pattern.
This structure is intentionally small and hackathon-friendly, while mapping cleanly to how you’d build a reusable paid-API platform in production.
Current
- ✅ TEE‑first key lifecycle (generate, seal, sign in‑enclave)
- ✅ Paywalls (402/x402) for API endpoints
- ✅ Single‑destination settlement → one primary vault/wallet
- ✅ Any‑asset → preferred asset (limited) via facilitator; settle SOL/USDC
- ✅ Examples: Solana devnet paywall; Base‑Sepolia x402 + Pixtral demo
- ✅ Splits + Scheduler: Multi-recipient revenue splits with hourly/daily/threshold payouts, all enforced inside the TEE.
Future Scope
- Develop client side widgit and dashboard to make it easier for users to integrate and maange
- Adding template and examples to make onboarding easier for enterprises
- Node.js 23+
- Express.js 4.x+
- Solana wallet for receiving payments
- Email: [email protected]
- Docs: https://docs.zkagi.ai
Apache 2.0

