Dersik e-Invoice Console — documentation

Everything about this demo: what MyInvois is, why it matters now, how to use the console, how it maps to the real LHDN API, and the research behind it. All sources are the official SDK at sdk.myinvois.hasil.gov.my .

What is MyInvois

MyInvois is the Inland Revenue Board of Malaysia's (LHDN/IRBM) national e-Invoicing platform. Under the Income Tax Act 1967, in-scope businesses must submit every invoice to LHDN for near-real-time validation before it is legally recognised. It covers B2B, B2C and B2G transactions.

There are two ways in: the free MyInvois Portal (manual/bulk entry, suited to low volumes) and the System API — a REST interface that ERPs, accounting software and middleware call programmatically. Both channels are free; the API path avoids intermediary per-invoice fees. This console demonstrates the API path.

Compliance timeline

The rollout is phased by annual turnover, measured against 2022 audited financials or tax returns:

PhaseAnnual turnoverMandatory fromStatus
Phase 1> RM100 million1 Aug 2024Live
Phase 2RM25M – RM100M1 Jan 2025Live
Phase 3RM5M – RM25M1 Jul 2025Live
Phase 4RM1M – RM5M1 Jan 2026Live — penalty-free grace until 31 Dec 2027
Phase 5< RM1M—Cancelled (Dec 2025); fully exempt

Two rules matter most right now: each new phase gets a 6-month grace period, and from 1 Jan 2026 consolidated e-Invoices are banned for any transaction over RM10,000 — every qualifying sale needs its own validated document.

Using this demo

The console mirrors an e-Invoice module embedded in an ERP/accounting product. Everything persists in your browser (localStorage) — nothing is stored on a server, and no real taxpayer data is involved.

  1. Master data — review the seeded supplier, buyers, item catalog and the read-only LHDN code tables. Edit or add entries; issued documents snapshot values at pick time, so edits never rewrite history.
  2. Settings — check the connection card (Simulated vs Live), pick the document schema version, set numbering and tax defaults.
  3. New invoice — pick a buyer, add line items, watch live totals. Validate only dry-runs the rule pipeline; Generate & submit sends it through.
  4. Invoice detail — inspect the rendered document, the exact UBL 2.1 JSON sent, and the Submission tab with the returned UUID, SHA-256 hash and QR validation link. Valid documents can be cancelled with a reason.

Architecture — how it maps to the real API

The demo deliberately mirrors the production integration shape, so the same code paths carry over when real credentials are supplied:

StepThis consoleReal MyInvois API
AuthenticateSkipped (no credentials)POST /connect/token
Build documentbuildUblInvoice()UBL 2.1 JSON/XML per document-type version
Encode + hashbase64 + SHA-256document = base64(payload), documentHash = SHA-256
SubmitPOST /api/einvoice/submitPOST /api/v1.0/documentsubmissions/
Validate8-rule engine (rules.ts)8 server-side validators
StatusGET /api/einvoice/statusPoll Get Document Details
QR / validation link{portal}/{uuid}/share/{longId}Identical link format

The real MyInvois pipeline runs eight validators: Structure, Core Fields, Signature, Taxpayer, Referenced Documents, Code, Duplicate Document, and Currency. Our rule engine implements the same groups as data-driven descriptors — new LHDN rules land as new entries, not engine rewrites.

Submission is asynchronous in the real system (HTTP 202, then poll). The mock reproduces that: documents sit at Submitted briefly before reaching Valid, so the status lifecycle in the UI is real.

Research notes

Document statuses

StatusMeaning
Submitted (1)Passed structure checks; full validation pending
Valid (2)Successfully validated — legally recognised
Invalid (3)Failed validation
Cancelled (4)Cancelled by issuer (with reason, within 72h)

Submission constraints

  • 5 MB per submission, 100 documents per batch, 300 KB per document
  • Issue date/time must be UTC, within 72 hours, never in the future
  • Duplicate detection: same type+version, issue datetime, number and supplier TIN within 2 hours
  • Rate limits: ~100 RPM on submit, ~12 RPM on login (token valid 1 hour)

TIN format rules

  • Individuals: IG prefix (replaces OG/SG), ≤ 14 chars total
  • Non-individuals (C, CS, D, F, FA, PT, TA, TC, TN, TR, TP, J, LE): strip leading zeros after the prefix; the TIN must end in 0

Field rules (selection)

FieldRule
Party name≤ 300 chars
EmailRFC 5321/5322, ≤ 320 chars, no spaces
Phone8–20 digits, optional leading +
Address line≤ 150 chars each (up to 3)
MY postcode5 digits
SST number≤ 35 chars, '-' and ';' only, or 'NA'
TTX number≤ 17 chars, '-' only, or 'NA'

v1.0 vs v1.1

The schemas are identical; v1.1 adds XAdES digital-signature validation requiring an organisation certificate from an MCMC-licensed CA. v1.0 remains submittable until LHDN announces retirement. This console builds v1.0 by default; selecting v1.1 in Settings shows the signature requirement in the validation report.

Going live with a real business

  1. In the MyInvois Portal (sandbox: preprod.myinvois.hasil.gov.my), register the ERP under "View and Register ERP" to get a client ID + secret.
  2. Set MYINVOIS_CLIENT_ID, MYINVOIS_CLIENT_SECRET and MYINVOIS_ENV=sandbox — the console switches to live mode automatically. Credentials stay server-side.
  3. For v1.1, procure an organisation digital certificate from an MCMC-licensed CA and implement the XAdES signing step.
  4. Point MYINVOIS_ENV=production when certified and ready.

Limitations & disclaimer

  • This is a demonstration. Without credentials, every "submission" is simulated — nothing reaches LHDN.
  • Master data and invoices live in your browser's localStorage only; clearing site data resets the demo.
  • The validation engine implements the documented rules faithfully but is not a conformance suite — only LHDN's validators are authoritative.
  • Not tax advice. Refer to the IRBM e-Invoice Specific Guideline for legal obligations.

Built by Dersik Solutions as a capability showcase. Not affiliated with LHDN.