Case study
FBR Digital Invoicing
Overview
FBR Digital Invoicing is a multi-tenant SaaS platform that lets sales-tax-registered businesses in Pakistan raise invoices and submit them to the Federal Board of Revenue through PRAL's Digital Invoicing API. PRAL is the licensed integrator; this platform is the software a business uses to work with it.
Every client company gets its own isolated database, its own admin panel on its own domain and its own FBR credentials, so a single installation serves many businesses without their records ever meeting.
Integration with FBR's Digital Invoicing system is mandatory for sales-tax-registered companies, including null-return filers. The platform carries a company through the whole path: recording its IRIS integration details, passing FBR's required sandbox scenarios, and then switching to live submission.
The challenge
FBR submission is unforgiving. Payloads must carry FBR's exact descriptions rather than internal identifiers, rates have to match the national lists to the character, and every company must pass a prescribed set of sandbox scenarios before it is allowed to send a single real invoice.
The platform had to keep each company's invoices, buyers, products and credentials in a completely separate database; store API tokens so that they can never be read back or written to a log; submit invoices without making anyone wait, and stay correct when FBR is slow or unavailable; track which sandbox scenarios each company still owes; and explain FBR's error codes in plain language instead of returning a bare number.
Technical solution
Built on Laravel 13 with Filament 5 for every screen, database-per-company tenancy resolved by domain, Horizon for queued work and Redis for cache and sessions. Invoice submission runs on its own dedicated queue so company provisioning can never delay it, and API tokens are encrypted with keys held in a separate vault rather than the application key.
What we built
Key features delivered:
Invoicing
- Sale invoices and debit notes, with line items carrying HS code, unit of measure, sale type and rate exactly as FBR expects them
- Buyers and products saved once and copied onto each invoice, so nothing is retyped and later edits never rewrite history
- Buyer registration status checked against FBR from the buyer form
- Automatic invoice numbering, with your own number kept alongside the one FBR issues
Submission to FBR
- Validate an invoice against FBR before submitting it, so errors surface before they count
- Submission runs as a background job with retries and backoff — nobody waits on a web request
- A dedicated queue for FBR work, kept separate from company provisioning so neither can starve the other
- FBR's sales error codes explained in plain language rather than returned as a number
Sandbox scenarios
- The sandbox scenarios FBR requires are derived per company from its business activity and sector
- Each scenario shows as passed, failed or still outstanding, drawn from the company's own test invoices
- Sandbox submissions are clearly separated from production, so test traffic can never be mistaken for real filing
Integration checklist
- IRIS integration details, business activity, sector and IP whitelisting recorded per company
- A checklist showing exactly what remains before that company can go live
- Environment switched from sandbox to production per company, once its scenarios pass
FBR reference data
- Provinces, document types, HS codes, transaction types and units of measure synced from FBR and shared across every company
- Live lookups for tax rates, SRO schedules and the units allowed for a given HS code, cached per company
- Searchable FBR dropdowns in the product and invoice forms, falling back to free text if a list is unavailable
Compliant invoice PDF
- Invoice PDFs carrying the FBR Digital Invoicing System mark and a QR code encoding the FBR invoice number
- Draft and sandbox invoices are watermarked, so only a submitted production invoice prints clean
- Each company's own logo and branding applied to its invoices and panel
Multi-tenant isolation
- One database per client company, resolved by domain, with no shared tables for business data
- Company setup runs as a queued pipeline that reports its status and can be retried if a step fails
- Per-company settings, branding, mail sender and invoice numbering
Roles and permissions
- Admin, accountant and viewer roles with per-screen permissions, editable by the company itself
- A separate super-admin panel for platform staff, kept off company domains entirely
- Sensitive settings that could redirect FBR calls are locked away from company users
Audit and logging
- Every FBR API call logged per company with its status, response and duration — never the token
- An admin activity log per company, read-only in the panel
- API tokens encrypted at rest and shown only as a last-four hint
Final results
The result lets a sales-tax-registered business meet FBR's digital invoicing requirement without building an integration of its own — from the first sandbox test through to live submission — while a single codebase serves every company on the platform.
Let's work together
Every project we build is unique, just like your business. Tell us what you have in mind and we'll come back with a plan.