Skip to content

kodlyft/di

Digital Invoicing (DI)

FBR Digital Invoicing and POS Fiscal integration for ERPNext.

This app integrates Pakistan's Federal Board of Revenue (FBR) Digital Invoicing System (PRAL DI API v1.12) and POS Fiscal services with ERPNext so teams can submit, validate, and track tax-compliant invoices inside their ERP workflow. You can find the documentation here

Highlights

  • Post and validate invoices with FBR's Digital Invoicing API
  • Fiscalize POS invoices through the FBR POS Integration Services API
  • Handle return invoices as debit notes automatically
  • Generate FBR-compliant QR codes for posted invoices
  • Sync FBR reference data such as provinces, HS codes, UOMs, and schedules
  • Verify buyer and seller status using the FBR STATL service
  • Support both sales and purchase invoice submission flows
  • Test against bundled sandbox scenarios before production rollout

Requirements

Dependency Version
Python >= 3.14
Frappe Framework >= 16.0.0
ERPNext >= 16.0.0
qrcode >= 8.2

Installation

cd $PATH_TO_YOUR_BENCH
bench get-app https://github.com/kodlyft/di --branch version-16
bench setup requirements
bench --site your-site.com install-app di
bench --site your-site.com migrate

Use develop only if you need unreleased in-progress changes.

Configuration

1. DI Settings

Create a DI Settings record for each company that needs Digital Invoicing:

  • Set Company
  • Enable Digital Invoicing
  • Choose Sandbox or Production
  • Add the FBR Access Token
  • Fill NTN/CNIC, Province, and Address

2. Customer Setup

For each customer that should be reported through DI:

  • Enable Digital Invoicing
  • Fill NTN/CNIC
  • Select Province
  • Set Registration Type
  • Fill DI Address

3. Item Setup

Under the DI settings section on each Item:

  • Set HS Code
  • Set Sale Type
  • Fill any applicable SRO fields

4. Tax Setup

On Sales Taxes and Charges templates, set the Tax Type field to one of:

  • Sales Tax
  • Further Tax
  • Advance Tax

5. POS Fiscal Setup

On POS Profile:

  • Enable FBR Integration
  • Set FBR Environment
  • Set FBR POS ID
  • Set FBR Bearer Token

On Mode of Payment, set the FBR Payment Mode Code from 1 to 6.

Usage

Automatic Posting

When Auto Post on Submit is enabled in DI Settings, supported invoices are posted to FBR automatically during submission.

Manual Actions

On submitted Sales Invoices, the Digital Invoicing menu supports:

  • Post to FBR
  • Validate with FBR
  • DI Preview
  • Verify Buyer

Reference Data Sync

Use the Sync Reference Data actions in DI Settings to fetch:

  • Provinces
  • HS Codes
  • UOMs
  • Transaction Types
  • SRO Item Codes

Development

cd apps/di
pre-commit install
pre-commit run --all-files
bench --site your-site.com run-tests --app di

The repository uses ruff, eslint, prettier, GitHub Actions CI, dependency review, and CodeQL scanning.

Project Docs

Releases

GitHub releases are built from version tags that match v*. Release notes are generated automatically from the tagged changes on version-16.

License

MIT

About

A digital invoicing and FBR POS Fiscalizing app

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors