Pakistan Tax Compliance Software

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

1

Seller Setup

Enter NTN/CNIC, business name, province, and PRAL Bearer token.

2

Buyer Registration

Register buyer with CNIC/NTN/STRN, registration type, and address.

3

Product Catalog

Add products/services with HS codes, unit of measure, rate, and SRO fields.

4

Create Invoice

Add line items, apply tax, calculate totals โ€” all in real time.

5

Validate & Submit

Send to PRAL gateway. Receive IRN on success. Invoice is locked.

6

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.

// Example DI invoice fields
{ "InvoiceNumber": "INV-001",
"InvoiceDate": "2024-01-15",
"SellerNTN": "1234567",
"BuyerCNIC": "3520212345678",
"HSCode": "8471.30",
"TotalAmount": 50000,
"SalesTax": 8500 }

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

PHP
REST API backend (framework-less)
MySQL 8
Invoice & audit data storage
Docker Compose
One-command deployment
Vanilla JS + HTML5
Frontend UI
PRAL API
FBR gateway integration
QR Code Generator
IRN-embedded QR on every invoice
AES Encryption
Secure token storage
PDF Export
Server-generated compliance PDFs

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.