Define plans in code. Gate features. Track usage. Webhooks handled for you.
Website · Docs · Discord · Twitter
PayKit is an embedded billing framework for TypeScript apps. It sits inside your app, uses your database, and gives you a single API to manage products, subscriptions, entitlements, and usage billing without touching provider dashboards.
import{createPayKit,feature,plan}from"paykitjs";constmessages=feature({id: "messages",type: "metered"});constfree=plan({id: "free",group: "base",default: true,includes: [messages({limit: 100,reset: "month"})],});constpro=plan({id: "pro",group: "base",price: {amount: 19,interval: "month"},includes: [messages({limit: 2_000,reset: "month"})],});exportconstpaykit=createPayKit({stripe: {secretKey: process.env.STRIPE_SECRET_KEY!,webhookSecret: process.env.STRIPE_WEBHOOK_SECRET!,},database: process.env.DATABASE_URL!,products: [free,pro],});npx paykitjs initOr follow the installation guide.
Billing in the TypeScript ecosystem is either handled through low-level provider SDKs that require a lot of glue code, or through hosted platforms that own your billing data and sit between you and your customers. PayKit takes a different approach: it's an open-source framework that runs inside your app, keeps billing state in your own database, and handles the Stripe lifecycle so you don't have to.
PayKit is a free and open-source project licensed under the MIT License.
You can help continue its development by:
If you discover a security vulnerability within PayKit, please send an email to security@paykit.sh.
All reports will be promptly addressed, and you'll be credited accordingly.