Requirements
- Node.js 14 or higher
- npm, yarn, or pnpm
Installation
Install the InventPay SDK using your preferred package manager:Verify Installation
After installation, verify the SDK is working:TypeScript Support
The SDK includes full TypeScript definitions out of the box. No additional @types package needed!Package Info
Package Size
Lightweight with zero dependencies
TypeScript
Full type definitions included
Tree-shakeable
Import only what you need
ESM & CommonJS
Supports both module systems
What’s Included
When you installinventpay, you get:
- PaymentSDK - Main SDK class
- Type Definitions - Complete TypeScript types
- Helper Functions - Webhook verification and utilities
- Error Classes - Custom error handling
Dependencies
The InventPay SDK has zero external dependencies, keeping your bundle size small and reducing potential security vulnerabilities.Browser Support
While the SDK can technically run in browsers, we strongly recommend using it only on the server-side: If you need to accept payments from a browser:- Create a server endpoint that uses the SDK
- Call that endpoint from your frontend
- Redirect users to the payment URL returned by your backend
Framework-Specific Setup
Express.js
Next.js API Routes
NestJS
Environment Variables
Store your API key securely in environment variables: Create a.env file:
Troubleshooting
Module not found error
Module not found error
Error:
Cannot find module 'inventpay' Solution: 1. Ensure you ran
the install command 2. Check that inventpay is in your package.json
dependencies 3. Try deleting node_modules and reinstalling bash rm -rf node_modules package-lock.json npm install TypeScript errors
TypeScript errors
Error: Type errors when importing Solution: 1. Ensure you’re using
TypeScript 4.0+ 2. Check your
tsconfig.json has "moduleResolution": "node" 3. Try restarting your TypeScript serverESM/CommonJS issues
ESM/CommonJS issues
Error:
require() of ES Module not supported Solution: Use
appropriate import syntax for your module system: CommonJS: javascript const {PaymentSDK} = require('inventpay'); ES Modules: javascript import {PaymentSDK} from 'inventpay'; Next Steps
Configuration
Learn how to configure the SDK
Usage Guide
Start using the SDK
Examples
See complete code examples
API Reference
Explore all available methods
Updating the SDK
To update to the latest version:npm
yarn
