FBR Digital Invoicing — PRAL Integrator (Pakistan)
Custom Software

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

Production-grade code quality — built to scale with your business
Clean, maintainable architecture for easy future enhancements
Mobile-first responsive design that looks great on every screen
Optimized for performance — fast load times improve conversion rates
Delivered with full documentation and handover support

🎯Who It's Built For

Retail Shop OwnersFranchise BusinessesSMEs Needing Custom ToolsOperations Teams

Project Details

Category
Custom Software
Built With
PHP, MySQL, Docker +more
Status
✅ Delivered
Agency
Tech Mag Solutions

Full Tech Stack

🐘 PHP MySQL🐳 Docker FBR Pakistan Tax PRAL API Digital Invoicing Compliance QR Code PDF Generation
🛠️

Want Something Similar?

We can build a custom solution tailored to your business in custom software.

Get a Free Quote →

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.