Mi2u LHDN Valid Status icon

Mi2u LHDN Valid Status

Checks invoice validation status. Manual mode executes immediately, Webhook mode waits for POST data.

Overview

This node, Mi2u LHDN Valid Status, is designed to check the validation status of invoices through the Mi2u (MyInvoice2u) API. It supports two trigger modes:

  • Webhook mode: The node waits for incoming POST data containing invoice details and an authentication cookie, then queries the invoice status.
  • Manual mode: The node performs immediate execution using user-provided credentials and invoice details.

The node can optionally poll the API repeatedly until the invoice reaches a final validated or invalid status, making it useful for workflows that need to track invoice processing asynchronously.

Common scenarios:

  • Automatically verifying invoice validation status after submission.
  • Integrating invoice status checks into accounting or ERP workflows.
  • Sending notifications or triggering downstream processes based on invoice validation results.

Practical example:

  • A webhook receives invoice details from another system, triggers this node to check the invoice status, and then routes the result to notify users via Telegram or update a database.

Properties

Name Meaning
Trigger Source Choose how to trigger this node:
- Webhook: Waits for POST data from an HTTP node.
- Manual: Executes immediately with provided credentials and invoice info.
Username Username for Mi2u authentication (required in Manual mode).
Password Password for Mi2u authentication (required in Manual mode).
Supplier TIN Supplier Taxpayer Identification Number (required in Manual mode).
Document Number The document number (invoice code number) to check (required in Manual mode).
Page Number Page number for pagination when querying records (default: 1).
Page Size Number of records per page to retrieve (default: 20).
Enable Status Polling Whether to enable polling to repeatedly check invoice status until it becomes validated (status 101) or invalid (status 102) (default: true).
Polling Interval (Seconds) Interval in seconds between each status check when polling is enabled (default: 30).
Max Polling Attempts Maximum number of polling attempts before giving up (default: 10).
Telegram Chat ID Optional Telegram chat ID for notifications; passed along but not used in API calls. Usually fetched by webhook, no manual input needed.

Output

The node outputs JSON data representing the invoice status response from the Mi2u API. The structure includes:

  • records or data: An array of invoice records returned by the API.
  • Invoice status fields such as invoiceStatus, status, or validationStatus.
  • Additional invoice details like dateTimeValidated, documentNum, supplierTin, supplierName, buyerName, invoiceUuid, total.
  • Flags such as isValidated (true if status is "101").
  • Full API response data under fullApiResponse and data.
  • Metadata including the authentication cookie used and optional chatId and invoiceCodeNumber.

If polling is enabled, the output reflects the final status after repeated checks.

Binary data: This node does not output binary data.


Dependencies

  • Requires access to the Mi2u API endpoints:
    • Login endpoint to obtain an authentication cookie.
    • Invoice status query endpoint.
  • Requires an API key credential in Manual mode (username and password).
  • For Webhook mode, requires the client to provide an authentication cookie in the POST payload.
  • Network connectivity to https://ics-uat.myinvoice2u.com (UAT environment URL shown).
  • Optional integration with Telegram via passing chat ID (actual notification sending handled externally).

Troubleshooting

Common issues:

  • Missing required fields: In webhook mode, missing documentNumber or supplierTin in POST data causes a 400 error.
  • Missing authentication cookie: Webhook requests without a valid cookie will be rejected with a 401 error.
  • Login failure: In manual mode, incorrect username/password prevents obtaining the authentication cookie.
  • API response decoding errors: If the base64-decoded content cannot be parsed as JSON, an error is logged and returned.
  • No records found: The API may return empty results, leading to warnings and empty outputs.
  • Polling limits reached: If the invoice status does not reach a final state within max polling attempts, the last known status is returned.

Error messages and resolutions:

  • "Missing required fields...": Ensure POST data includes both documentNumber and supplierTin.
  • "Authentication cookie is required...": Provide a valid authentication cookie in the webhook POST body.
  • "Login failed - could not obtain authentication cookie": Verify username and password are correct.
  • "Failed to decode content": Check API response format or network issues.
  • "No records found": Confirm the invoice exists and parameters are correct.
  • "Error checking invoice status: <message>": General catch-all for unexpected errors; review logs and API availability.

Links and References

Discussion