Stop juggling payment APIs. Use one.
A TypeScript-first Node.js library with React components for accepting payments across Stripe, Razorpay, PayPal and more. Write your integration once — swap providers without changing a line of code.
One API. Any provider.
PayKit sits between your app and payment providers. The adapter pattern lets you swap providers by changing a single line.
// Only this line changes:
import { StripeAdapter } from '@squaredr/paykit/stripe';Kill the spaghetti code
Replace provider-specific branches with a single, clean interface.
Everything you need to accept payments
PayKit handles the complexity so you can focus on building your product.
Unified API
One interface for every payment provider. Write integration code once, swap providers without touching business logic.
TypeScript-first
Full TypeScript support with generics for provider-specific types. Catch errors at compile time, not in production.
Extensible adapters
Implement the PaymentAdapter interface to add any provider. Three reference adapters included — build your own in under an hour.
Provider routing
Route payments by currency, region or custom rules. Send INR to Razorpay, USD to Stripe — automatically.
Webhook normalization
Unified webhook events across providers. One handler for charge.succeeded regardless of the source.
Error normalization
19 unified error codes with human-readable suggestions and a retryable flag. No more parsing cryptic provider responses.
Auth & capture
Hold funds, then capture when ready. Built-in support for hotels, rentals, and marketplace holds with partial capture.
Node.js + React
Server SDK for Node.js — works with Express, Fastify, Hono, Next.js. Frontend components for React with CheckoutForm, CardInput, and hooks.
Lightweight
core: 26 KB · react: 7 KB · sdk-js: 4 KB. Zero runtime dependencies. Separate server and client entry points — only bundle what you use.
Built for real payment flows
Auth-capture, webhooks, multi-provider routing, and unified errors — all with the same API.
const paykit = new PayKit({ adapter: stripe });
// 1. Authorize (hold funds)
const charge = await paykit.charges.create({
amount: 5000,
currency: 'usd',
capture: false, // auth-only
metadata: { orderId: 'order_789' },
});
// 2. Capture when ready
const captured = await paykit.charges.capture(charge.id);
// 3. Partial refund
const refund = await paykit.refunds.create({
chargeId: charge.id,
amount: 2500, // half back
});Adapters for every provider you need
Every adapter is free and MIT licensed. 25+ providers planned, prioritized by what the community asks for.
Tell us which provider you need and we’ll prioritize it.
Powered by FieldCraftImplement the PaymentAdapter interface, map your provider’s API to unified types, and plug it in.
Read the guide →The middle ground between DIY and vendor lock-in
You shouldn't have to choose between writing everything from scratch and paying per-transaction fees to an orchestration platform.
Build it yourself
- −Separate SDK per provider
- −Custom type definitions
- −Manual webhook parsing
- −Provider-specific error handling
- −Rewrite when switching providers
- −Build adapters from scratch
One SDK, every provider
- ✓Single API across all providers
- ✓Full TypeScript coverage built-in
- ✓Unified webhook events
- ✓Consistent error types
- ✓Swap adapters, keep your code
- ✓Extensible adapter interface
Hosted services
- −Vendor lock-in to their API
- −Per-transaction fees on top of gateway fees
- −Data routes through third-party servers
- −Limited customization
- −Compliance overhead for PCI / SOC2
- −Closed ecosystem
Ready to simplify your payment stack?
Install PayKit and accept your first payment in minutes. One SDK, every provider.
npm install @squaredr/paykit stripe