Logo Lanfrica

projectschanda-bit/skillbank-africa

Domain:

digital infrastructure

Record type:

software
Creator:
pro
Host:
# SkillBank Africa – SecurePay Checkout Backend Node.js/Express backend for the Lenco by BroadPay mobile money STK push payment gateway, with Firebase Firestore as the purchase ledger. --- ## Architecture ``` Frontend (port 64012) Backend (port 5000) External ───────────────────── ───────────────────────────── ─────────────────── script.js / payment-api.js │ POST /api/payment/initiate ──► Lenco API │ 1. Initiate GET /api/payment/status/:ref (STK push) │ 2. Poll status │ 3. Show result POST /api/webhooks/lenco ◄── Lenco (async) │ │ │ Firestore (purchases collection) ``` --- ## Quick Start ### 1. Clone & install ```bash git clone github.com cd securepay-checkout npm install ``` ### 2. Configure environment ```bash cp .env.example .env # Open .env and fill in all values ``` Required values: | Variable | Where to get it | |---|---| | `LENCO_SECRET_KEY` | Lenco dashboard → Settings → API Keys | | `LENCO_PUBLIC_KEY` | Lenco dashboard → Settings → API Keys | | `LENCO_WEBHOOK_URL` | Your public URL + `/api/webhooks/lenco` | | `LENCO_WEBHOOK_SECRET` | Lenco dashboard → Settings → Webhooks | | `FIREBASE_SERVICE_ACCOUNT_PATH` | Firebase Console → Project Settings → Service Accounts | ### 3. Firebase service account 1. Go to Firebase Console → **skillbank-africa** project. 2. Click **Project Settings** → **Service Accounts**. 3. Click **Generate new private key** → download the JSON file. 4. Save it as `firebase-service-account.json` in this project root. 5. ⚠️ It's already in `.gitignore` — never commit it. ### 4. Start the server ```bash # Development (auto-restart) npm run dev # Production npm start ``` --- ## Webhook Setup (Local Dev with ngrok) Lenco needs a **public URL** to send payment status updates. ```bash # In a separate terminal npx ngrok http 5000 # Copy the https UR …