This is the backend server for the PayNow payment processing platform. It handles M-Pesa integration, invoice generation, and customer management.
- M-Pesa STK Push integration
- PDF invoice generation
- Email notifications
- SMS notifications
- Customer management (CRM Lite)
- Firebase integration for data storage
- Node.js (v14+)
- npm or yarn
- Firebase account
- M-Pesa API credentials
- Clone the repository
- Install dependencies:
npm install
- Create a
.env
file based on.env.example
:
cp .env.example .env
- Update the
.env
file with your credentials:- Email configuration for sending notifications
- Firebase credentials for database and storage
- M-Pesa API credentials
- Base URL for callbacks
Development mode:
npm run dev
Production mode:
npm start
POST /stkpush
- Initiate STK Push paymentPOST /callback/:orderId
- M-Pesa callback handlerPOST /query
- Check payment statusPOST /validation/:orderId
- M-Pesa validation URL
POST /update-order-status
- Update order statusPOST /cancel-order
- Cancel an order
The system automatically generates PDF invoices for successful payments. Invoices include:
- Transaction details
- Customer information
- Payment information
- Merchant branding
Invoices are stored in Firebase Storage and can be accessed via the dashboard.
Customer data is automatically collected and organized for merchants:
- Contact information
- Transaction history
- Total spend
- Payment preferences
Merchants can view and manage customers through the dashboard.
Variable | Description |
---|---|
EMAIL_USER | Email address for sending notifications |
EMAIL_PASS | Email password or app-specific password |
BASE_URL | Base URL for callbacks |
FIREBASE_PROJECT_ID | Firebase project ID |
FIREBASE_CLIENT_EMAIL | Firebase service account email |
FIREBASE_PRIVATE_KEY | Firebase service account private key |
FIREBASE_STORAGE_BUCKET | Firebase storage bucket name |
ALLOWED_ORIGINS | Comma-separated list of allowed CORS origins |
This project is proprietary software.