to select ↑↓ to navigate
Digital Invoicing

Digital Invoicing

Open in ChatGPT
Ask ChatGPT about this page
Open in Claude
Ask Claude about this page

Integrations and API's

This document covers the integration modules and the whitelisted API surface.

Whitelisted API Methods

The main exposed methods are:

  • resync_invoice(doctype, name)
  • validate_invoice(doctype, name)
  • get_invoice_preview(doctype, name)
  • verify_buyer(customer)
  • sync_reference_data(data_type, **kwargs)
  • get_sale_types_for_company(...)

DI API Integration

di.integrations.di_api handles Digital Invoicing payload construction and
submission.

It is responsible for:

  • mapping ERPNext invoices into FBR DI payloads
  • handling sales invoices, purchase invoices, and debit notes
  • resolving item tax values from ERPNext tax rows
  • posting and validating invoices against FBR endpoints
  • saving FBR invoice numbers back onto ERPNext documents
  • logging success and failure responses into DI Log

POS Fiscal Integration

di.integrations.pos_fiscal handles POS invoice fiscalization.

It is responsible for:

  • loading POS credentials from POS Profile
  • validating PCT code availability
  • mapping item invoice types
  • mapping payment mode codes
  • submitting POS payloads
  • storing fiscal response details in DI Log

Reference Data Integration

di.integrations.reference_api syncs FBR reference data including:

  • provinces
  • HS codes
  • HS UOMs
  • transaction types
  • SRO item codes
  • SRO schedules
  • sale type rate data

These sync methods update or create internal reference doctypes.

STATL Integration

di.integrations.statl provides:

  • status checks for active taxpayer verification
  • registration type lookup for a customer NTN/CNIC

QR Code Integration

di.integrations.qr_code generates the QR image used by the UI and print format.

It returns a base64 PNG data URI built from the FBR invoice number.

Endpoint Categories Used

The app calls these FBR service groups:

  • Digital Invoicing API
  • POS Fiscal API
  • Reference Data API
  • STATL API

Logging and Error Handling

All major integration modules log API activity into DI Log.

Typical logged elements include:

  • request payload
  • API response
  • document type and name
  • FBR invoice number
  • error code
  • error message
Last updated 2 months ago
Was this helpful?
Thanks!