PayKit is live on npm. It is a unified payment SDK for Node.js — a single, type-safe API that works across Stripe, Razorpay, and more payment providers.
The problem
Every payment provider has its own SDK, its own data shapes, its own webhook format. If you start with Stripe and later need Razorpay for Indian customers, you are rewriting your entire payment layer. Not just the API calls — the webhook handlers, the receipt generation, the subscription logic, all of it.
I hit this exact problem on a client project. We started with Stripe, needed to add Razorpay three months in, and the integration took almost as long as the original Stripe work. That felt wrong.
How PayKit fixes it
PayKit sits between your application and the payment provider. You write your payment logic against PayKit's API. Under the hood, PayKit translates to whatever provider you have configured.
import { PayKit } from '@squaredr/paykit'
const pk = new PayKit({
provider: 'stripe',
credentials: { secretKey: process.env.STRIPE_SECRET }
})
const charge = await pk.charges.create({
amount: 2500,
currency: 'usd',
source: tokenId,
description: 'Pro license'
})Switch to Razorpay? Change the config:
const pk = new PayKit({
provider: 'razorpay',
credentials: {
keyId: process.env.RZP_KEY_ID,
keySecret: process.env.RZP_KEY_SECRET
}
})Same .charges.create() call. Same response shape. Your business logic does not change.
What is included
- Charges — create, capture, refund
- Customers — create, update, retrieve
- Subscriptions — create, cancel, update
- Webhooks — unified webhook parser that normalises events across providers
- Type safety — full TypeScript types for every method, every response, every event
Why not just abstract it yourself
You can. It is not complicated in theory. But the edge cases are where it gets ugly. Stripe uses cents, Razorpay uses paise, PayPal uses full units. Stripe webhooks are signed with HMAC, Razorpay uses a different signature scheme. Subscription states do not map 1:1 across providers.
PayKit handles all of that normalisation. You do not have to learn the quirks of each provider — you learn PayKit's API once.
The license
MIT. Same as everything else I ship. Use it however you want.
Check out the docs when the site goes live, or install it now:
npm install @squaredr/paykit