Overview
The Mi2u Refund node facilitates the creation of refund invoices (credit notes) using the Mi2u API. It supports two modes of operation:
- Independent Mode: Users provide a supplier's Taxpayer Identification Number (TIN) and an invoice document number. The node automatically searches for the invoice via the Mi2u API and creates a refund invoice based on that data.
- Data Input Mode: Users supply existing invoice data, typically obtained from a prior Mi2uSearch node or manual input, including the original invoice number and UUID. The node then uses this data to generate a refund invoice.
This node is beneficial in automating credit note issuance workflows, especially for businesses managing Malaysian tax invoices electronically. For example, after identifying an invoice that requires a refund, users can either let the node search for it by TIN and document number or directly feed the invoice data to create the corresponding credit note seamlessly.
Properties
| Name | Meaning |
|---|---|
| ⚙️ Operation Mode | Choose how to provide invoice information: - 🔍 Independent Mode - Search and refund with TIN + Document Number - 📋 Data Input Mode - Use existing invoice data from Mi2uSearch |
| 🆔 Supplier TIN | Supplier's Taxpayer Identification Number (required in Independent Mode). Example: C123456789 |
| 📄 Document Number | Invoice code number to search and refund (required in Independent Mode). Example: INV-2024-001 |
| 📄 Original Invoice Number | The invoice number of the original invoice to refund (required in Data Input Mode). Example: INV-2024-001 |
| 🆔 Original Invoice UUID | The UUID of the original invoice to refund (required in Data Input Mode). Typically from Mi2uSearch output |
| 📋 Invoice Data | Complete invoice data JSON, either full Mi2uSearch response or decoded content (required in Data Input Mode) |
Output
The node outputs an array of JSON objects, each representing the result of processing an input item. Each output object contains:
operationMode: The mode used (independentordataInput).returnCode: Response code from the Mi2u API indicating success or failure.returnMsg: Message from the Mi2u API describing the result.invoiceCodeNumber: The generated refund invoice number.originalInvoiceCodeNumber: The original invoice number being refunded.originalInvoiceUuid: The UUID of the original invoice.refundType: Always"Credit Note".cookie: The session cookie used for authentication with the Mi2u API.
If an error occurs and the node is configured to continue on fail, the output includes an error field with the error message, along with the operationMode and the index of the failed item.
The node does not output binary data.
Dependencies
- Requires access to the Mi2u API endpoints:
- Login endpoint to obtain authentication cookies.
- Invoice search and refund endpoints.
- Requires an API key credential with username and password for authenticating against the Mi2u API.
- The node uses the Asia/Kuala_Lumpur timezone for date/time formatting.
- Network connectivity to
https://ics-uat.myinvoice2u.comis necessary.
Troubleshooting
- Login failures: If the node cannot retrieve a session cookie during login, it will throw an error "Login failed - no cookie received." Ensure the provided API credentials are correct and have sufficient permissions.
- Missing required parameters: In Independent Mode, both Supplier TIN and Document Number must be provided; otherwise, the node throws an error.
- Incomplete invoice data: In Data Input Mode, the invoice data must include supplier information and be complete; missing fields cause errors.
- API errors: If the Mi2u API returns an error code or message, it is surfaced in the node output under
returnMsg. Check the message for details. - Time zone issues: The node uses Kuala Lumpur time for timestamps; discrepancies may occur if system time zones differ significantly.
- Continue on Fail: When enabled, the node continues processing subsequent items even if some fail, reporting errors per item.
Links and References
- Mi2u API Documentation (UAT environment URL as seen in code)
- Malaysian Tax Invoice Guidelines
- n8n Documentation on Creating Custom Nodes