One npm install. Full TypeScript support. Check subscriptions and gate features with middleware in any Node.js framework.
Start Free# Install
npm install paylio// Check subscription
const Paylio = require("paylio");
const paylio = new Paylio(process.env.PAYLIO_SECRET_KEY);
const sub = await paylio.getSubscription("user_123");
console.log(sub.status); // "active"
console.log(sub.plan.name); // "Pro"
console.log(sub.features); // { can_export: true, seats: 10 }// Express middleware
function requirePro(req, res, next) {
const sub = await paylio.getSubscription(req.user.id);
if (sub.status === "active" && sub.features.can_export) {
return next();
}
res.status(403).json({ error: "Upgrade to Pro" });
}
app.get("/api/export", requirePro, exportHandler);Run npm install paylio to add the Node.js SDK. It includes full TypeScript definitions and has zero runtime dependencies.
Create a Paylio instance with your secret key. Store the key in an environment variable and initialize once at app startup.
Call paylio.getSubscription(userId) to get the full subscription state including status, plan, billing period, and entitlements.
Create Express or Fastify middleware that checks entitlements before granting access to premium API routes.
Install the paylio npm package, initialize the client with your secret key, and call paylio.getSubscription(userId). It returns the subscription status, plan details, and entitlements. Use this data to gate features in your API routes.
Yes. The SDK is a standard Node.js package with no framework dependencies. It works with Express, Fastify, Koa, Hapi, or any Node.js HTTP framework. Import it and call the API from your route handlers or middleware.
Yes. The paylio package ships with full TypeScript definitions. All response types including Subscription, Plan, and Entitlement are fully typed. No @types package needed.
The subscription response includes a features object mapping entitlement keys to values. Check sub.features.can_export or sub.features.seats to gate functionality. Create middleware that runs this check before protected routes.
Free up to 100 subscribers. No credit card required.
Get Your API Key