transaction_sms_parser 0.0.1
transaction_sms_parser: ^0.0.1 copied to clipboard
A powerful Dart/Flutter package for parsing transaction SMS messages from banks, payment apps, and digital wallets. Extract amounts, account info, card details, wallet providers, merchant names, and balances.
๐ณ Transaction SMS Parser #
A powerful and intelligent Dart/Flutter package for parsing transaction SMS messages from banks, payment apps, and digital wallets. Extract comprehensive transaction details including amounts, account types, card information, wallet providers, merchant details, and balance information with high accuracy.
โจ Features #
- ๐ฆ Multi-Source Support: Parse SMS from 30+ Indian banks and financial institutions
- ๐ณ Card Detection: Identify credit/debit cards with scheme detection (Visa, Mastercard, RuPay, Amex, Maestro, Diners)
- ๐ฑ Digital Wallets: Support for 14 popular wallets (PayTM, PhonePe, Amazon Pay, MobiKwik, etc.)
- ๐ UPI Transactions: Extract UPI IDs, merchant info, and reference numbers (95+ UPI handles supported)
- ๐ฐ Smart Parsing: Intelligent extraction of amounts, transaction types (debit/credit), and balances
- ๐ช Merchant Detection: Identify merchant names and payment details
- ๐ Balance Information: Available balance and outstanding balance (for credit cards)
- ๐ฏ Type-Safe: Full TypeScript-like type safety with Dart enums and models
- ๐งช Well-Tested: Comprehensive test coverage
- ๐ High Performance: Optimized pattern matching and processing
๐ฏ Supported Features #
Account Types #
- Bank Accounts (AC, Account, A/C)
- Credit Cards (Visa, Mastercard, RuPay, Amex, Diners)
- Debit Cards (Visa, Mastercard, Maestro, RuPay, SBI Maestro)
- Digital Wallets (14 providers)
- UPI Transactions (95+ UPI handles)
Card Schemes #
| Scheme | Supported |
|---|---|
| Visa | โ |
| Mastercard | โ |
| Maestro | โ |
| RuPay | โ |
| American Express | โ |
| Diners Club | โ |
| SBI Maestro | โ |
Supported Wallets #
| Wallet | Code |
|---|---|
| PayTM | paytm |
| PhonePe | phonePe |
| Amazon Pay | amazonPay |
| MobiKwik | mobikwik |
| Freecharge | freecharge |
| Airtel Money | airtelMoney |
| Ola Money | olaMoney |
| Jio Money | jioMoney |
| HDFC PayZapp | payZapp |
| Yes Bank Wallet | yesBank |
| ItzCash | itzCash |
| Oxigen | oxigen |
| Simpl | simpl |
| LazyPay | lazyPay |
Supported Banks (30+) #
SBI, HDFC, ICICI, Axis, Kotak, PNB, Bank of Baroda, Bank of India, IDBI, IDFC First, Yes Bank, RBL, IndusInd, Federal Bank, Citi, HSBC, Standard Chartered, DBS, Union Bank, Canara Bank, and more...
๐ฆ Installation #
Add this to your package's pubspec.yaml file:
dependencies:
transaction_sms_parser: ^0.0.1
Then run:
dart pub get
# or for Flutter projects
flutter pub get
๐ Quick Start #
import 'package:transaction_sms_parser/transaction_sms_parser.dart';
void main() {
const smsMessage = 'Rs.500.00 debited from card 1234 on 01-Jan-23. Avbl bal Rs.10000.00';
final transactionInfo = TransactionEngine.getTransactionInfo(smsMessage);
print('Account Type: ${transactionInfo.account.type}');
print('Card Number: ${transactionInfo.account.number}');
print('Transaction Type: ${transactionInfo.transaction.type}');
print('Amount: ${transactionInfo.transaction.amount}');
print('Balance: ${transactionInfo.balance?.available}');
}
๐ Usage Examples #
1. Bank Account Transaction #
const message = 'Rs.1000.00 credited to AC 5678 on 01-Jan-23. Available balance Rs.20000.00';
final result = TransactionEngine.getTransactionInfo(message);
// Output:
// account.type: AccountType.account
// account.number: "5678"
// account.bankName: "HDFC Bank" (if detected)
// transaction.type: TransactionType.credit
// transaction.amount: "1000.00"
// balance.available: "20000.00"
2. Credit Card Transaction with Full Details #
const message = 'Rs.2000 spent on HDFC Visa Credit Card 4321. Avbl credit limit Rs.50000. Outstanding Rs.10000';
final result = TransactionEngine.getTransactionInfo(message);
// Output:
// account.type: AccountType.card
// account.cardType: CardType.credit
// account.cardScheme: CardScheme.visa
// account.bankName: "HDFC Bank"
// account.number: "4321"
// transaction.type: TransactionType.debit
// transaction.amount: "2000.00"
// balance.available: "50000.00"
// balance.outstanding: "10000.00"
3. Digital Wallet Transaction #
const message = 'Rs.250 debited from Paytm wallet. Available bal Rs.750';
final result = TransactionEngine.getTransactionInfo(message);
// Output:
// account.type: AccountType.wallet
// account.walletType: WalletType.paytm
// account.name: "paytm"
// transaction.type: TransactionType.debit
// transaction.amount: "250.00"
// balance.available: "750.00"
4. UPI Transaction #
const message = 'Rs.500 sent to merchant@ybl via UPI. UPI Ref No 123456789. Avbl bal Rs.5000';
final result = TransactionEngine.getTransactionInfo(message);
// Output:
// account.type: AccountType.upi
// account.name: "merchant@ybl"
// transaction.type: TransactionType.debit
// transaction.amount: "500.00"
// transaction.merchant: "merchant"
// transaction.referenceNo: "123456789"
// balance.available: "5000.00"
5. PhonePe Transaction #
const message = 'Rs 150.00 debited from account ending 1234 to 9876543210@ybl on 04-11-25. UPI Ref: 432198765';
final result = TransactionEngine.getTransactionInfo(message);
// Output:
// account.type: AccountType.upi
// account.name: "9876543210@ybl"
// transaction.amount: "150.00"
// transaction.referenceNo: "432198765"
๐ง API Reference #
Main Class: TransactionEngine #
getTransactionInfo(String message)
Parses a complete transaction SMS and returns a TransactionInfo object.
static TransactionInfo getTransactionInfo(String message)
Models #
TransactionInfo
class TransactionInfo {
final AccountInfo account;
final Balance? balance;
final Transaction transaction;
}
AccountInfo
class AccountInfo {
final AccountType? type; // card, wallet, account, upi
final String? number; // Last 4 digits
final String? name; // Wallet/account name
final WalletType? walletType; // Specific wallet provider
final CardType? cardType; // credit or debit
final CardScheme? cardScheme; // visa, mastercard, etc.
final String? bankName; // Bank name
}
Transaction
class Transaction {
final TransactionType? type; // debit or credit
final String? amount; // Transaction amount
final String? merchant; // Merchant name or UPI ID
final String? referenceNo; // Transaction reference
}
Balance
class Balance {
final String? available; // Available balance
final String? outstanding; // Outstanding amount (cards)
}
Individual Parsers #
You can also use individual parsers for specific information:
// Transaction amount only
final amount = TransactionParser.getTransactionAmount('Rs.500 debited');
print(amount); // "500.00"
// Transaction type only
final type = TransactionParser.getTransactionType('Amount credited');
print(type); // TransactionType.credit
// Account info only
final account = AccountParser.getAccountInfo('Payment from AC 1234');
print(account.type); // AccountType.account
print(account.number); // "1234"
// Balance only
final balance = BalanceParser.getBalance('Available balance Rs.10000', BalanceKeywordType.available);
print(balance); // "10000.00"
// Merchant info only
final merchant = MerchantParser.extractMerchantInfo('Paid to merchant@upi');
print(merchant.merchant); // "merchant"
๐งช Testing #
The package includes comprehensive tests. Run them with:
dart test
# or for Flutter projects
flutter test
๐ค Contributing #
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
Development Setup #
- Clone the repository
- Run
dart pub getorflutter pub get - Make your changes
- Add tests for new features
- Run tests with
dart testorflutter test - Submit a pull request
๐ License #
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Acknowledgments #
- Inspired by the need to parse financial SMS messages in Indian banking ecosystem
- Built with โค๏ธ using Dart and Flutter
- Special thanks to all contributors
๐ Support #
If you like this package, please give it a โญ on GitHub!
For issues and feature requests, please file them in the issue tracker.
๐ Changelog #
See CHANGELOG.md for a list of changes in each version.
๐ Additional Resources #
Made with โค๏ธ for the Flutter community