FBR Digital Invoicing — PRAL Integrator (Pakistan)
FBR-compliant digital invoicing for Pakistani businesses — PRAL gateway integration, IRN generation, QR codes, PDF export, and full audit logs.
📋About This Project
FBR Digital Invoicing is a production-ready, compliance-grade digital invoicing system built for Pakistani businesses required to integrate with the Federal Board of Revenue's Digital Invoicing (DI) API via the PRAL gateway. The system is built with a vanilla JavaScript + HTML5 frontend and a framework-less PHP REST API backend, backed by MySQL 8, containerised with Docker Compose for one-command deployment.
The system handles the complete FBR DI invoicing lifecycle: seller profile management (NTN/CNIC, business name, province), buyer registration (CNIC/NTN/STRN, registration type, address), product/service catalog with HS codes, unit of measure, rate, and optional SRO fields, and full invoice creation with dynamic line items and real-time calculations.
Compliance is enforced at the code level — the DI JSON generator uses a strict allowlist extracted directly from the official FBR DI API PDF specification, rejecting any missing required fields and including no non-spec fields. Both validate (validateinvoicedata_sb) and submit (postinvoicedata) PRAL endpoints are implemented, with mock mode returning realistic DI-like responses for testing without external calls, and live mode calling PRAL with a securely stored, AES-encrypted Bearer token.
Each invoice generates a QR code containing the IRN (Invoice Reference Number) and supports both browser print view and server-generated PDF download. All PRAL API requests and responses are logged in fbr_api_logs with full audit trails in audit_logs, providing the compliance paper trail required for FBR inspection. Invoices are locked non-editable after submission attempt, matching FBR requirements. Security is handled via opaque Bearer tokens stored hashed in the database, with environment-based configuration for all secrets.
✅Features & Benefits
🎯Who It's Built For
Project Details
- Category
- Custom Software
- Built With
- PHP, MySQL, Docker +more
- Status
- ✅ Delivered
- Agency
- Tech Mag Solutions
Full Tech Stack
Want Something Similar?
We can build a custom solution tailored to your business in custom software.
Get a Free Quote →Related Projects
View all →MartPOS — Modern Point of Sale for Marts & Grocery Stores
Cloud-connected POS web app for marts and grocery retailers — billing, inventory, expiry tracking, loyalty programs, vendor management, day-close reports, and a customer-facing display screen.

Restaurant Point of Sale System — Online Web App
White-label restaurant POS web app — billing terminal, kitchen display, table floor plan, inventory, customer CRM, and reports dashboard. Zero backend.

FC Communication — Retail POS System
Custom offline desktop POS for FC Communication retail shop — sales, purchases, ledgers, inventory, expenses, and thermal receipts. No internet needed.
Ready to Build Your Next Project?
Get a free strategy session worth $500. We'll scope your project, recommend the best tech stack, and give you a clear roadmap.