Installation
Install PayKit packages, configure TypeScript, and set up environment variables for Stripe, Razorpay, and PayPal.
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, PayPal) | Always — required by every project |
@squaredr/paykit-react | React components and hooks | React or Next.js frontends |
Backend installation
Install the core SDK alongside one or more provider SDKs. Pick the command that matches your stack.
Stripe
npm install @squaredr/paykit stripeRazorpay
npm install @squaredr/paykit razorpayPayPal
npm install @squaredr/paykitPayPal does not require a separate SDK — the PayPal adapter uses the PayPal REST API directly.
Multiple providers
npm install @squaredr/paykit stripe razorpayAdapters 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, @squaredr/paykit/razorpay, or @squaredr/paykit/paypal.
Frontend installation
React / Next.js
npm install @squaredr/paykit-reactTypeScript 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.
{
"compilerOptions": {
"target": "ES2022",
"module": "ESNext",
"moduleResolution": "bundler",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true
}
}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
STRIPE_SECRET_KEY=sk_test_your_stripe_secret_key
STRIPE_WEBHOOK_SECRET=whsec_your_stripe_webhook_secret
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_your_stripe_publishable_keyRazorpay
RAZORPAY_KEY_ID=rzp_test_your_razorpay_key_id
RAZORPAY_KEY_SECRET=your_razorpay_key_secret
RAZORPAY_WEBHOOK_SECRET=your_razorpay_webhook_secretPayPal
PAYPAL_CLIENT_ID=your_paypal_client_id
PAYPAL_CLIENT_SECRET=your_paypal_client_secret
PAYPAL_SANDBOX=trueSecurity: Never commit
.envfiles to version control. Add.envand.env.localto 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.