Project Background
I needed to build a payment system that could monitor MB Bank transactions. Still, I ran into a problem - accessing MB Bank’s official business API requires a corporate tax code and business account registration, which I didn’t have.
Rather than paying for third-party services like casso.vn or payos.vn (which has usage limits), I decided to create my solution by reverse-engineering MB Bank’s web interface and wrapping it into a Python library.
What MBBank-lib Does
This library allows you to:
- Get transaction history from your MB Bank account
- Check account balances in real-time
- View card transaction details
- Access savings account information
Important: For security reasons, the library is read-only - it cannot transfer money or perform any write operations on your account.
Technical Implementation
The library is built using several key technologies:
HTTP Handling
aiohttp
for asynchronous requestsrequests
for synchronous operations
Security & Authentication
wasmtime
to run WebAssembly encryption modules for secure loginpillow
andtesseract
for processing CAPTCHA images during authentication
Architecture The library mimics a web browser’s interaction with MB Bank’s online banking system, handling all the encryption and authentication steps automatically.
Usage Example
import datetime
from mbbank import MBBank
# Initialize and login
mb = MBBank()
await mb.login('username', 'password')
# Get account balance
balance = await mb.get_balance()
# Fetch recent transactions in 30 days
end_query_day = datetime.datetime.now()
start_query_day = end_query_day - datetime.timedelta(days=30)
transactions = await mb.getTransactionAccountHistory(from_date=start_query_day, to_date=end_query_day)
Installation
# Stable version
pip install mbbank-lib
# Development version
pip install git+https://github.com/thedtvn/MBBank
Project Impact
This library solved my immediate need for MB Bank integration while providing a free alternative to paid banking APIs. It’s particularly useful for:
- Small businesses needing transaction monitoring
- Personal finance applications
- Payment verification systems
Repository
The full source code and documentation are available on GitHub.
Note: This is an unofficial library not endorsed by MB Bank. Please be sure to use responsibly and in compliance with MB Bank’s terms of service.