Submit Tax Report to LHDN
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.
Overview: Clearance process
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.
Step 1: Account Requirements for Malaysia
To report invoices to LHDN via B2Brouter, your B2Brouter account must be properly configured as a Malaysian entity.
Mandatory Fields for Malaysian Accounts
When creating your account via API (POST /accounts
), the following fields are required and must meet Malaysian-specific constraints:
Field | Description | Notes |
---|---|---|
country | ISO country code | Must be my (Malaysia) |
tin_value | Taxpayer Identification Number | Must follow Malaysian format |
tin_scheme | TIN Scheme Code | Must be 8028 — Nombor Cukai Pendapatan (ITN) |
cin_value | Company or Person Identifier | Must be either a Business Registration Number or National Registration Identity Card Number |
cin_scheme | CIN Scheme Code | Use 8031 for Business Registration Number (BRN) or 8029 for National Registration Identity Card Number (NRIC) |
province | State/Region | Must match official LHDN state codes |
phone | Company contact number | Required for tax validation |
Full reference: Create Account API
Example JSON Payload (Create Malaysian Account)
{
"account": {
"name": "My Malaysia Business",
"email": "[email protected]",
"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
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
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://app.b2brouter.net/accounts/{account_id}/tax_report_settings
Content-Type: application/json
X-B2B-API-Key: your_api_key
{
"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
Step 4: Create and issue invoices
Create an invoice at B2Brouter using our API. You have two options:
1. Create an issued invoice using a JSON payload
Payload sample
{
"send_after_import": true,
"invoice": {
"number": "15",
"date": "2025-03-04",
"currency": "MYR",
"type_operation": "services",
"contact": {
"name": "Malaysian Contact",
"taxcode": "C10848447051", // TIN (TIN value)
"address": "test address",
"postalcode": "0001",
"phone":"666666666",
"email": "[email protected]",
"city": "Kuala Lumpur",
"province": "01", // Must match MY state code list
"country": "my", // Must be "my" for Malaysia
"transport_type_code": "email",
"document_type_code": "xml.ubl.invoice.pint.billing.my.v1"
},
"invoice_lines_attributes": [
{
"quantity": 1.0,
"price": 100.0,
"description": "test line",
"unit": 1,
"classification_code": "022", // Must be a valid LHDN classification code
"taxes_attributes": [
{
"name": "VAT",
"percent": 10.0,
"category": "S"
}
]
}
]
}
}
2. Create an issued invoice by importing a supported file format
Step 5: Submit tax report
If you issued automatically the invoice that you just created, that is, you set the parameter send_after_import in the API call that created the issued invoice. The tax report corresponding to the invoice you just created will be generated automatically and send to the Tax Authority by their validation.
Alternatively, if you want more control over the issuing process, you can explicitly generate the tax report corresponding to any issued invoice imported in B2Brouter by explicitly calling the generate tax report method.
Step 6: Check the status of the tax report
The process of sending tax reports to the LHDN is asynchronous, that is, 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 to be able to take the necessary actions in case any error is issued by the Tax Authority. You can either:
- Check a specific Tax Report by using its ID. Usually, this method is more convenient if you explicitly called the generate tax report method. As it will return the ID of the tax report.
- Get a list of tax reports associated with an invoice ID by calling the list tax reports method. Usually, this method is more convenient if you import and issue automatically the invoices. As, the invoice ID will be returned after creating an invoice using either a JSON payload or a supported file format.
Because of the asynchronous nature of the tax report sending process, there is no guarantee that when you check the status of the tax reports, it will already have the response of the Tax Authority. It usually takes a few seconds to complete the transaction. You will know that the transaction is complete if the response of the check of the status of the tax report has a status registered or error. We recommend you retry the status check until you get a final state on your tax report. We recommend implementing an exponential back off strategy for the retries.
Updated 5 days ago