E-Invoice Submission
This section covers the complete e-invoice submission lifecycle in BigLedger — from company setup, through document finalization, queue processing, pool routing, and final LHDN submission.
Base URL (Submission APIs): https://api.akaun.com/core2/tnt/dm/erp/fi/e-invoice/to-irbs
Required Permissions: API_TNT_DM_ERP_MY_E_INVOICE_TO_IRB_OWNER or API_TNT_DM_ERP_MY_E_INVOICE_TO_IRB_ADMIN
Pre-Requisites
Company Setup on LHDN Portal
Before any e-invoice can be submitted, the company must be registered as an intermediary on LHDN MyInvois:
Set BLG ERP as the intermediary on the LHDN Portal for both the pre-production (sandbox) and production environments. Follow this setup guideline: LHDN Intermediary Setup Guide
Configure company identity fields in the
bl_fi_mst_comptable:Field Column Description TIN einvoice_tax_id_noCompany TIN issued by LHDN Identification Number einvoice_id_valueBRN, NRIC, or Passport number Identification Type einvoice_id_typeBRN,NRIC, orPASSPORTAddress Line 1 address_line_1Registered business address City cityCity Postcode postal_codePostal code State stateState Country countryCountry code (e.g. MY)Contact Number phoneCompany phone number Email emailCompany email address Click Save — the system will then establish the integration link between BigLedger and the LHDN portal.
Transaction-Level Setup
When creating transactions, the following JSON fields must be filled in on bl_fi_generic_doc_hdr:
- Sales document types: populate
einvoice_buyer_entity_hdr_jsonwith the buyer’s identity details (TIN, ID type/value, address, contact). - Purchase document types: populate
einvoice_supplier_entity_hdr_jsonwith the supplier’s identity details.
This is the responsibility of the external API or system creating the transaction.
Document Types That Trigger E-Invoice Processing
When a transaction is finalized, the system checks the document type. If it matches any of the following, it enters the e-invoice submission pipeline:
Sales Documents
| Document Type | Description |
|---|---|
INTERNAL_SALES_INVOICE | Sales invoice |
INTERNAL_SALES_DEBIT_NOTE | Sales debit note |
INTERNAL_SALES_CREDIT_NOTE | Sales credit note |
INTERNAL_SALES_REFUND_NOTE | Sales refund note |
INTERNAL_SALES_CASHBILL | Sales cashbill |
INTERNAL_SALES_RETURN | Sales return |
Purchase Documents
| Document Type | Description |
|---|---|
INTERNAL_PURCHASE_INVOICE | Purchase invoice |
INTERNAL_PURCHASE_SELF_BILLED_INVOICE | Purchase self-billed invoice |
INTERNAL_PURCHASE_DEBIT_NOTE | Purchase debit note |
INTERNAL_PURCHASE_CREDIT_NOTE | Purchase credit note |
INTERNAL_PURCHASE_REFUND_NOTE | Purchase refund note |
INTERNAL_PURCHASE_RETURN | Purchase return |
E-Invoice Submission Flow
The operator’s view of this routing — the pool screens, what each button does, and worked examples — is the pools and routing guide and the My E-Invoice Admin applet reference. This page keeps to the tables, processors and endpoints.
Step 1 — Posting Queue
When a matching transaction is finalized, it is pushed into the Posting Queue tracked by the bl_fi_generic_doc_einvoice_posting_queue table.
- Processor:
GENERIC_DOCUMENT_E_INVOICE_POSTING_QUEUE_PROCESSOR
The system processes this queue automatically and routes each document into one of the pools below.
Step 2 — Pool Routing
The processor (E_INVOICE_GENERIC_DOCUMENT_TO_IRB_PROCESSOR) evaluates each document and routes it to one of three pools based on the configured submission type and whether LHDN mandatory fields are satisfied.
2.1 Batch Pool (bl_fi_my_einvoice_batch_pool_doc_hdr)
Used for outgoing sales documents (SINV, SCN, etc.) without a specific submission type set, when LHDN mandatory fields (buyer TIN, ID type/value, address) are missing.
| Step | Description |
|---|---|
| Land in batch pool | Document is placed in bl_fi_my_einvoice_batch_pool_doc_hdr |
| Fix and resubmit | Correct the buyer or supplier on the pool row (PUT core2/tnt/dm/erp/e-invoice/batch-pool-doc-hdrs/backoffice-ep), then call the pool’s own Save and Resubmit, POST …/batch-pool-doc-hdrs/save-and-resubmit/backoffice-ep with batchPoolGuid. It copies the row’s buyer and supplier onto the document, sets its submission type to INDIVIDUAL, re-runs the mandatory check and, if it passes, creates the e-invoice record and queues it. Pass or fail, the row is marked PROCESSED (why that matters). This is not API 2, which needs a record the pooled document does not have yet |
| Automatic consolidation | If the batch pool document remains UNPROCESSED, the system consolidates it into a consolidated e-invoice. The resulting submission record is in bl_fi_my_einvoice_to_irb_hdr, tracked by bl_fi_my_einvoice_consolidated_submission_queue |
| Manual consolidation | Use POST core2/tnt/dm/erp/e-invoice/batch-pool-doc-hdrs/consolidate-batch-pools/backoffice-ep to consolidate batch pool records manually by document |
2.2 Individual Pool (bl_fi_my_einvoice_individual_pool_doc_hdr)
Used when the einvoice_submission_type is set to INDIVIDUAL but LHDN mandatory fields are missing.
| Step | Description |
|---|---|
| Land in individual pool | Document waits with missing mandatory fields |
| Fix and resubmit | Correct the pool row (PUT core2/tnt/dm/erp/e-invoice/individual-pool-doc-hdrs/backoffice-ep), then POST …/individual-pool-doc-hdrs/save-and-resubmit/backoffice-ep with einvoicePoolGuid. The row’s buyer and supplier are copied onto the document and the mandatory check runs again; if it passes, the e-invoice record is created and queued |
| Move to batch pool | If customer details (TIN, ID type/value, address) are missing or do not resolve, the document can be moved to the batch pool for consolidated submission — only if the transaction amount is less than MYR 10,000 |
| Force individual | If einvoice_submission_type is CONSOLIDATED or SINGLE-GENERAL and the transaction amount is ≥ MYR 10,000, the document is routed here regardless. The threshold check runs for INTERNAL_SALES_INVOICE and INTERNAL_SALES_CASHBILL only — a credit note or debit note of any amount is not forced (see the pools guide) |
2.3 Single General Pool (bl_fi_my_einvoice_single_general_pool_doc_hdr)
Used when the einvoice_submission_type is set to SINGLE-GENERAL and the mandatory-field check fails — intended for a sale to a customer who is unlikely to have their TIN, ID type/value or address to hand but still wants an e-invoice. Since 8 October 2026 the check skips the buyer fields (name, TIN, ID type and value, address, contact number) on a SINGLE-GENERAL sales document, so a sale no longer waits here for its buyer; the supplier, document and line checks still apply, and purchase documents are checked as before.
| Step | Description |
|---|---|
| Land in single general pool | Document waits for the fields the check named. For a sales document those are supplier, document or line fields, never a buyer one |
| Fix and resubmit | Correct the pool row (PUT core2/tnt/dm/erp/e-invoice/single-general-pool-doc-hdrs/backoffice-ep), then POST …/single-general-pool-doc-hdrs/save-and-resubmit/backoffice-ep with einvoicePoolGuid, which copies the row onto the document and re-runs the check the same way |
| Resubmit as new e-invoice | If the individual e-invoice fails or becomes invalid, use Resubmit as New E-Invoice — this re-submits the document as a consolidated e-invoice containing only this single document |
Step 3 — Pending Submission
When all LHDN mandatory fields are satisfied, the transaction is placed in pending submission:
- The e-invoice record is stored in
bl_fi_my_einvoice_to_irb_hdr - The submission queue is tracked in
bl_fi_my_einvoice_gen_doc_to_irb_submission_queue - Submission errors (network or LHDN API errors) are stored in the
request_responseandrequest_errorcolumns ofbl_fi_my_einvoice_gen_doc_to_irb_submission_queue - Validation errors from LHDN (document received but invalid) are stored in the
validation_responsecolumn ofbl_fi_my_einvoice_to_irb_hdr
Step 4 — Submission History
A complete record of all submission attempts is available in:
- Table:
bl_fi_my_einvoice_gen_doc_to_irb_submission_history
This includes both successful and failed submissions, with full request/response payloads for audit and debugging.
API 1 — Convert Purchase Document to Self-Billed E-Invoice
Marks one or more purchase transaction documents as self-billed. In Malaysian e-invoicing, a self-billed invoice is issued by the buyer on behalf of the supplier. Use this API when the supplier is unable to issue an e-invoice and the buyer is required to self-bill under LHDN rules.
Endpoint
POST /doc-self-billed/backoffice-epRequired Permission: API_TNT_DM_ERP_MY_E_INVOICE_TO_IRB_UPDATE
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
gendocHdrGuids | UUID[] | Yes | Set of generic document header GUIDs (bl_fi_generic_doc_hdr.guid) for the purchase transactions to convert to self-billed |
Example Request
{
"gendocHdrGuids": [
"3fa85f64-5717-4562-b3fc-2c963f66afa6",
"7cb12a31-9843-4c1d-b891-4feac1234567"
]
}Response
Returns the updated MyEInvoiceToIrbContainer records reflecting each document’s new self-billed status.
Notes
- Applicable to
INTERNAL_PURCHASE_INVOICEand related purchase document types. - Once converted to self-billed, the document will be processed as
INTERNAL_PURCHASE_SELF_BILLED_INVOICEfor LHDN submission. - The supplier details (
einvoice_supplier_entity_hdr_json) onbl_fi_generic_doc_hdrmust be populated before calling this endpoint.
API 2 — Save and Resubmit (for Failed / Invalid E-Invoice)
When an e-invoice record is Invalid, or never reached LHDN, this API sends the same record again. It does not take corrections of its own: it sends the record as it stands, so the fix has to be on the record before you call it.
Use this when:
- LHDN returned a
validation_responseerror and you have corrected the record itself - A record failed to send and nothing in it needs to change
Do not use it for a document still sitting in a pool. A pooled document has no e-invoice record yet, so there is no toIrbHdrGuid to name; each pool has its own Save and Resubmit (Step 2).
Endpoint
POST /save-and-resubmit/backoffice-epRequired Permission: API_TNT_DM_ERP_MY_E_INVOICE_TO_IRB_UPDATE
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
toIrbHdrGuid | UUID | Yes | The GUID of the bl_fi_my_einvoice_to_irb_hdr record to fix and resubmit |
Example Request
{
"toIrbHdrGuid": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}Response
Returns a success message:
"To IRB resubmission processed."Workflow
E-invoice record is Invalid, or failed to send
│
▼
Correct the record's buyer or supplier on the record itself:
PUT /etl-ep (body: the record, MyEInvoiceToIrbContainer)
│
▼
Call /save-and-resubmit/backoffice-ep with toIrbHdrGuid
│
┌────┴─────────────────────┐
│ │
Record Valid or Submitted Any other status
│ │
▼ ▼
Refused, nothing Record's buyer, supplier, references and
changes submission type copied ONTO the document;
the same record re-queued (NOT_SUBMITTED)
│
▼
Next submission run sends it to LHDN;
the verdict lands on the recordA fix made only on the document is overwritten. The copy runs from the record to the document, never the other way, and this call does not re-check LHDN’s mandatory fields or read the customer record. Correct the record first. Correct the customer as well, or the next sale is refused the same way. The screen side of the same rule is in the My E-Invoice Admin applet, where the record’s Account tab is what Save and Resubmit sends.
Notes
- This endpoint delegates to
MyEInvoiceToIrbResubmissionService.fixFromToIRB(). - The
toIrbHdrGuidrefers to thebl_fi_my_einvoice_to_irb_hdrrecord (not thebl_fi_generic_doc_hdr). - The refusals read
E-Invoice #… is already validated with 'Valid' status. Please cancel it first before creating a new invoice.and… is already submitted and pending LHDN validation. Please wait for the validation response.A Valid e-invoice is cancelled or corrected with a note instead. - After calling this API, monitor the record’s
einvoice_document_statusandvalidation_response, and the submission queue row inbl_fi_my_einvoice_gen_doc_to_irb_submission_queue.
Get Taxpayer from QR Code
Note: This feature is currently in progress and will be implemented in a future release.
Retrieves taxpayer information by scanning or parsing a QR code from an LHDN MyInvois e-invoice document. This is useful for automatically populating buyer or supplier details without manual data entry.