FBR Digital InvoicingPRAL Integrator
A production-ready, compliance-grade digital invoicing system for Pakistani businesses required to integrate with the Federal Board of Revenue's Digital Invoicing (DI) API via the PRAL gateway.
What is FBR Digital Invoicing?
The Federal Board of Revenue (FBR) of Pakistan mandates registered businesses to submit digital invoices electronically through the PRAL (Pakistan Revenue Automation Limited) gateway under the Digital Invoicing (DI) initiative.
Non-compliance can result in penalties, audit triggers, and loss of input tax credit. This system handles the entire compliance workflow โ from seller/buyer registration to invoice submission, IRN retrieval, and audit log maintenance.
Built for businesses that need a self-hosted, on-premise solution with full control over their invoicing data โ no third-party SaaS, no monthly fees, no data leaving your infrastructure.
Who needs this system?
- โRegistered taxpayers (NTN/STRN holders)
- โManufacturers & wholesalers filing GST
- โService providers issuing B2B invoices
- โRetailers under FBR Point of Sale scheme
- โImporters & exporters needing HS code invoicing
- โBusinesses under tax audit requiring clean logs
How It Works
From setup to PRAL submission in 6 steps
Seller Setup
Enter NTN/CNIC, business name, province, and PRAL Bearer token.
Buyer Registration
Register buyer with CNIC/NTN/STRN, registration type, and address.
Product Catalog
Add products/services with HS codes, unit of measure, rate, and SRO fields.
Create Invoice
Add line items, apply tax, calculate totals โ all in real time.
Validate & Submit
Send to PRAL gateway. Receive IRN on success. Invoice is locked.
PDF & QR
Download PDF with IRN and QR code for FBR verification.
Full Feature Set
Everything required for FBR compliance โ nothing more, nothing less
FBR DI API Compliant
Invoice JSON generated using a strict allowlist extracted directly from the official FBR DI API specification โ no extra fields, no missing required fields.
PRAL Gateway Integration
Connects to both validate (validateinvoicedata_sb) and submit (postinvoicedata) PRAL endpoints. Live mode sends real invoices; mock mode returns realistic responses for testing.
IRN Generation
Each submitted invoice receives an Invoice Reference Number (IRN) from the FBR gateway, stored and displayed on the invoice and receipt.
Complete Invoice Lifecycle
Seller profile, buyer registration, product/service catalog with HS codes, dynamic line items, real-time tax calculations, and invoice locking after submission.
PDF & Print Export
Every invoice generates a browser print view and a server-generated PDF download โ formatted for FBR compliance and client delivery.
QR Code on Every Invoice
QR codes embed the IRN and invoice details for instant FBR verification by auditors or buyers โ printed on every receipt.
Secure Token Management
PRAL Bearer tokens stored AES-encrypted in the database with environment-based key management. Tokens are hashed opaque at the API boundary.
Full Audit Logs
All PRAL API requests and responses logged in fbr_api_logs. Complete audit_logs table provides the compliance paper trail required for FBR inspection.
One-Command Docker Deploy
Docker Compose setup spins up PHP backend, MySQL 8, and frontend in one command. Ready for on-premise or cloud deployment.
Compliance Architecture
Built directly against the FBR DI API specification
Invoice JSON Generation
The DI JSON generator uses a strict field allowlist extracted directly from the official FBR DI API PDF specification. No non-spec fields are included. All required fields are validated before submission attempts โ the system rejects incomplete invoices before they reach PRAL.
Audit Trail
Every PRAL API call โ request payload and response โ is stored in fbr_api_logs. The audit_logs table records every user action: invoice creation, edits, submission attempts, and PDF downloads โ with timestamps and user IDs.
- โ fbr_api_logs โ full PRAL request/response
- โ audit_logs โ user action trail
- โ invoices locked after submission
- โ IRN stored per invoice
- โ Exportable audit report for FBR inspection
Mock vs Live Mode
Switch between mock and live PRAL mode via a single config flag. Mock mode returns realistic DI-formatted responses โ allowing full UI/workflow testing without making real PRAL API calls. Ideal for development, staff training, and data migration testing before going live.
Data Ownership
Fully self-hosted โ your invoice data stays on your own server or cloud instance. No third-party SaaS access, no subscription fees. Deploy on-premise or on any VPS with Docker in minutes. MySQL database is yours to back up and own indefinitely.
Tech Stack
Lightweight, self-hosted, no vendor lock-in
Need FBR Digital Invoicing for your business?
We deploy and configure the complete system for your business โ including PRAL credentials setup, seller/buyer onboarding, staff training, and ongoing support.