Step 1 — Create the Invoice
The first step is to collect the invoice data which includes the invoice date, buyer information like name, ntn, province, address and the registration type. The products details like HS-Code, description, unit Price, quantity, sale type, tax rate, further tax, extra tax, withheld at source, FED, discount, value exclusive sales tax and fixed notified or retail price. For this approach in NANU, Just select the invoice date and the buyer from easy to search dropdown and the system will automatically fetch the assiciated items for the selected buyer. Add the quantity and save the invoice.
Step 2 — Invoice Data Validation
FBR provides a dedicated API for invoice data validation. This endpoint returns the validation status and highlights any errors when the submitted invoice data does not comply with FBR’s rules and relational data requirements.
Note: FBR also provides several reference APIs that supply standardized and relational datasets, including:
- HS Codes
- Units of Measurement (UOM)
- Sales Types
- Provinces
- Buyer registration type based on buyer’s NTN/CNIC
- Applicable tax rates according to the selected sale type
- Valid UOMs for the selected HS Code
- SRO schedules based on tax rate and province
- SRO item serials based on the selected SRO schedule
It is the responsibility of the invoicing software to automatically fetch the required reference data from FBR’s APIs during the invoice creation process. The system must ensure that each selected field follows the correct relational rules returned by the API.
The software should also validate the complete invoice on a single click and present clear, user-friendly validation messages so the user can easily understand and correct any issues before submission.
NANU is providing single click validation during the invoice creation so the user can easily indentify the errors inside the invoice data and never gets major problems during the final post.
Step 3 — System Prepares FBR Format (JSON)
FBR IRIS requires a JSON structure with specific keys. A compliant system maps your invoice fields into that JSON automatically. You do not need to write JSON manually if you use NANU or a similar solution.
Step 4 — Submission via CURL / API (The backend operation in softwares just for the understanding)
Submission is performed securely to FBR IRIS. Example (illustrative only):
curl -X POST " https://gw.fbr.gov.pk/di_data/v1/di/postinvoicedata" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-d '{ "invoice": { "buyer": "...", "items": [...] } }'
Note: The exact endpoint and auth method can change — rely on your software provider or FBR API documentation for live endpoints.
Step 5 — FBR Returns IRN
If the invoice is valid, FBR returns an IRN. This number is the unique identifier of the invoice globaly in the FBR system and FBR always track invoice based on this number.
Step 6 — QR Code Generation
This is the most important part of the digital invoicing system as FBR enforces to print the QR code on the invoice.
Based on the FBR IRN the system genrates QR and prints it onto the invoice.
Common Errors During the Invoice Posting
| Error Code | Reason | Solution |
|---|---|---|
| 401 | Unauthorized (Due to the wrong security token or the registration number) | Verify the security token and the registraion number of seller. also note that the sandbox and production tokens and end points are diferent. |
| 500 | Internal Server Error (Due to the unexpected data type or the destination server misconfiguration) | Retry the submission of invoice but carefully verify that the current invoice is not already uploaded to the DI dashboard. |
| 502 (Mostly due to the overloaded destination server) | Bad Gateway Error | Same as 500. |
Note: some of aove mentioned errors lead to multiple submission of the single invoice data which creates the glitch for the users as their IRIS portal shows more number of invoices than actual.
for more information and the solution for this problem please read the following article on NANU.
Reasons of Duplicate Invoice submission problem in FBR Digital invoicing systems and their solution.