Skip to main content
Back to blog
PythonOCRBarcode ScanningAutomationDesktop Application

Bill Payment Automation System Using Python, Barcode Integration and OCR

February 27, 202612 min read

Introduction

High-volume utility bill payment operations are often repetitive, time-intensive, and highly error-sensitive. In environments where hundreds of bills are processed daily, even small data-entry mistakes can create financial and operational risk.

To solve this, I built a Bill Payment Automation System that automates utility bill processing through NADRA e-Sahulat using Python, barcode integration, and OCR-based validation.

This project replaced manual entry-heavy workflows with a scan-driven process that improved speed, accuracy, and operational consistency.

Project Overview

The application was developed as a desktop automation solution for utility bill workflows involving providers such as:

  • LESCO
  • PTCL
  • SNGPL
  • LWASA

Project snapshot:

ItemDetails
IndustryFinancial Services / Utility Bill Payment
CategoryDesktop Application / Automation
Duration12 weeks
StartedJune 2019
RoleFull-Stack Python Developer / Automation Engineer
DeliveryDesktop application (no public live URL)

The Problem

The original process required full manual handling for each bill:

  • Enter consumer number
  • Enter CNIC and mobile details
  • Load bill details in portal
  • Verify amount against physical bill
  • Submit payment manually

At 500 to 700 bills per day, this created major issues:

  • High manual workload and staff fatigue
  • Slow throughput and long processing windows
  • Frequent input errors with irreversible payment consequences
  • Difficult quality control under repetitive conditions

An additional technical challenge was that LESCO barcodes were encrypted and required custom decryption logic before values could be used.

The Solution

I engineered an end-to-end automation pipeline that combines barcode extraction, portal automation, and OCR-based amount verification.

1. Barcode-First Data Capture

The system reads bill barcodes to automatically retrieve key fields such as consumer number, due date, and amount. For LESCO bills, a custom decryption workflow was implemented to decode encrypted barcode content.

2. Python-Based Portal Automation

Automation scripts drive the NADRA e-Sahulat payment flow by simulating user actions, reducing repetitive keyboard and mouse operations while maintaining process control.

3. OCR Verification Layer

Tesseract OCR processes portal screenshots to verify displayed amounts against scanned bill data before payment confirmation, adding an automated validation checkpoint.

4. Operator-Friendly Desktop Interface

The desktop app captures common information (such as CNIC and phone details) once, then supports a scan-and-process workflow for each bill, reducing repetitive input burden.

Technology Stack

  • Python: Core automation and orchestration
  • PyAutoGUI / Mouse and Keyboard SDK: UI interaction automation
  • Tesseract OCR: Screenshot text extraction and validation
  • Barcode Libraries: Barcode decoding and parsing
  • Custom LESCO Decryption Logic: Encrypted barcode handling

Workflow

  1. Operator scans bill barcode
  2. System extracts and parses bill data
  3. App navigates e-Sahulat workflow automatically
  4. OCR reads portal amount and compares it with scanned bill amount
  5. If verification passes, payment proceeds
  6. Status is logged for audit and operational tracking

Impact

The system delivered strong operational improvements:

AreaOutcome
Processing TimeReduced daily processing window from 4 to 6 hours to under 2 hours on average
Error ReductionLowered incorrect payments through automated field handling and OCR checks
ThroughputEnabled faster bill handling with less operator fatigue
ReliabilityImproved consistency for high-volume daily payment operations

Key Engineering Challenges Solved

  • Decrypting and parsing encrypted LESCO barcodes
  • Building robust UI automation for an external portal workflow
  • Maintaining OCR accuracy under real interface conditions
  • Creating safe verification checks before irreversible payment actions

Lessons Learned

  • Repetitive financial workflows are strong candidates for automation
  • Verification layers are critical when operations are irreversible
  • Scan-first design can dramatically reduce operator error rates
  • Small desktop automation tools can create high operational ROI

Future Enhancements

Planned roadmap items include:

  • Broader bill format support across additional providers
  • Better OCR confidence scoring and anomaly detection
  • Enhanced audit dashboards and reporting exports
  • Optional queue-based processing for multi-operator environments

Conclusion

This Bill Payment Automation System demonstrates how Python automation, barcode processing, and OCR can transform a manual, error-prone operation into a faster and more reliable workflow.

By combining practical engineering with operator-focused design, the solution improved daily efficiency, reduced risk, and established a scalable automation foundation for utility payment operations.

Related Projects

Related Articles