Skip to content
Log in

LHDN tax report

Submit Tax Report to LHDN (Malaysia) using B2Brouter API

Section titled “Submit Tax Report to LHDN (Malaysia) using B2Brouter API”

This guide explains how to activate and generate a tax report for the Inland Revenue Board of Malaysia (LHDN) through the B2Brouter API.

Testing environments: Use sandbox for initial API testing and payload validation — sandbox simulates LHDN submissions so you can exercise the full invoice lifecycle without connecting to any real authority. For full end-to-end testing against LHDN’s own test endpoint, use the staging environment (api-staging.b2brouter.net).

The LHDN (Lembaga Hasil Dalam Negeri, or Inland Revenue Board of Malaysia) tax reporting process operates as a clearance model. This means each invoice issued must be reported to and approved by the tax authority.

When using B2Brouter, each tax report sent to the LHDN will be automatically cleared through this authority. Thus, the invoice can only be considered legally valid after successful clearance by LHDN.

Below are the steps to configure and manage tax report submissions to LHDN using the B2Brouter API.

To report invoices to LHDN via B2Brouter, your B2Brouter account must be properly configured as a Malaysian entity.

When creating your account via API (POST /accounts), the following fields are required and must meet Malaysian-specific constraints:

FieldDescriptionNotes
countryISO country codeMust be my (Malaysia)
tin_valueTaxpayer Identification NumberMust follow Malaysian format
tin_schemeTIN Scheme CodeMust be 8028Nombor Cukai Pendapatan (ITN)
cin_valueCompany or Person IdentifierMust be either a Business Registration Number or National Registration Identity Card Number
cin_schemeCIN Scheme CodeUse 8031 for Business Registration Number (BRN) or 8029 for National Registration Identity Card Number (NRIC)
provinceState/RegionMust match official LHDN state codes
phoneCompany contact numberRequired for tax validation

Full reference: Create Account API

Example JSON Payload (Create Malaysian Account)
Section titled “Example JSON Payload (Create Malaysian Account)”
{
"account": {
"name": "My Malaysia Business",
"email": "john.doe@example.com",
"phone": "60123456789",
"address": "123 Jalan Ampang",
"city": "Kuala Lumpur",
"postalcode": "50088",
"province": "10",
"country": "my",
"tin_value": "ITN123456789",
"tin_scheme": 8028,
"cin_value": "BRN123456789",
"cin_scheme": 8031
}
}

Step 2: Register B2Brouter as an Intermediary ERP in MyInvois Portal

Section titled “Step 2: Register B2Brouter as an Intermediary ERP in MyInvois Portal”

To send your tax reports to MyInvois, B2Brouter must be registered as an intermediary ERP on the MyInvois portal. This registration is required to authorize us to submit tax reports on your behalf. You can find detailed instructions here.

Step 3: Activate LHDN Tax Reporting in B2Brouter

Section titled “Step 3: Activate LHDN Tax Reporting in B2Brouter”

You must enable the LHDN tax reporting settings in your B2Brouter account to start reporting invoices to LHDN.

API Endpoint to create tax report settings for LHDN:

POST https://api-staging.b2brouter.net/accounts/{ACCOUNT_ID}/tax_report_settings
Content-Type: application/json
X-B2B-API-Key: {YOUR_API_KEY}
X-B2B-API-Version: {YOUR_API_VERSION}
{
"tax_report_setting": {
"code": "lhdn",
"msic": "01111",
"type_operation": "services",
"classification_code": "001"
}
}

Fields explanation:

  • msic: Malaysian business classification code, required by LHDN.
  • type_operation: Type of your business operations (services or goods). Default filled with this value if it’s not specified in your invoice.
  • classification_code: Specific code related to your product line category. Default filled with this value if it’s not specified in your invoice.

To correctly configure tax reporting for Malaysia, you must use official codes provided by the LHDN. You can find them here: LHDN Code List

Create an invoice at B2Brouter using our API. You have two options:

Example request:

Terminal window
curl --request POST \
--url https://api-staging.b2brouter.net/accounts/{ACCOUNT_ID}/invoices \
--header 'X-B2B-API-Key: {YOUR_API_KEY}' \
--header 'X-B2B-API-Version: {YOUR_API_VERSION}' \
--header 'content-type: application/json'

Example request:

Terminal window
curl --request POST \
--url 'https://api-staging.b2brouter.net/accounts/{ACCOUNT_ID}/invoices/import?send_after_import=false&transport_type_code_for_contact=email&document_type_code_for_contact=xml.ubl.invoice.pint.billing.my.v1' \
--header 'X-B2B-API-Key: {YOUR_API_KEY}' \
--header 'X-B2B-API-Version: {YOUR_API_VERSION}' \
--header 'content-type: application/octet-stream' \
--data 'data:text/xml;name=Invoice-23432234533.xml;base64,{BASE64_RAW_XML}'

If you issued automatically the invoice that you just created (by setting the parameter send_after_import in the API call), the tax report corresponding to the invoice will be generated automatically and sent to the Tax Authority for validation.

Alternatively, if you want more control over the issuing process, you can explicitly generate the tax report by calling the generate tax report method.

Step 6: Check the status of the tax report

Section titled “Step 6: Check the status of the tax report”

The process of sending tax reports to the LHDN is asynchronous — we generate and submit the tax report in a background process.

You will have to check the status of the tax report we send on your behalf. You can either:

Because of the asynchronous nature of the tax report sending process, there is no guarantee that when you check the status it will already have the response of the Tax Authority. It usually takes a few seconds to complete the transaction. The transaction is complete if the status is registered or error. We recommend implementing an exponential back off strategy for retries.