I Need Help to Integrate Erpnext with Pakistan’s Tax Dept (FBR) API.
Does the FBR have an API? Can you share details of the API?
sure
2.3 Web API Response
Web clients will get response after post data from Cloud/Client system as per below code, which is used to
call the Web API. JSON string is passed to the function along with API URL to which data is being posted.
Sandbox URL:
https://esp.fbr.gov.pk:8244/DigitalInvoicing/v1/PostInvoiceData_v1
Security Token: 07eabd29-fb34-3a2a-ab73-1ff4eb282aef
Production URL:
https://gw.fbr.gov.pk/pdi/v1/api/DigitalInvoicing/PostInvoiceData_v1
The security token will be provided through registration screens on web portal (e.fbr.gov.pk).
2.4 Sample Code (.Net)
using System.Net.Http;
using Newtonsoft.Json;
HttpClient client = new HttpClient();
client.DefaultRequestHeaders.Authorization = new
AuthenticationHeaderValue(“Bearer”, “07eabd29-fb34-3a2a-ab73-1ff4eb282aef”);
StringContent content = new
StringContent(JsonConvert.SerializeObject(objinvoice), Encoding.UTF8, “application/json”);
System.Net.ServicePointManager.ServerCertificateValidationCallback = delegate {
returntrue; };
HttpResponseMessage response =
client.PostAsync(“https://esp.fbr.gov.pk:8244/DigitalInvoicing/v1/PostInvoiceData_v1”,
content).Result;
if (response.IsSuccessStatusCode)
{
Console.WriteLine(“Response from API”);
Console.WriteLine(“---------------------------------------------”);
Console.WriteLine(response.Content.ReadAsStringAsync().Result);
}
2.5 Sample JSON Format to POST to API
{
“bposId”:“05”,
“invoiceType”: “1”,
“invoiceDate”: “2023-11-24”,
“ntN_CNIC”: “1234567”,
“buyerSellerName”: “string”,
“destinationAddress”: “string”,
“saleType”: 1,
“totalSalesTaxApplicable”: 1234,
“totalRetailPrice”: 1,
“totalSTWithheldAtSource”: 1,
“totalExtraTax”: 1,
“totalFEDPayable”: 1,
“totalWithheldIncomeTax”: 1,
“totalCVT”: 1,
“distributor_NTN_CNIC”: “1234567”,
“distributorName”: “123”,
“invoiceItemDetails”: [
{
“hsCode”: “12345678”,
“productCode”: “string”,
“productDescription”: “string”,
“rate”: 1,
“uoM”: 1,
“quantity”: 1,
“valueSalesExcludingST”: 1,
“salesTaxApplicable”: 1,
“retailPrice”: 1,
“stWithheldAtSource”: 1,
“extraTax”: 1,
“furtherTax”: 1,
“sroScheduleNo”: 999999999,
“fedPayable”: 1,
“cvt”: 1,
“whiT_1”: 1,
“whiT_2”: 1,
“whiT_Section_1”: “”,
“whiT_Section_2”: “”,
“totalValues”: 0
}
]
}
I need too, integegration with FBR
@Hussain_Shabbir I have created an app and made it public. It is built to integrate Sales Invoice with FBR Digital Invoicing.
Please feel free to raise issues if you find any. we are working on it.
Link please
my bad:
Hi @Nasir_Khan,
Could you please clarify:
- Is any license from the FBR required for integration, or can any developer integrate it using the API?
- Can I integrate it directly using your app, or would I need anything else besides an IRIS account?
Thanks.
@Ubaid_Khanzada anyone can use this. All you need is NTN number, Name of Entity and Auth Token.
Thank you @Nasir_Khan for the clarification. I’m installing your app now and will let you know if I encounter any issues.