A production‑grade, modular payment gateway built with:
- Node.js (TypeScript)
- Express.js
- PostgreSQL (Prisma ORM)
- Redis (idempotency + caching + queues)
- BullMQ (webhook retries & background jobs)
- Docker
- OpenAPI (Swagger)
- Postman Collection
It supports both gateway providers and Nigerian banks/fintechs:
| Provider | Status | Notes |
|---|---|---|
| Paystack | ✅ Full | Working REST integration |
| Stripe | ⚙️ Ready | SDK + webhook scaffold |
| Flutterwave | 🔧 Scaffold | Ready for full integration |
| Remita | 🔧 Scaffold | RRR billing flow |
| Access Bank | 🔧 Scaffold | Corporate |
| First Bank | 🔧 Scaffold | Corporate |
| GTBank | 🔧 Scaffold | Corporate |
| UBA | 🔧 Scaffold | Corporate |
| Stanbic IBTC | 🔧 Scaffold | Corporate |
| Premium Trust Bank | 🔧 Scaffold | Basic flows |
| OPay | 🔧 Scaffold | Collections API |
| NIPSB | 🔧 Scaffold | Instant payments |
git clone <repo-url>
cd Payment-integration
npm install
Copy .env.example → .env and set your values:
DATABASE_URL=postgresql://agentic:password@localhost:5432/agentic_payments
REDIS_URL=redis://localhost:6379
PAYSTACK_SECRET_KEY=sk_test_xxxxxx
STRIPE_SECRET_KEY=sk_test_xxxxxx
FLUTTERWAVE_SECRET_KEY=
REMITA_API_KEY=
ACCESSBANK_API_KEY=
FIRSTBANK_API_KEY=
GTBANK_API_KEY=
UBA_API_KEY=
STANBIC_API_KEY=
PREMIUMTRUST_API_KEY=
OPAY_API_KEY=
NIPSB_API_KEY=
💡 For Paystack, use the secret key, not the public key.
Start services:
docker-compose up -d postgres redis
Verify:
docker ps
npm run dev
Expected startup:
Paystack Secret Key Loaded: yes
BullMQ workers initialized
Server running on port 3000
Redis connected
Your API is now live at:
http://localhost:3000/api
GET http://localhost:3000/api/health
GET http://localhost:3000/api/payments/providers
POST
http://localhost:3000/api/payments/initiate
Headers:
Content-Type: application/json
Idempotency-Key: TEST123
Body:
{
"provider": "paystack",
"amount": 5000,
"currency": "NGN",
"customerId": "demo_123",
"reference": "ref_xyz",
"callbackUrl": "https://example.com"
}Run the end‑to‑end payment initializer:
npx ts-node scripts/pay-demo.ts
Expected output:
Payment initialized successfully!
paymentUrl: https://checkout.paystack.com/xxxx
The entire API is documented in:
openapi.yaml
Import into:
- SwaggerHub
- Redoc
- Insomnia
- Postman
Import:
postman_collection.json
Includes:
- Health
- Providers
- Create Payment
- Confirm Payment
- Refund
- Create Customer
npx prisma studio
npx prisma migrate dev --name init
npx prisma db seed
BullMQ handles:
- Webhook retries
- Async provider operations
Workers start automatically:
BullMQ workers initialized
The system does not store or process raw card numbers (PAN/CVV).
This keeps you in PCI SAQ‑A compliance.
Security layers included:
- Idempotency keys
- Redis locks
- Webhook signature verification (Stripe-ready)
- Separate raw body parsing for webhooks
- Server-side input validation
src
├─ app.ts
├─ server.ts
├─ config/
├─ db/
├─ jobs/
├─ middleware/
├─ modules/
│ └─ payment/
│ ├─ adapters/
│ ├─ controllers/
│ ├─ routes/
│ ├─ webhooks/
│ ├─ types.ts
│ ├─ paymentService.ts
│ ├─ providerRegistry.ts
│ └─ paymentModule.ts
└─ routes/
prisma/
scripts/
docs/
docker-compose up --build
docker build -t agentic-brain-api .
Deployable to:
- AWS ECS
- Railway
- Render
- Azure Container Apps
- Digital Ocean
- Complete more bank adapters
- Add real webhook signatures (Stripe, Paystack, Flutterwave)
- Add logging to Sentry
- Add Jest integration tests
- Add BullMQ dashboard
- Add rate limiting
Built with ❤️ for modern organizations.