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).
Overview: Clearance process
Section titled “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
Section titled “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
Section titled “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)
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_settingsContent-Type: application/jsonX-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
Step 4: Create and issue invoices
Section titled “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
Section titled “1. Create an issued invoice using a JSON payload”Example request:
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'2. Create an issued invoice by importing a supported file format
Section titled “2. Create an issued invoice by importing a supported file format”Example request:
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}'Step 5: Submit tax report
Section titled “Step 5: Submit tax report”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:
- Check a specific Tax Report by using its ID.
- Get a list of tax reports associated with an invoice ID by calling the list tax reports method.
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.