The Real Problem
Data providers selling financial metrics, real-time analytics, or specialized search indexes are forced into monthly subscription plans. Machine-to-machine buyers wanting a single lookup bounce due to high upfront costs.
Real-World Example: For example, a financial intelligence API could charge $0.05 per stock ticker balance-sheet lookup, allowing machine clients to pay per query.
How aipp Solves It
Integrate aipp 402 middleware into your data API server. When a client requests a data lookup, your server issues an HTTP 402 challenge. Once paid, the server executes the DB lookup and returns data.
Step-by-Step Payment Flow
STEP 01
Data Query
Client submits request (e.g. GET /api/data?ticker=AAPL).
STEP 02
402 Invoice
API returns HTTP 402 challenge with invoice.
STEP 03
Payment Settlement
Client settles invoice.
STEP 04
Dataset Returned
Server verifies payment proof and returns JSON data.
Scope & Boundaries
What aipp Does
- ✓ Allows data API providers to require micro-payments per request
- ✓ Supports WebLN browser payments and machine agent auto-pay
- ✓ Auto-forwards net earnings to merchant wallet
What aipp Does Not Do
- ✗ Does not supply weather, financial, market, or proprietary datasets
- ✗ Does not host dataset databases
Implementation Pattern
Below is the minimal implementation pattern using standard aipp endpoints / SDK:
app.get('/api/data/ticker/:symbol', l402Paywall({
client: aipp,
amountUsd: 0.05
}), async (req, res) => {
const data = await db.getTickerData(req.params.symbol);
res.json({ data });
});
Settlement Architecture Note:
• Lightning Rail: In hosted Lightning flows, payments route through aipp's Lightning gateway before net proceeds are automatically forwarded to your configured wallet address.
• Base USDC Rail: USDC transfers settle directly on-chain to your designated EVM wallet address.
• No Merchant Spending Balance: aipp does not maintain a spendable merchant balance or require manual withdrawal steps.
Requirements & Limitations
- aipp is the payment and verification layer; merchant supplies the dataset
- Funds auto-forward to merchant wallet according to threshold settings
Frequently Asked Questions
Can I set different prices for different dataset tiers?
Yes. Your API handler specifies the exact USD amount for each endpoint when initializing the paywall middleware.
Related Use Cases
Implement Paid Data API with aipp
Read the developer documentation or generate your API key to gate requests behind Lightning and Base USDC payments.