Technical Specification for Data Sharing through Software Fiscal Device from TIER 1 Retailer with FBR

Print This Post Print This Post

Introduction

The purpose of the document is to facilitate TIER 1 RETAILER to understand methods for invoice data sharing with FBR. The software fiscal device will be installed on the same computer on which POS is installed. The Fiscal device will be integrated with POS system to fiscalize the invoice and returns Fiscal Invoice Number. For further guidance on integration of retail outlets with board’s computerized system, please follow the Sales Tax Rules,2006 Chapter XIV-AA Online Integration of Tier-1 Retailers.

Figure 1 – Invoice Fiscalization Process

POS will be integrated with FBR as per following steps.

  • Register each POS in FBR system from which you want to upload the data. Details are given in Section POS Registration.
  • Download the software component from the FBR website
  • Install the software on the local computer (*internet connection is required for this step).
  • Taxpayer will integrate their system with FBR software component as per provided details in the Section Integration of Taxpayer System with FBR System.

Scope

The scope of the document is limited to technical description of FBR software fiscal device component. FBR Software Fiscal Device will reside on the same system where the POS is installed by the taxpayer. It will fiscalize each invoice generated through the POS on real time and generate unique fiscal invoice number for each invoice to print on receipt with QR code. Software fiscal device will periodically move recorded invoices data to FBR online system through an independent process.

Defination and Acronyms

Acronym Defination
FBR Federal Board of Revenue
NTN National Tax Number

POS Registration

Tier 1 Retail sector will register their POS for each branch using eFBR portal by providing the required data.

For POS registration, log in on web site https://e.fbr.gov.pk with your user credential and get registered by accessing the page Registration à POS Client Registration

On successful submission of data, FBR will generate POS registration number which will be referenced in compiling each invoice into required format.

Figure 2 – POS Registration – Business Information

Following is the detail of required data for POS registration:

Business Information

Field Mandatory Details
NTN System Generated
Business Name System Generated
STRN No Open field (Numeric)
Brand Name No E.g. Outfitters
Products No Open field
Manufacturer Yes Yes/No
Estimated annual turnover No Open field (Numeric)
Estimated number of transactions per day No Open field (Numeric)
Website URL No Open field
POS Software name No Open field
POS software front/back end technologies No Open field
POS type Yes Cloud Based/Client Server
POS software vendor No Open field
In-house software development Yes Yes/No
Number of technical staff No Open field (Numeric)

Figure 3 – POS Registration – Contact Information

Contact Information

Field Mandatory Field Information
Contact person Yes Contact Person Name
Mobile Yes Open field
Landline number No Open field
Email Yes Open field
Address Yes Open field
Contact Type Yes General/Technical

 Figure 4 – POS Registration – POS Details

 POS Details

Field Mandatory Field Information
POS Identification Number Yes Open field (Unique)
Business Branch Yes Branch Name
Weekly Off Days Yes Select off days i.e. when the POS shall not be operational.
City Yes Branch City
Branch Address Yes Open field
Mac Address Yes Open field
IP address Yes Open field
Sector Yes Select from list of sectors
Latitude Yes Open field (Numeric)
Longitude Yes Open field (Numeric)
Version Yes Open field
Franchise Yes Yes/No
Store Timings (From and To) Yes Open fields
Contact Person Yes Select from provided General contacts

Integration of POS with FBR Software Fiscal Device

FBR has provided the local software fiscal device to Tier 1 Retail sector to share the invoice data with FBR. This component will be accessible only to registered POS Clients. Transaction handling and relevant data dissemination to FBR PRAL will be the responsibility of registered POS Clients.

To facilitate taxpayers, 2 separate Software components shall be made available i.e. a software component for testing and another for live transactions.

For the integration of taxpayer POS with FBR software fiscal device require following steps:

  1. Download the Software Fiscal Device from FBR Web Site
    1. For testing: http://download.fbr.gov.pk/IMS_Setup/FBRIMS.zip
    2. For live transactions: http://download.fbr.gov.pk/ims_setup/ims_production_setup.zip
  2. Install the Setup as instructed in section Installation of the FBR Software Fiscal Device.
  3. After the installation, a Self Hosted Http service will be configured on following address bindings to be integrated with POS:
    • http://localhost:8524/api/IMSFiscal/get
    • It will show “Service is responding”
    • Note: To verify the successful installation of fiscal service. Please confirm fiscalization service is up and running in the system services list (service.msc) as shown in Figure -3.
  4. Consume the local fiscal service (http://localhost:8524/api/IMSFiscal/get) in the POS according to given instruction in Section Steps of Integration for Http Service Consumption.
  5. FBR service will return the invoice number against each record.
  6. The FBR Invoice number should be printed on the Customer invoice receipt along with QR Code.
  7. The invoice data will be periodically uploaded on FBR Servers by the Software fiscal device automatically.

Figure 5 – Fiscalization Service

Installation of the FBR Software Fiscal Device

Following are the pre-requisites for the installation of Software Component.

  • Windows Based Operating System (Win 7 and above).
  • Internet information services (IIS) must be installed.
  • .Net Frame Work 4.5 or above required.
  • Installation User must have the administrator rights.

Following are the Steps for the installation of the FBR Software Component.

  1. Run the Setup.exe as administrator as shown in Figure – 4.
  2. Select the complete radio option and click Next as shown in Figure – 5.
  3. During the installation, setup will prompt for Target Folder and POS Registration Number which is issued at the time of POS Registration as shown in figure – 6.
  4. Press ‘Change Button’ and select the folder in which software component will generate local files.
    • Note: It is recommended to select the Drive other than C Drive for security purpose.
  5. Provide the required POS Registration No and press next.
  6. Click ‘Finish’ to complete the set up.

Figure 6 – Set Up

Figure 7 – Start Installation

Figure 8 – Installation

Figure 9 – Directory and POS Registration Number

Figure 10 – Installation Completed

Integration of Software Fiscalization Component

Invoice Model Details

The fields of the invoice model are given below. 

Name Data Type Status Sample Value
InvoiceNumber varchar(30) Blank
POSID (POS Registration Number given by FBR on registration) bigint Compulsory 100000
USIN varchar(50) Compulsory 001897
RefUSIN varchar(50) Optional 001896
DateTime datetime Compulsory 2018-11-01 00:00:00.000
BuyerName varchar(150) Optional Shahzad Ahmed
BuyerNTN Varchar(9) Optional 1234567-8
BuyerCNIC Varchar(13) Optional 1111122222223
BuyerPhoneNumber varchar(20) Optional 923001234567
TotalSaleValue double Compulsory 1,298 (Sum of Item Sales Values) Exclusive of Tax and Discount
TotalTaxCharged double Compulsory 221  (Sum of Item Tax)
Discount double Optional 380 (Sum of Item Discount)
FurtherTax double Optional 0.00 (Sum of Further Tax)
TotalBillAmount double Compulsory 1,519
TotalSaleValue double Compulsory 1,298 (Sum of Item Sales Values) Exclusive of Tax and Discount
PaymentMode Int Compulsory
  1. Cash
  2. Card
  3. Gift Voucher
  4. Loyalty Card
  5. Mixed
  6. Cheque
InvoiceType Int Compulsory
  1. New
  2. Debit
  3. Credit
List<InvoiceItems> list Compulsory Table No 2

Invoice Data 1

Table No. 2 (recursive, will contain multiple items record in an invoice)

Name Data Type Status Sample Value
ItemCode varchar(50) Compulsory 0001
ItemName varchar(150) Compulsory Blanket
PCTCode varchar(8) Compulsory 01011000 (Should be less than or equal to 8)
Quantity double Compulsory 1.00
TaxRate float Compulsory 17
SaleValue double Compulsory 1,298 (Actual Sale Price on which Tax Calculated) Exclusive of Tax and Discount
Discount double Optional 380.00
FurtherTax double Optional 0.00
TaxCharged double Compulsory 221 (Actual Tax )
TotalAmount double Compulsory 1,519
InvoiceType Int Compulsory
  1. New
  2. Debit
  3. Credit
RefUSIN Varchar Optional (In case of Credit or Debit Note)  

001897

Invoice Item 1

Return Fiscal Invoice Number

Json Response string from FBR Web API

{\”FBRInvoiceNumber\”:11000120181112000369,\”Response\”:\”Invoice received successfully\”,\”Code\”:\”100\”}

.Net Code Example: Fill the invoice object

Invoice objInv = new Invoice();

objInv.InvoiceNumber = string.Empty;

objInv.POSID = 123123;

objInv.USIN = “123457”;

objInv.DateTime = DateTime.Now;

objInv.BuyerNTN = “1234567-9”;

objInv.BuyerCNIC = “12345-1234567-8”;

objInv.BuyerName = “Buyer Name

objInv.BuyerPhoneNumber = “0345-1234567”;

objInv.PaymentMode = 1;

objInv.TotalSaleValue = 0;

objInv.TotalQuantity = 0;

objInv.TotalBillAmount = 0;

objInv.TotalTaxCharged = 0;

objInv.Discount = 1000;

objInv.FurtherTax = 100;

objInv.InvoiceType = 1;

objInv.Items = Items();

private List<InvoiceItems> Items()

{

List<InvoiceItems> lst = new List<InvoiceItems>();

InvoiceItems objItem = new InvoiceItems();

objItem.ItemCode = “0000”;

objItem.ItemName = “Item Name”;

objItem.Quantity = 3;

objItem.TotalAmount = Convert.ToDouble(3000.00);

objItem.SaleValue = Convert.ToDouble(3180);

objItem.TaxCharged = Convert.ToDouble(180);

objItem.TaxRate = 6;

objItem.PCTCode = “11001010”;

objItem.FurtherTax = 20;

objItem.InvoiceType = 1;

objItem.Discount = 500;

lst.Add(objItem);

return lst;

}

WebClient to post data to provided URL and get the response

Below code is used to call the WebAPI. JSON string is passed to the function along with API URL to which data is being posted.

using System.Net.Http;

using Newtonsoft.Json;

HttpClient Client = new HttpClient();

var content = new StringContent(JsonConvert.SerializeObject(objinvoice), Encoding.UTF8, “application/json”);

HttpResponseMessage response = Client.PostAsync(“http://localhost:8524/api/IMSFiscal/GetInvoiceNumberByModel”, content).Result;

if (response.IsSuccessStatusCode)

{

Console.WriteLine(“Response from API”);

Console.WriteLine(“———————————————“);

Console.WriteLine(response.Content.ReadAsStringAsync().Result);

}

Web Client to post data from Cloud and get the response

Below code is used to call the WebAPI. 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/FBR/v1/api/Live/PostData

Production URL:

https://esp.fbr.gov.pk:8244/imsp/v1/api/Live/PostData

using System.Net.Http;

using Newtonsoft.Json;

HttpClient client = new HttpClient();

client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(“Bearer”, “1298b5eb-b252-3d97-8622-a4a69d5bf818”);

StringContent content = new StringContent(JsonConvert.SerializeObject(objinvoice), Encoding.UTF8, “application/json”);

System.Net.ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };

HttpResponseMessage response = client.PostAsync(“https://esp.fbr.gov.pk:8244/FBR/v1/api/Live/PostData“, content).Result;

if (response.IsSuccessStatusCode)

{

Console.WriteLine(“Response from API”);

Console.WriteLine(“———————————————“);

Console.WriteLine(response.Content.ReadAsStringAsync().Result);

}

Sample JSON Format to POST to IMS Component

{
“InvoiceNumber”:””,
“POSID”:110014,
“USIN”:”USIN0″,
“DateTime”:”2020-01-01 12:00:00″,
“BuyerNTN”:”1234567-8″,
“BuyerCNIC”:”12345-1234567-8″,
“BuyerName”:”Buyer Name”,
“BuyerPhoneNumber”:”0000-0000000″,
“TotalBillAmount”:0.0,
“TotalQuantity”:0.0,
“TotalSaleValue”:0.0,
“TotalTaxCharged”:0.0,
“Discount”:0.0,
“FurtherTax”:0.0,
“PaymentMode”:1,

“RefUSIN”:null,
“InvoiceType”:1,
“Items”:[
{
“ItemCode”:”IT_1011″,
“ItemName”:”Test Item”,
“Quantity”:1.0,
“PCTCode”:”11001010″,
“TaxRate”:0.0,
“SaleValue”:0.0,
“TotalAmount”:0.0,
“TaxCharged”:0.0,
“Discount”:0.0,
“FurtherTax”:0.0,
“InvoiceType”:1,
“RefUSIN”:null
},

{
“ItemCode”:”IT_1012″,
“ItemName”:”Test Item”,
“Quantity”:1.0,
“PCTCode”:”11001010″,
“TaxRate”:0.0,
“SaleValue”:0.0,
“TotalAmount”:0.0,
“TaxCharged”:0.0,
“Discount”:0.0,
“FurtherTax”:0.0,
“InvoiceType”:1,
“RefUSIN”:null
}
] }

Posting Model in Postman

GET Endpoint

Request:

Open new tab in Postman and write URL: http://localhost:8524/api/IMSFiscal/Get . Now click send button to check the response from the Fiscalization Service.

Figure 11 Check IMS Service Response

Response:

[

“Service is responding”

]

POST Endpoint

Request:

Open new tab in Postman and write URL: http://localhost:8524/api/IMSFiscal/GetInvoiceNumberByModel

Change type from Get to POST and then Select raw radio button on Postman and change Text to JSON.  Add the sample json mention in section Sample JSON Format to POST to IMS Component.

Now click send button to check the response from the Fiscalization Service.

Figure 12 Post Data to Fiscalization Service

Response:

{

“InvoiceNumber”: “9000052011142444901”,

“Code”: “100”,

“Response”: “Fiscal Invoice Number generated successfully.”,

“Errors”: null

}

 

Technical Support

 

Leave a Reply

Your email address will not be published. Required fields are marked *

three + 18 =