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 →.png&w=1920&q=65)
SmartPOS — Desktop Point of Sale System
Offline desktop POS (Electron) for retail shops — sales, purchases, customer/vendor ledger, inventory, barcode generation, and thermal receipts. 100% offline.

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.

SmartPOS Online — Cloud-Sync Web Point of Sale
Cloud-sync web POS for shops and marts — billing terminal, inventory management, reports dashboard, offline support with sync indicator, and Supabase cloud backend.
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.