FBR Digital Invoicing Integration: Complete Guide for Pakistan 2025

Step-by-Step Tutorial for IRIS Portal, API Integration, Sandbox Testing & Production Deployment

Last Updated: December 2025
Reading Time: 25-30 minutes
Difficulty: Intermediate to Advanced
Author: SmartInvoice Pakistan

Introduction

The Federal Board of Revenue (FBR) Pakistan has mandated digital invoicing for registered taxpayers to improve tax compliance, reduce fraud, and automate the sales tax collection process. This comprehensive guide will walk you through the entire process of integrating your business software or ERP system with FBR's Digital Invoicing System.

Whether you're a software developer building an invoicing solution, a business owner looking to understand the process, or an IT professional tasked with implementing FBR integration, this tutorial covers everything you need to know.

What You'll Learn:
  • How to access and navigate the FBR IRIS Portal
  • Understanding integration modes and licensed integrators
  • Setting up API credentials and IP whitelisting
  • Completing sandbox testing scenarios
  • Moving to production environment
  • Invoice submission API structure and responses
  • Common errors and troubleshooting

1. Prerequisites

Before you begin the FBR Digital Invoicing integration process, ensure you have the following:

Business Requirements

Technical Requirements

Note: If you don't have an ERP or invoicing software, you can use FBR-approved solutions like SmartInvoice that come with built-in FBR integration.

2. Accessing FBR IRIS Portal

The IRIS (Inland Revenue Information System) portal is FBR's primary online platform for all tax-related services. Here's how to access it:

1Navigate to IRIS Portal

Go to https://iris.fbr.gov.pk in your web browser.

2Login with Credentials

Enter your registered CNIC/NTN and password. If you haven't registered, click on "e-Registration" to create an account.

3Navigate Dashboard

After login, you'll see the IRIS dashboard with various modules including Invoice Management, Registration, Declaration, and more.

FBR IRIS Portal Dashboard showing Digital Invoicing option

Figure 1: FBR IRIS Portal Dashboard - Click on "Digital Invoicing" to begin integration

The IRIS dashboard provides access to multiple services. For digital invoicing integration, look for the "Digital Invoicing" option in the top navigation bar. You'll also see other useful sections like:

3. Digital Invoicing Module

Click on the "Digital Invoicing" button in the IRIS header to access the Digital Invoicing module. This module is specifically designed for businesses that want to integrate their software systems with FBR for automated invoice submission.

What is FBR Digital Invoicing?

FBR Digital Invoicing is a system that allows businesses to:

Important: Digital invoicing is mandatory for certain categories of businesses as per FBR notifications. Check the latest SROs (Statutory Regulatory Orders) to determine if your business falls under mandatory compliance.

4. Choosing Integration Mode

FBR offers multiple integration modes based on your business size and technical capabilities:

FBR Integration Mode Selection Screen

Figure 2: Choose Integration Mode - Select API Integration for software integration

Available Integration Modes

Mode Description Best For
API Integration Direct API connection for automated invoice submission Businesses with ERP/invoicing software
POS Integration Point of Sale system integration for retail Retail stores, restaurants, shops
Manual Entry Manual invoice entry through IRIS portal Small businesses with low invoice volume

For this tutorial, we'll focus on API Integration as it provides the most flexibility and automation for businesses with custom software solutions.

1Select API Integration

Click on the "API Integration" option. This is applicable for taxpayers with ERP or any equivalent system that supports API integration.

5. Selecting Licensed Integrator (PRAL)

FBR requires all API integrations to go through a Licensed Integrator (LI). The Licensed Integrator acts as an intermediary between your software and FBR's systems, ensuring security and compliance.

Why Licensed Integrators?

Available Options

Option 1: PRAL (Pakistan Revenue Automation Limited) - Recommended

PRAL will provide FREE of Cost Licensed Integrator Services along with Sandbox Testing.

This is the most cost-effective option for most businesses, especially startups and SMEs.

Option 2: Other Licensed Integrators

You can also choose from other FBR-approved licensed integrators. However, note the following pricing guidelines:

1Click "Proceed with PRAL as Licensed Integrator"

For most businesses, PRAL is the recommended choice due to free sandbox testing and no per-invoice charges.

2Click "Next" to proceed

After selecting PRAL, click the Next button to move to API Integration setup.

6. API Integration Setup

After selecting your Licensed Integrator, you'll need to configure your API integration settings. This involves providing technical details about your system.

Technical Details Required

Field Description Example
System Name Name of your ERP/invoicing software SmartInvoice ERP
System Version Current version of your software 2.5.1
Contact Person Technical contact for integration IT Manager name
Contact Email Email for technical communications tech@yourcompany.com
Contact Phone Phone number for urgent issues +92-XXX-XXXXXXX

API Credentials

After submitting your technical details, FBR will generate:

Security Warning: Never share your Client Secret publicly or commit it to version control systems. Store it securely using environment variables or a secrets management system.

7. IP Whitelisting

FBR requires IP whitelisting as a security measure. Only requests from your registered IP addresses will be accepted by the FBR API.

Steps for IP Whitelisting

1Identify Your Server IP

Determine the static IP address(es) of your production server(s). You can find this from your hosting provider or by running curl ifconfig.me on your server.

2Navigate to IP Whitelisting Section

In the Digital Invoicing module, go to "API Integration" → "IP Whitelisting"

3Add Your IP Addresses

Enter each IP address that will make API calls to FBR. You can add multiple IPs if you have redundant servers.

4Wait for Approval

IP whitelisting may take 24-48 hours to become active. Plan your testing timeline accordingly.

Pro Tip: If you're using cloud hosting (AWS, Azure, Google Cloud), ensure you have a static/elastic IP assigned to your server. Dynamic IPs will cause integration failures.

8. Sandbox Environment & Testing Scenarios

Before you can submit invoices to FBR's production system, you must successfully complete all required testing scenarios in the Sandbox environment. This ensures your integration is working correctly and handles all invoice types properly.

FBR Sandbox Testing Scenarios

Figure 3: Sandbox Environment showing 6 test scenarios - All must show "Successful" status

What is the Sandbox Environment?

The Sandbox is a testing environment that mirrors the production system but doesn't affect real tax records. It allows you to:

Accessing Sandbox

1Navigate to Sandbox Environment

In the API Integration section, click on "Sandbox Environment" in the left sidebar.

2Get Sandbox Credentials

Use the sandbox-specific Client ID and Secret provided. These are different from production credentials.

3Use Sandbox API Endpoint

Sandbox URL: https://sandbox.fbr.gov.pk/api/v1/ (example - verify current endpoint from portal)

9. Understanding Test Scenarios

FBR requires you to successfully complete specific test scenarios before production access is granted. Each scenario tests a different type of invoice transaction.

Standard Test Scenarios

Sr. Scenario Code Description Purpose
1 SN001 Goods at Standard Rate to Registered Buyers B2B sales with standard 18% GST to registered businesses
2 SN002 Goods at Standard Rate to Unregistered Buyers B2C sales to consumers without STRN
3 SN008 Sale of 3rd Schedule Goods Items under 3rd Schedule with special tax treatment
4 SN026 Sale to End Consumer by Retailers Retail POS transactions
5 SN027 Sale to End Consumer by Retailers Additional retail scenario with variations
6 SN028 Sale to End Consumer by Retailers Retail with different payment modes
Note: The specific scenarios assigned to you may vary based on your business type and registration category. Some businesses may have more or fewer scenarios.

Scenario Details Explained

SN001: Goods at Standard Rate to Registered Buyers

This scenario tests B2B transactions where:

SN002: Goods at Standard Rate to Unregistered Buyers

This scenario tests B2C transactions where:

SN008: Sale of 3rd Schedule Goods

Third Schedule goods have special tax treatment under Sales Tax Act 1990:

SN026-SN028: Retail Consumer Sales

These scenarios test Point of Sale transactions:

Completing Test Scenarios

1Review Sample Code

Click "Sample Code" button to see the expected JSON structure for each scenario.

2Prepare Test Data

Create test invoices matching each scenario's requirements.

3Submit via API

Use your sandbox credentials to submit test invoices.

4Verify Status

Check the Scenario Details popup to confirm "Successful" status for each scenario.

Important: All assigned scenarios must show "Successful" status before you can proceed to production. Even one failed scenario will block production access.

10. Invoice API Structure

Understanding the API structure is crucial for successful integration. Here's a detailed breakdown of the invoice submission API.

Authentication

FBR API uses OAuth 2.0 for authentication. First, obtain an access token:

POST /auth/token
Content-Type: application/x-www-form-urlencoded

grant_type=client_credentials
&client_id=YOUR_CLIENT_ID
&client_secret=YOUR_CLIENT_SECRET

Response:

{
    "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
    "token_type": "Bearer",
    "expires_in": 3600
}

Invoice Submission Request

Submit invoices using the following structure:

POST /api/v1/invoices
Authorization: Bearer YOUR_ACCESS_TOKEN
Content-Type: application/json

{
    "InvoiceNumber": "INV-2025-001234",
    "InvoiceType": 1,
    "InvoiceDate": "2025-12-09",
    "InvoiceTime": "14:30:00",
    "BuyerNTN": "1234567-8",
    "BuyerSTRN": "12-34-5678-901-23",
    "BuyerName": "ABC Company Pvt Ltd",
    "BuyerAddress": "123 Business Street, Karachi",
    "BuyerPhone": "021-1234567",
    "TotalSaleValue": 100000.00,
    "TotalTaxCharged": 18000.00,
    "TotalBillAmount": 118000.00,
    "PaymentMode": 1,
    "Items": [
        {
            "ItemCode": "PROD-001",
            "ItemName": "Product Description",
            "Quantity": 10,
            "UnitPrice": 10000.00,
            "TotalAmount": 100000.00,
            "TaxRate": 18.00,
            "TaxAmount": 18000.00,
            "PCTCode": "85.17"
        }
    ]
}

Invoice Types

Code Type Description
1 Sales Invoice Standard sales invoice
2 Debit Note For additional charges
3 Credit Note For returns/refunds

Payment Modes

Code Mode
1 Cash
2 Card
3 Credit
4 Bank Transfer

Successful Response

{
    "Status": "Success",
    "FBRInvoiceNumber": "IRNM5440194651731D117607057481749",
    "QRCode": "base64_encoded_qr_code_image",
    "VerificationURL": "https://verify.fbr.gov.pk/verify?inv=IRNM5440...",
    "Message": "Invoice submitted successfully"
}

Error Response

{
    "Status": "Error",
    "ErrorCode": "E1001",
    "ErrorMessage": "Invalid buyer STRN format",
    "Details": "STRN must be in format XX-XX-XXXX-XXX-XX"
}

11. Moving to Production

After successfully completing all sandbox test scenarios, you can request production access.

Production Checklist

  • ☑ All test scenarios showing "Successful" status
  • ☑ IP addresses whitelisted for production
  • ☑ Production credentials received
  • ☑ Error handling implemented
  • ☑ Retry mechanism in place
  • ☑ Invoice storage/backup system ready
  • ☑ QR code printing capability (if required)

Requesting Production Access

1Verify Sandbox Completion

Ensure all scenarios show "Successful" in Sandbox Environment section.

2Navigate to Production Environment

Click on "Production Environment" in the API Integration sidebar.

3Request Production Token

Click the button to request production credentials. This may require approval.

4Update Your System

Replace sandbox credentials and endpoints with production values in your software.

Production API Endpoint

Production URL: https://api.fbr.gov.pk/api/v1/ (verify from portal)

Critical: Once in production, every invoice submitted will be recorded in FBR's system and reflected in your tax returns. Double-check all invoice data before submission.

12. Best Practices & Tips

Development Best Practices

Business Best Practices

Security Best Practices

13. Common Errors & Troubleshooting

Authentication Errors

Error Cause Solution
Invalid client credentials Wrong Client ID or Secret Verify credentials from IRIS portal
Token expired Access token has expired Request new token before API call
IP not whitelisted Request from non-whitelisted IP Add server IP in IRIS portal

Invoice Submission Errors

Error Cause Solution
Invalid STRN format Buyer STRN not in correct format Use format: XX-XX-XXXX-XXX-XX
Invalid NTN NTN doesn't exist or is inactive Verify buyer's NTN status
Duplicate invoice Same invoice number submitted twice Use unique invoice numbers
Invalid PCT code Pakistan Customs Tariff code invalid Use valid HS code from tariff schedule
Amount mismatch Calculated totals don't match Verify: Items total + Tax = Bill amount

Connection Errors

Error Cause Solution
Connection timeout FBR server slow/unavailable Implement retry with backoff
SSL certificate error Certificate validation failed Update CA certificates on server
503 Service Unavailable FBR system maintenance Retry later; check FBR notices

14. Frequently Asked Questions

General Questions

Q: Is FBR digital invoicing mandatory?

A: Yes, for certain categories of businesses as notified by FBR. Tier-1 retailers, manufacturers above threshold, and certain service providers must integrate. Check latest SROs for specific requirements.

Q: What is the cost of integration?

A: Using PRAL as Licensed Integrator is free. Other LIs can charge maximum Rs. 10 per invoice or offer monthly/annual packages.

Q: How long does the integration process take?

A: Typically 2-4 weeks including sandbox testing. Timeline depends on your technical readiness and testing completion speed.

Technical Questions

Q: Can I use dynamic IP addresses?

A: No, FBR requires static IP addresses for whitelisting. You must use a server with a fixed IP.

Q: What happens if FBR API is down?

A: Implement a queue system to store invoices locally and submit when API is available. Have a manual backup process for critical invoices.

Q: Can I cancel/modify a submitted invoice?

A: You cannot modify a submitted invoice. You must issue a Credit Note to reverse it and then issue a new corrected invoice.

Q: How do I handle returns?

A: Issue a Credit Note (Invoice Type 3) referencing the original invoice number. This will adjust the tax liability.

Compliance Questions

Q: What is the penalty for non-compliance?

A: Penalties vary but can include fines, suspension of STRN, and other enforcement actions. Consult FBR regulations for specific penalties.

Q: Do I need to print QR codes on invoices?

A: Yes, FBR-compliant invoices must display the QR code returned by FBR API. This allows verification of invoice authenticity.

Need Help with FBR Integration?

SmartInvoice provides ready-to-use FBR-compliant invoicing software with built-in integration. No technical setup required!

Try SmartInvoice Free

Conclusion

FBR Digital Invoicing integration may seem complex initially, but following this step-by-step guide will help you navigate the process successfully. Remember the key steps:

  1. Access IRIS portal and navigate to Digital Invoicing
  2. Choose API Integration mode
  3. Select PRAL as your Licensed Integrator (free option)
  4. Configure technical details and whitelist your IPs
  5. Complete all sandbox test scenarios
  6. Request and receive production credentials
  7. Go live with real invoice submission

Proper FBR integration not only ensures compliance but also automates your tax reporting, reduces manual errors, and provides real-time visibility into your sales tax obligations.

Stay Updated: FBR regularly updates its systems and requirements. Subscribe to FBR notifications and check the IRIS portal periodically for any changes to the integration process.