Skip to content

thatbeautifuldream/phonepe-txn-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PhonePe Transaction Parser

A Node.js service that parses PhonePe transaction history text files and converts them into structured JSON data.

PhonePe emails a password protected PDF on demand. Needed to convert it to json for my expense tracking app, so here's a service that does that.

Features

  • Parses PhonePe transaction history text files
  • Extracts detailed transaction information including timestamps, amounts, and transaction IDs
  • Returns structured JSON data
  • Includes request logging and error handling
  • Production-ready with proper logging setup

Prerequisites

  • Node.js (v14 or higher)
  • pnpm

Installation

  1. Clone the repository
  2. Install dependencies:
pnpm install

Usage

  1. Start the server:
pnpm start

The server will start on port 3000 by default (configurable via PORT environment variable).

  1. Send a POST request to /process endpoint with a text file:
curl -X POST -F "file=@your-transactions.txt" http://localhost:3000/process

API Response Format

The API returns JSON in the following format:

{
  "success": true,
  "count": number,
  "transactions": [
    {
      "ts": "ISO timestamp",
      "payee": "string",
      "txn_id": "string",
      "utr_no": "string",
      "payer": "string",
      "kind": "string",
      "currency": "string",
      "amount": number
    }
  ],
  "meta": {
    "file_type": "string",
    "original_name": "string",
    "processing_time_ms": number
  }
}

Environment Variables

  • PORT: Server port (default: 3000)
  • NODE_ENV: Environment setting ('development' or 'production')

Credits

This project uses the following open-source packages:

  • Express - Fast, unopinionated web framework for Node.js
  • Multer - Middleware for handling multipart/form-data
  • date-fns - Modern JavaScript date utility library
  • Morgan - HTTP request logger middleware
  • Gist by @vsbabu - Python script that converts phonepe txn to psv

License

MIT

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

About

PhonePe emails a password protected PDF on demand. Needed to convert it to json for my expense tracking app, so here's a service that does that.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors