Installation
Install the PayKit packages you need, configure TypeScript, and set up environment variables for your payment providers.
Prerequisites
- Node.js >= 20.0.0
- npm >= 11.0.0 (or the equivalent pnpm / yarn version)
Package Overview
| Package | Description | Install When |
|---|---|---|
@squaredr/paykit | Core SDK + all adapters (Stripe, Razorpay, etc.) | Always — required by every project |
@squaredr/paykit-js | Vanilla JS/TS frontend SDK (headless) | Non-React frontends or custom checkout UIs |
@squaredr/paykit-react | React components and hooks | React or Next.js frontends |
Backend Installation
Install the core SDK alongside one or more provider adapters. Pick the command that matches your stack.
Stripe
Razorpay
Both providers
Adapters are built into the core package as subpath exports. Install the provider SDK (stripe, razorpay) as a peer dependency, then import the adapter from @squaredr/paykit/stripe or @squaredr/paykit/razorpay.
Frontend Installation
Choose the frontend package that matches your framework.
React / Next.js
Vanilla JS / TypeScript
TypeScript Configuration
All PayKit packages ship with full type declarations. Make sure your tsconfig.json uses the bundler module resolution so that subpath exports (like @squaredr/paykit/stripe and @squaredr/paykit/stripe/client) resolve correctly.
Environment Variables
Each provider adapter reads credentials from environment variables. Create a .env file (or .env.local in Next.js) at the root of your project.
Stripe
Razorpay
Security: Never commit .env files to version control. Add .env and .env.local to your .gitignore. In production, inject secrets via your hosting provider's environment variable settings (Vercel, Railway, AWS, etc.).
Next Steps
Everything is installed. Head to the Quick Start guide to create your first charge and collect a payment in under five minutes.