MPP API
Monetize your API with micropayments via the Machine Payments Protocol
MPP API Status
Protocol: MPP (Tempo)
Endpoints
| Method | Path | Type | Price | Description |
|---|---|---|---|---|
| GET | /health | Free | - | Service health check |
| GET | /api/plans | Charge | $0.01 | List all active plans |
| POST | /api/chargeable | Session | $0.02 | Filter chargeable subscriptions |
| GET | /api/plans/stream | Session | $0.005/plan | Stream plan data via SSE |
Quick Start
1. Configure environment variables
# .env MPP_SECRET=your_mpp_secret_key MPP_BASE_URL=http://localhost:4020 CRON_RPC_URL=https://rpc.base.org CRON_CONTRACT_ADDRESS=0x...
2. Start the server
npm run start # Server running on http://localhost:4020
3. Test an endpoint
npx mppx http://localhost:4020/api/plans
CronAgent Integration
Configure your CronAgent with MPP endpoints for automated micropayment collection.
import { CronAgent } from "@cron/sdk";
const agent = new CronAgent({
rpcUrl: process.env.CRON_RPC_URL,
contractAddress: process.env.CRON_CONTRACT_ADDRESS,
mpp: {
secret: process.env.MPP_SECRET,
baseUrl: process.env.MPP_BASE_URL,
endpoints: [
{ path: "/api/plans", type: "charge", price: 0.01 },
{ path: "/api/chargeable", type: "session", price: 0.02 },
{ path: "/api/plans/stream", type: "session", price: 0.005 },
],
},
});
await agent.start();