
Company News
AWS Security Hub Adds Socket for Supply Chain Security
Socket is now in the AWS Security Hub Extended plan. Adopt it through AWS, apply committed spend, and block malicious open source packages.
@payweave/express
Advanced tools
Express middleware for PayWeave - accept per-request USD micropayments on any Express route.
Express middleware for PayWeave - accept per-request USD micropayments on any Express route.
npm install @payweave/express
import { Payweave } from '@payweave/express';
import express from 'express';
const app = express();
const payweave = new Payweave(
process.env.PAYWEAVE_APP_ID!,
process.env.PAYWEAVE_APP_SECRET!
);
app.get(
'/api/weather',
payweave.charge({ price: '0.001', description: 'Weather API' }),
(req, res) => {
res.json({ temp: 72, unit: 'F' });
}
);
app.listen(3000);
new Payweave(appId, appSecret, baseUrl?)| Parameter | Type | Description |
|---|---|---|
appId | string | Your app key ID |
appSecret | string | Your app secret |
baseUrl | string? | API base URL (defaults to https://api.payweave.app) |
payweave.charge(options)Returns Express middleware (req, res, next) => Promise<void>.
| Option | Type | Description |
|---|---|---|
price | string | (req) => string | Promise<string> | USD price per request |
description | string? | Human-readable description |
meta | Record<string, string>? | API metadata for agent discovery |
app.get(
'/api/search',
payweave.charge({ price: '0.01' }),
(req, res) => {
res.json({ results: [] });
}
);
app.post(
'/api/generate',
payweave.charge({
price: (req) => req.body.premium ? '0.05' : '0.01',
description: 'Text generation API',
}),
(req, res) => {
res.json({ text: 'generated content' });
}
);
app.post(
'/api/sentiment',
payweave.charge({
price: '0.005',
description: 'Sentiment analysis',
meta: {
'method': 'POST',
'input.content-type': 'application/json',
'input.schema': '{"type":"object","properties":{"text":{"type":"string"}}}',
'output.schema': '{"type":"object","properties":{"score":{"type":"number"}}}',
},
}),
(req, res) => {
res.json({ score: 0.85 });
}
);
app.get('/api/weather', payweave.charge({ price: '0.001' }), weatherHandler);
app.get('/api/forecast', payweave.charge({ price: '0.005' }), forecastHandler);
app.post('/api/analyze', payweave.charge({ price: '0.01' }), analyzeHandler);
402 Payment Required and a WWW-Authenticate header containing pricingAuthorization: Payment <credential>Payment-Receipt headerMIT
FAQs
Express middleware for PayWeave - accept per-request USD micropayments on any Express route.
We found that @payweave/express demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket is now in the AWS Security Hub Extended plan. Adopt it through AWS, apply committed spend, and block malicious open source packages.

Research
/Security News
Popular npm packages keyv and cacheable compromised.

Security News
A misconfiguration gave three Anthropic models internet access, and one, believing it was in a simulation, shipped a credential-stealing package to PyPI.