Socket
Book a DemoInstallSign in
Socket

stakefy-express

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stakefy-express

Express middleware for Stakefy x402 - Drop-in paywalls with 10x lower fees than competitors

latest
Source
npmnpm
Version
2.0.0
Version published
Maintainers
1
Created
Source

stakefy-express

NPM Version License: MIT

Express middleware for Stakefy x402 payments. Add payment requirements to your API in 3 lines of code.

🏠 Main Documentation: github.com/JaspSoe/stakefy-x402

📦 Stakefy Ecosystem

This is part of the complete Stakefy payment infrastructure:

PackageDescriptionNPM
x402-stakefy-sdkCore SDKnpm
x402-stakefy-reactReact hooksnpm
stakefy-expressExpress middleware (this package)npm

🚀 Quick Start

npm install stakefy-express x402-stakefy-sdk express
import express from 'express';
import { stakefyPaywall } from 'stakefy-express';

const app = express();

// Protected endpoint - requires 0.01 SOL payment
app.get('/api/premium', 
  stakefyPaywall({ 
    amount: 0.01, 
    merchantId: 'YOUR_MERCHANT_WALLET'
  }),
  (req, res) => {
    res.json({ data: 'premium content' });
  }
);

app.listen(3000);

✨ Features

  • 3-line integration - Add paywalls instantly
  • HTTP 402 compliant - Standard payment required responses
  • Session budgets - Multiple API calls per payment
  • TypeScript support - Full type safety
  • Error handling - Built-in error handling
  • Flexible - Per-endpoint or global middleware

🎯 Examples

API Metering

app.get('/api/ai/generate', 
  stakefyPaywall({ amount: 0.001, merchantId: 'xxx' }),
  async (req, res) => {
    const result = await generateAI(req.body.prompt);
    res.json({ result });
  }
);

Session Budget

// Pay once, make multiple calls
app.use('/api/metered', 
  stakefyBudget({
    budget: 0.1,
    duration: 3600,
    merchantId: 'xxx'
  })
);

Global Middleware

// Apply to all routes
app.use('/api/v2', 
  stakefyPaywall({ amount: 0.005, merchantId: 'xxx' })
);

📖 Full Documentation

For complete documentation, API reference, and more examples:

👉 Complete Documentation

Includes:

  • Complete API reference
  • Advanced examples
  • Client integration
  • Error handling
  • Best practices

📄 License

MIT © Stakefy

Keywords

x402

FAQs

Package last updated on 03 Nov 2025

Did you know?

Socket

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.

Install

Related posts