Pakistan Digital Invoicing Solution

Yes, I have successfully obtained the sandbox token. Please note that sandbox and production tokens are different, and it’s important to request each separately depending on your environment.

Also, IP whitelisting is mandatory before you can post data to the production or sandbox endpoints. Without whitelisting, your POST requests will be blocked.

As for the endpoints:

  • The validation endpoint is used to verify that your invoice payload is compliant with FBR requirements.
  • The POST endpoint is used to submit the actual invoice data to the FBR system once validation is successful.

I’m currently working through the posting step myself, so happy to collaborate with anyone else at this stage.

3 Likes

Thank you for your explanation — I truly appreciate it.

If I may, I’d like to ask a bit further regarding the IP address that needs to be whitelisted on the FBR server. Should it be the IP address of the computer running Manager, the server where the Manager application is hosted, or the server where the extension application is deployed?

Secondly, regarding the endpoint configuration — is my setup below correct?

"PralFbrEndpoints": {
  "Sandbox": {
    "Validate": "https://gw.fbr.gov.pk/di_data/v1/di/validateinvoicedata_sb",
    "Post": "https://gw.fbr.gov.pk/di_data/v1/di/postinvoicedata_sb"
  },
  "Production": {
    "Validate": "https://gw.fbr.gov.pk/di_data/v1/di/validateinvoicedata",
    "Post": "https://gw.fbr.gov.pk/di_data/v1/di/postinvoicedata"
  }
}

2 Likes

endpoints are correct.

but sorry on ip address issue iam also a bit blind

1 Like

@Mabaega if i may ask can you provide me your integration link so i can check it because i have token key and i can also share my key with you

Since I am sending data to the PRAL FBR server from the server side, I should use the public IP address of the server where the extension is deployed. However, I haven’t had a chance to test it yet.

Draft of Integration Guide
PRAL FBR Extension - Integration Info

1 Like

Very good effort i must say.

but upon validation this error is produced.

Thank you for pointing out the error. My code hasn’t reached the stage of communicating with the PRAL server yet, but the information is very helpful and I will try to address it in the next phase.

@uzair94

Could you please try again?
The previous issue was caused by a failed connection to the PRAL server — most likely because the IP address from the Azure server in the India region was blocked.

I have now moved the server to the UAE North region, and I hope the connection to the PRAL server can go through this time, even if it’s not fully successful or still returns some errors.

Additionally, I have changed the extension endpoint from fbr-extension.azurewebsites.net to fbrextension.azurewebsites.net.

Great! now app is connected to FBR i already applied for IP whitelisting.

This validation error came i think some changes needed in code.

Success Invoice Validation Successful

:clipboard: Technical Details:
{
“success”: true,
“data”: {
“status”: “Success”,
“httpStatus”: 200,
“endpoint”: “https://gw.fbr.gov.pk/di_data/v1/di/validateinvoicedata_sb”,
“environment”: “Sandbox”,
“timestamp”: “2025-07-08T07:03:49.2467742Z”,
“response”: {
“dated”: “2025-07-08 12:03:40”,
“validationResponse”: {
“statusCode”: “01”,
“status”: “Invalid”,
“errorCode”: “0012”,
“error”: "Provide Buyer Registration Type. Registered / Unregistered ",
“invoiceStatuses”: null
}
}
},
“message”: “Invoice successfully validated with PRAL FBR”
}

2 Likes

This is good news — the connection to the FBR server is now working without any issues.

The next step is to verify the payload, store the server’s response and generate the QR code in the invoice,

2 Likes

Let’s check the Customer Data, when Registered all fields must be filled in correctly.

it is issue on my end during setup i forgot to add supplier tab. Now iam unable to generate custom fields. Please tell me how to re initiate extension so i can re generate custom fields.

Use the same payload as when creating a new CustomField, but send it using the PUT method instead.

I’ve finished adding all the functionalities to the project. I’m now waiting for someone to try it out.
After everything works as expected, I’ll publish the source code on GitHub.

please explain this

iam ready to do testing

1 Like

This script will generate or replace customfields

// Request untuk Image Custom Field
var key = "d2e9265a-460e-4a06-83f9-29a523a4d516";
var payload = {
  name: "QR Code",
  type: "Image",
  height: 300,
  width: 300,
  placement: ["ad12b60b-23bf-4421-94df-8be79cef533e"],
  displayOnView: true
};
var fullPath = `/api3/image-customfield-form/${encodeURIComponent(key)}`;
await makeManagerApiRequest(fullPath, 'PUT', payload);

// Request untuk Text Custom Field
key = "d2e9265a-460e-4a06-83f9-29a523a4d517";
payload = {
  name: "example text custom field",
  position: 4,
  placement: ["38cf4712-6e95-4ce1-b53a-bff03edad273"],
  size: 2,
  displayOnView: true
};
fullPath = `/api3/text-customfield-form/${encodeURIComponent(key)}`;
await makeManagerApiRequest(fullPath, 'PUT', payload);

function makeManagerApiRequest(path, method = 'GET', body = null) {
    return new Promise((resolve) => {
        const requestId = Math.random().toString(36).substring(2);
        function listener(event) {
            if (event.data?.requestId === requestId) {
                window.removeEventListener("message", listener);
                resolve(event.data.body);
            }
        }
        window.addEventListener("message", listener);

        window.parent.postMessage({
            type: "api-request",
            requestId,
            path,
            method,
            body
        }, "*");
    });
}

@Syed_Salman_Ali @uzair94

Can anyone clarify the “Debit Note” invoice type in FBR eInvoice?
Is the Debit Note referred to here the same as the Debit Note in Manager?

Or could it actually correspond to the Credit Note in Manager, since this invoice type is linked to a Sales Invoice?

=

FBR Extension has been updated to version 25.07.09.002

  • Fixed Invoice Conversion
  • Added support for invoices with Withholding Tax

@Mabaega A New Update scenario id are only required for sandbox testing as now i got my token there is required scenarios or test which i have to complete after that system will automatically generate production token. so sceraio id will not be required in production or real life scenarios.

That has been fixed on version 25.07.09.002

1 Like

Under the Federal Board of Revenue’s (FBR) e-invoicing system, a Debit Note is a specific type of document used to adjust previously issued sales tax invoices. It primarily serves to increase the value of a supply or the amount of sales tax that was originally charged.

Here’s a breakdown of what a Debit Note signifies in the FBR e-invoicing context:

Purpose of a Debit Note:

A Debit Note is issued by the supplier (seller) to the recipient (buyer) in situations where:

  • Original tax invoice was understated: The original invoice issued had a taxable value or tax charged that was less than the actual amount due.
  • Extra goods delivered: Additional goods were supplied beyond what was initially invoiced.
  • Incorrect pricing: Goods already delivered were charged at an incorrect, lower value.
  • Change in the nature or value of supply: Any event that necessitates an increase in the amount payable by the buyer.
  • Cancellation of supply or return of goods (in specific scenarios): While Credit Notes are more commonly associated with returns, a Debit Note can also be used in certain situations where a change leads to an increase in the net amount due.

Key Aspects of a Debit Note in FBR e-invoicing:

  • Issued by the Supplier: The seller is typically the one who issues a Debit Note to increase the amount owed by the buyer.
  • Impact on Sales Tax Liability: When a Debit Note is issued, it increases the seller’s sales tax liability and the buyer’s input tax (if applicable and eligible).
  • Reference to Original Invoice: A Debit Note must clearly reference the number and date of the original sales tax invoice it is amending.
  • Reason for Issuance: It must clearly state the reason for the adjustment (e.g., under-invoicing, additional supply).
  • Particulars Included: As per tax regulations, a Debit Note typically includes:
    • Name and National Tax Number (NTN) of both the recipient and the supplier.
    • Number and date of the original sales tax invoice.
    • The original value and sales tax from the original invoice.
    • The revised value and sales tax.
    • The difference in value and sales tax being adjusted.
    • The reason for the revision.
    • Signature and seal of the authorized person issuing the note.
  • Electronic Submission: Under the FBR’s e-invoicing system, Debit Notes, like sales invoices and Credit Notes, are generated and transmitted electronically to the FBR’s centralized system in real-time. This ensures immediate recording and validation.
  • Adjustment in Returns: Both the buyer and seller must reflect the adjustment made by the Debit Note in their respective sales tax returns for the period in which the note was issued. The buyer will increase their input tax (if eligible) and the supplier will increase their output tax.
  • Timeframe: Generally, adjustments through Debit Notes (and Credit Notes) need to be made within a specified timeframe, often 180 days (with a possible extension by the Commissioner in specific cases) from the relevant supply.

In essence, the Debit Note in FBR’s e-invoicing system is a crucial tool for businesses to correctly account for changes in sales transactions that lead to an increase in the value of the supply or the amount of sales tax due, ensuring compliance and transparency in tax reporting.

I still find it difficult to understand, because FBR eInvoice only has two invoice types.

Who is considered the buyer and who is the supplier in a Debit Note?
And who is responsible for reporting the Debit Note invoice?

To put it simply — can anyone confirm whether the Debit Note in FBR means the same as the Debit Note in Manager?