Package Information
Available Nodes
Documentation
n8n-nodes-mi2u
The Complete Malaysian E-Invoice Solution for n8n
This comprehensive n8n community node package connects you to the MyInvoice2U (Mi2u) ICS API for seamless Malaysian e-invoice processing with LHDN compliance. Perfect for businesses, developers, and automation enthusiasts who need reliable e-invoice management.
Table of Contents
- What This Package Does
- Available Nodes
- Quick Start
- Installation
- Node Documentation
- E-commerce Integration
- Troubleshooting
- Resources
What This Package Does
The n8n-nodes-mi2u package provides 8 powerful nodes for complete Malaysian e-invoice lifecycle management:
- Create invoices with multiple processing modes
- Search and retrieve existing invoices
- Refund invoices with automatic credit note generation
- Cancel and void invoices with proper LHDN compliance
- Generate PDF documents automatically
- Validate invoice status with LHDN
- Authenticate users and manage credentials
- Integrate seamlessly with Shopify and other platforms
Available Nodes
Mi2uCreate - Invoice Creation Powerhouse
Three Smart Processing Modes:
- Manual Mode: Full control with user-friendly dropdowns
- Smart Mode: Bulk processing with automatic grouping
- Shopify Mode: Direct e-commerce integration
Key Features:
- Automatic Issue Mode detection (Mode 1 vs Mode 2)
- Built-in LHDN code dropdowns (countries, states, currencies)
- Shopify TIN/NRIC extraction from checkout data
- Smart validation to prevent API errors
- Bulk processing capabilities
Mi2uSearch - Invoice Discovery
Find invoices quickly with:
- TIN and document number search
- Comprehensive invoice data retrieval
- Integration-ready output format
Mi2uRefund - NEW Enhanced
Two Operation Modes:
- Independent Mode: Just provide TIN + Document Number → Auto-search + Refund
- Data Input Mode: Use existing Mi2uSearch output
Features:
- Automatic credit note generation (Invoice Type 04)
- Smart refund invoice numbering (
refund_{originalNumber}) - Preserves all original invoice data
- No dependency on Mi2uSearch node in Independent Mode
Mi2uCancel - NEW Enhanced
Five Operation Modes:
- Independent Cancel: TIN + Document Number → Auto-search + Cancel
- Independent Void: TIN + Document Number → Auto-search + Void
- Traditional Cancel: Manual invoice ID input
- Traditional Void: Manual document number input
- Shopify Mode: Automated cancel + void workflow
Features:
- Built-in Malaysian cancel codes (01-08)
- Automatic search integration
- Proper void-after-cancel workflow
- No dependency on Mi2uSearch node in Independent Modes
Mi2uPdf - Document Generation
Webhook-powered PDF generation:
- Self-validate mode with polling
- Automatic PDF retrieval after LHDN validation
- Binary data output for file handling
Mi2uLhdnValidStatus - Status Validation
Real-time LHDN status checking:
- Webhook trigger for status updates
- Automatic validation monitoring
- Integration with PDF generation
Mi2uAuth - Authentication Management
Credential detection and management:
- Email and TIN-based authentication
- Self-service credential validation
- Session management
Mi2u - Base API Node
Core API functionality:
- Direct API access
- Custom request handling
- Advanced integration scenarios
Installation
Option 1: n8n Community Marketplace (Recommended)
- Open your n8n instance
- Go to Settings → Community Nodes
- Click Install a Community Node
- Enter:
n8n-nodes-mi2u - Click Install
Option 2: Manual Installation
npm install n8n-nodes-mi2u
Option 3: Docker Environment
# Add to your n8n Dockerfile
RUN npm install n8n-nodes-mi2u
Quick Start
Step 1: Set Up Credentials
- Navigate to Credentials in your n8n instance
- Click Create New Credential
- Select Mi2u API from the dropdown
- Enter your MyInvoice2U credentials:
- Username: Your Mi2u email address
- Password: Your Mi2u password
- Click Save
Step 2: Choose Your Workflow
Simple Invoice Creation
Trigger → Mi2uCreate (Manual Mode) → Done!
Complete Invoice Lifecycle
Trigger → Mi2uCreate → Mi2uLhdnValidStatus → Mi2uPdf → Email/Storage
E-commerce Automation
Shopify Trigger → Mi2uCreate (Shopify Mode) → Mi2uPdf → Customer Email
Refund Processing (NEW!)
Trigger → Mi2uRefund (Independent Mode) → Done!
# Just provide TIN + Document Number - no Mi2uSearch needed!
Invoice Cancellation (NEW!)
Trigger → Mi2uCancel (Independent Cancel) → Done!
# Just provide TIN + Document Number - automatic search + cancel!
Step 3: Test Your Setup
- Create a simple workflow with Mi2uCreate
- Select Manual Mode for testing
- Fill in the required fields
- Execute the workflow
- Check the output for successful invoice creation
Node Documentation
Mi2uCreate - Invoice Creation
Manual Mode - Perfect for individual invoices
- Complete control over every field
- User-friendly LHDN code dropdowns
- Ideal for custom invoices and corrections
Smart Mode - Best for bulk processing
- Upload structured data (Excel, CSV, JSON)
- Automatic line item grouping
- Efficient multi-invoice processing
Shopify Mode - E-commerce automation
- Direct Shopify order integration
- Automatic buyer TIN/NRIC extraction
- Seamless order-to-invoice conversion
Mi2uRefund - Credit Note Creation (NEW)
Independent Mode (Recommended)
Input: TIN + Document Number
↓
Automatic invoice search
↓
Generate refund invoice
↓
Output: Credit Note (Type 04)
Data Input Mode (Traditional)
Input: Mi2uSearch output + Original Invoice UUID
↓
Generate refund invoice
↓
Output: Credit Note (Type 04)
Mi2uCancel - Invoice Management (NEW)
Independent Cancel
Input: TIN + Document Number + Cancel Reason
↓
Automatic search + cancel
↓
Output: Cancelled invoice
Independent Void
Input: TIN + Document Number
↓
Automatic search + void
↓
Output: Voided transaction
Traditional Modes
- Manual invoice ID input for cancel operations
- Manual document number input for void operations
- Shopify automated cancel+void workflow
Mi2uSearch - Invoice Discovery
Usage:
Input: TIN + Document Number
↓
Search Mi2u database
↓
Output: Complete invoice data
Perfect for:
- Finding existing invoices
- Preparing data for refunds/cancellations
- Integration with other nodes
E-commerce Integration
Shopify Setup Guide
1. Configure Checkout Fields
Add custom fields to collect TIN/NRIC:
<!-- In your checkout template -->
<input name="attributes[TIN]" placeholder="Company TIN (Optional)">
<input name="attributes[NRIC]" placeholder="NRIC (Optional)">
2. Order Data Structure
Ensure data is stored in note_attributes:
{
"note_attributes": [
{"name": "TIN", "value": "IG40176873020"},
{"name": "NRIC", "value": "960528016739"}
]
}
3. n8n Workflow
Shopify Trigger → Mi2uCreate (Shopify Mode) → Mi2uPdf → Email
WooCommerce Integration
WooCommerce Trigger → Mi2uCreate (Smart Mode) → Processing
Custom E-commerce Platforms
Webhook Trigger → Data Transform → Mi2uCreate → Response
Built-in LHDN Codes
All nodes include comprehensive LHDN code support:
Country Codes
- MYS (Malaysia), SGP (Singapore), THA (Thailand), etc.
- Full ISO country code support
State Codes
- 01-17 for all Malaysian states
- Automatic validation
Currency Codes
- MYR (Malaysian Ringgit)
- USD, EUR, SGD, and more
Tax Types
- 01: Standard Rate
- 02: Zero Rate
- 03: Exempt
- And more...
Classification Codes
- Built-in product/service classifications
- LHDN-compliant categories
Troubleshooting
Common Issues & Solutions
"Issue Mode Error"
Problem: Wrong issue mode selected
Solution:
- Issue Mode 1: When buyer TIN/NRIC available
- Issue Mode 2: For simplified invoices
- Use Shopify mode for automatic detection
"Empty Field Validation Error"
Problem: Required fields missing
Solution:
- All amount fields default to "0"
- Check required field indicators (red asterisk)
- Use Manual mode for full control
"Authentication Failed"
Problem: Invalid credentials
Solution:
- Verify Mi2u username/password
- Check credential configuration
- Test with Mi2uAuth node
"Search Failed in Independent Mode"
Problem: Invoice not found
Solution:
- Verify TIN format (e.g., C1234567890)
- Check document number exactly matches
- Use Mi2uSearch first to verify data
Getting Help
- Check the logs - n8n execution logs show detailed error messages
- Test step by step - Use Manual mode to isolate issues
- Verify credentials - Use Mi2uAuth to test authentication
- Check LHDN status - Some errors come from LHDN validation
Resources
Official Documentation
Learning Resources
Development
Changelog
v0.2.3 - Latest Release
Major Enhancements:
- Mi2uRefund Independent Mode - No more Mi2uSearch dependency!
- Mi2uCancel Independent Modes - Auto-search + cancel/void
- 5 Operation Modes in Mi2uCancel for maximum flexibility
- Enhanced Error Handling across all nodes
- Improved UI/UX with better field organization
Technical Improvements:
- Integrated MY111 search functionality into Refund/Cancel nodes
- Smart authentication cookie reuse
- Better validation and error messages
- Backward compatibility maintained
E-commerce Features:
- Enhanced Shopify integration
- Automatic TIN/NRIC extraction
- Improved order-to-invoice mapping
Previous Versions
- v0.2.2: Enhanced UI with emoji icons
- v0.2.1: Shopify integration improvements
- v0.2.0: Smart mode and bulk processing
- v0.1.x: Initial release with basic functionality
License
This project is licensed under the MIT License - see the LICENSE.md file for details.