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:
| Phase | Annual turnover | Mandatory from | Status |
|---|---|---|---|
| Phase 1 | > RM100 million | 1 Aug 2024 | Live |
| Phase 2 | RM25M – RM100M | 1 Jan 2025 | Live |
| Phase 3 | RM5M – RM25M | 1 Jul 2025 | Live |
| Phase 4 | RM1M – RM5M | 1 Jan 2026 | Live — 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.
- 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.
- Settings — check the connection card (Simulated vs Live), pick the document schema version, set numbering and tax defaults.
- New invoice — pick a buyer, add line items, watch live totals. Validate only dry-runs the rule pipeline; Generate & submit sends it through.
- 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:
| Step | This console | Real MyInvois API |
|---|---|---|
| Authenticate | Skipped (no credentials) | POST /connect/token |
| Build document | buildUblInvoice() | UBL 2.1 JSON/XML per document-type version |
| Encode + hash | base64 + SHA-256 | document = base64(payload), documentHash = SHA-256 |
| Submit | POST /api/einvoice/submit | POST /api/v1.0/documentsubmissions/ |
| Validate | 8-rule engine (rules.ts) | 8 server-side validators |
| Status | GET /api/einvoice/status | Poll 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
| Status | Meaning |
|---|---|
| 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:
IGprefix (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)
| Field | Rule |
|---|---|
| Party name | ≤ 300 chars |
| RFC 5321/5322, ≤ 320 chars, no spaces | |
| Phone | 8–20 digits, optional leading + |
| Address line | ≤ 150 chars each (up to 3) |
| MY postcode | 5 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
- In the MyInvois Portal (sandbox:
preprod.myinvois.hasil.gov.my), register the ERP under "View and Register ERP" to get a client ID + secret. - Set
MYINVOIS_CLIENT_ID,MYINVOIS_CLIENT_SECRETandMYINVOIS_ENV=sandbox— the console switches to live mode automatically. Credentials stay server-side. - For v1.1, procure an organisation digital certificate from an MCMC-licensed CA and implement the XAdES signing step.
- Point
MYINVOIS_ENV=productionwhen 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.