Development Guide
Complete technical documentation for developers working with CaliPay platform - API references, integration guides, and best practices.
Quick Reference
API Reference
REST API endpoints
Authentication
JWT & API keys
SDKs & Libraries
Client libraries
Webhooks
Event notifications
API Documentation
REST API OverviewCore
CaliPay provides a comprehensive REST API for managing associations, members, invoices, and payments.
Base URL
https://api.calipay.in/v1
Authentication
- JWT Bearer tokens for user sessions
- API keys for server-to-server communication
- OAuth 2.0 for third-party integrations
- Rate limiting: 1000 requests/hour
Response Format
- JSON format for all responses
- Consistent error handling
- Pagination for list endpoints
- HTTP status codes
Core API Endpoints
Association Management
GET /associations
List all associationsPOST /associations
Create new associationGET /associations/{id}
Get association detailsPATCH /associations/{id}
Update associationMember Management
GET /members
List association membersPOST /members
Add new memberGET /members/{id}
Get member detailsPATCH /members/{id}
Update member informationInvoice & Payment APIs
GET /invoices
List invoicesPOST /invoices
Create invoicePOST /payments
Process paymentGET /payments/{id}
Get payment statusAuthentication & Security
JWT AuthenticationRequired
CaliPay uses JWT tokens for authentication. Obtain tokens through the login endpoint and include them in API requests.
# Login to get JWT token
curl -X POST https://api.calipay.in/v1/auth/login \
-H "Content-Type: application/json" \
-d '{"phone": "+919876543210", "otp": "123456"}'
# Use token in subsequent requests
curl -X GET https://api.calipay.in/v1/associations \
-H "Authorization: Bearer YOUR_JWT_TOKEN"
Security Best Practices
- Store tokens securely (never in localStorage for sensitive apps)
- Implement token refresh logic for long-running applications
- Use HTTPS for all API communications
- Validate and sanitize all input parameters
- Implement proper error handling without exposing sensitive data
API Keys & Rate Limiting
API Key Usage
- Server-to-server communications
- Webhook signature verification
- Administrative operations
- Bulk data operations
Rate Limits
- 1000 requests per hour per API key
- 100 requests per minute per IP
- 429 status code when limit exceeded
- Rate limit headers in responses
Integration Guides
Payment Gateway IntegrationRazorpay
CaliPay integrates with Razorpay for payment processing. Follow these steps for custom payment implementations.
Payment Flow
- Create payment intent via CaliPay API
- Initialize Razorpay checkout with returned payment ID
- Handle payment success/failure callbacks
- Verify payment signature for security
- Update payment status via webhook or polling
# Create payment intent
curl -X POST https://api.calipay.in/v1/payments/intent \
-H "Authorization: Bearer JWT_TOKEN" \
-H "Content-Type: application/json" \
-d '{"invoice_id": "inv_123", "amount": 5000}'
Webhook Integration
Set up webhooks to receive real-time notifications about payment status, member updates, and other important events.
Supported Events
- payment.completed
- payment.failed
- invoice.created
- member.registered
- member.updated
Webhook Security
- HMAC signature verification
- Timestamp validation
- Idempotency handling
- Retry mechanism
Development Environment
Local Development Setup
Prerequisites
- Node.js 18+ and npm/yarn
- Git for version control
- Docker (optional, for local database)
- VS Code or preferred IDE
- Postman or similar API testing tool
# Clone the repository
git clone https://github.com/calipay/calipay-platform.git
cd calipay-platform
# Install dependencies
npm install
# Set up environment variables
cp .env.example .env.local
# Start development server
npm run dev
Database Schema & Migrations
CaliPay uses PostgreSQL with Prisma ORM for database operations. Follow migration best practices for schema changes.
Core Tables
- associations: RWA/community information
- users: Member and admin user accounts
- properties: Property hierarchy and details
- invoices: Billing and invoice records
- payments: Payment transactions and status
- notifications: System and user notifications
Testing & Deployment
Testing Strategy
- Unit Tests: Jest for component and utility testing
- Integration Tests: API endpoint testing with Supertest
- E2E Tests: Playwright for user journey testing
- Load Testing: Artillery for performance testing
- Security Testing: OWASP ZAP for vulnerability scanning
Deployment Pipeline
- CI/CD: GitHub Actions for automated deployment
- Environments: Development, Staging, Production
- Infrastructure: Docker containers on AWS/GCP
- Monitoring: DataDog/New Relic for observability
- Rollback: Blue-green deployment strategy
SDKs & Client Libraries
Official SDKs
JavaScript/TypeScript
npm install @calipay/sdk
Python
pip install calipay-python
PHP
composer require calipay/php-sdk
SDK Features:
- Automatic authentication handling and token refresh
- Type-safe API methods with full TypeScript support
- Built-in error handling and retry mechanisms
- Webhook signature verification utilities
- Comprehensive documentation and examples