validate
The Invoice API provides two key functionalities:
-
Validate API: Performs LHDN's validation on the invoice data. It checks for compliance and correctness based on the LHDN (Lembaga Hasil Dalam Negeri Malaysia) regulations, ensuring that all necessary fields and values are accurate.
-
Unify API: After validation, this API submits the invoice data to LHDN. It validates and ensures the invoice is prepared for submission to the LHDN system.
Endpoint
- Base URL:
malaysia-sandbox.complyance.io
- Validate API:
/validate
Headers
Header | Type | Description | Example |
---|---|---|---|
x-api-key | string | API Key for authentication | 1aN3AQ8ZsggJ0UABAHXVB |
invoiceMethod | string | The method of invoicing (e.g., non-peppol) | non-peppol |
Content-Type | string | Defines that the body is in JSON format | application/json |
Request Body
The request body for the Validate API should be structured as follows:
{
"fileName": "Untitled spreadsheet (24).xlsx",
"branchName": "Futurer Branch",
"invoiceDataList": [
{
"documentType": "INV",
"documentId": "jsjfsfjkf",
"originalEInvoiceReferenceNumber": "",
"originalEInvoiceReferenceUUID": "",
"documentIssueDate": "2024-08-01",
"documentIssueTime": "02:30:00Z",
"currency": "MYR",
"currencyExchangeRate": "EUR",
"invoiceFrequency": "MONTHLY",
"invoiceStartDate": "2024-07-21",
"invoiceEndDate": "2024-07-26",
"supplierId": "1",
"sellerTinNumber": "C21540299050",
"sellerRegistrationIdType": "BRN",
"sellerRegistrationId": "BRN: 202001234567",
"supplierSstRegistrationNumber": "A01-2345-67891012",
"supplierTourismTaxRegistrationNumber": "123-4567-89012345",
"buyerId": "1",
"buyerTinNumber": "C21540299050",
"buyerRegistrationIdType": "BRN",
"buyerRegistrationId": "BRN: 202001234567",
"buyerSstRegistrationNumber": "",
"shippingRecipientName": "Greenz Sdn. Bhd.",
"shippingRecipientTin": "C948329382",
"shippingRecipientRegistrationType": "BRN",
"shippingRecipientRegistrationNumber": "BRN:24235236432",
"totalExcludingTax": "1000",
"detailsOfTaxExemption": "Goods acquired with SST exemption under Sales Tax Act 2018. Reference No: (C01-2345-67890123)",
"amountExemptedFromTax": "",
"taxTotal": "60",
"documentTotal": "1060",
"prePaymentAmount": "0",
"totalPayableAmount": "1060",
"roundingAmount": "0",
"paymentMeans": "1",
"suppliersBankAccountNumber": "1.23457E+12",
"paymentTerms": "1",
"prePaymentDate": "2000-01-01",
"prePaymentTime": "0.5",
"prePaymentReferenceNumber": "E12345678912",
"billReferenceNumber": "E12345678912",
"referenceNumberOfCustomsFormNo19": "E12345678912",
"incoterms": "CIF",
"freeTradeAgreementFta": "ASEAN-Australia-New Zealand FTA (AANZFTA)",
"authorisationNumberForCertifiedExporter": "CPT-CCN-W-211111-KL-000002",
"referenceNumberOfCustomsFormNo2": "E12345678912",
"shipmentId": "",
"detailsOfOtherCharges": "true\n\n100.00\n\nService charge",
"customFields": {},
"usedTaxTypes": [],
"sellerAddress": {
"addressLine1": "Lot 66",
"addressLine2": "Bangunan Merdeka",
"addressLine3": "Persiaran Jaya",
"postalCode": "50480",
"city": "Kuala Lumpur",
"state": "Johor",
"country": "MYS"
},
"buyerAddress": {
"addressLine1": "Lot 66",
"addressLine2": "Bangunan Merdeka",
"addressLine3": "Persiaran Jaya",
"postalCode": "50480",
"city": "Kuala Lumpur",
"state": "Johor",
"country": "MYS"
},
"shippingRecipientAddress": {
"addressLine1": "Lot 66",
"addressLine2": "Bangunan Merdeka",
"addressLine3": "Persiaran Jaya",
"postalCode": "50480",
"city": "Kuala Lumpur",
"state": "Johor",
"country": "MYL"
},
"supplierDetails": {
"organizationName": "AMS Setia Jaya Sdn. Bhd.",
"email": "general.ams@supplier.com",
"industryCode": "1111",
"industryDescription": "Growing of maize",
"phoneNumber": "\n+60-123456789"
},
"buyerDetails": {
"organizationName": "Full Formal Buyer Name BHD.",
"email": "name@buyer.com",
"phoneNumber": "\n+60-123456789"
},
"documentLineItems": [
{
"lineItemId": "1",
"commodityClassificationCode": "1",
"lineItemProductTariffCode": "9800.00.0010",
"lineItemCountryOfOrigin": "GBR",
"description": "Laptop Peripherals",
"unitPrice": "100",
"lineItemMeasurement": "Kg",
"quantity": "10",
"lineItemSubtotal": "1000",
"lineItemDiscountRate": "0",
"lineItemDiscountAmount": "0",
"lineItemChargeRate": "0",
"lineItemChargeAmount": "0",
"lineTotalExcludingTax": "1000",
"taxType": "1",
"taxPercentage": "6",
"totalTax": "60",
"taxCode": "Goods acquired with SST exemption under Sales Tax Act 2018. Reference No: (C01-2345-67890123)",
"lineItemAmountExemptedFromTax": "",
"lineItemTotal": "1060"
}
],
"invoiceMethod": "non-peppol"
}
]
}
Request Body Fields
Field | Type | Description | Example |
---|---|---|---|
fileName | string | The name of the file to be validated. | "Untitled spreadsheet (24).xlsx" |
branchName | string | The branch responsible for the invoice. | "Futurer Branch" |
invoiceDataList | array | List of invoice data objects. | See individual fields below. |
documentType | string | Type of the document (e.g., INV for Invoice). | "INV" |
documentId | string | Unique identifier for the document. | "jsjfsfjkf" |
documentIssueDate | string | Date when the document was issued in YYYY-MM-DD format. | "2024-08-01" |
documentIssueTime | string | Time when the document was issued in HH:MM:SSZ format. | "02:30:00Z" |
currency | string | Currency code for the invoice. | "MYR" |
invoiceFrequency | string | Invoice frequency (e.g., MONTHLY, WEEKLY). | "MONTHLY" |
invoiceStartDate | string | Start date of the invoice period in YYYY-MM-DD format. | "2024-07-21" |
invoiceEndDate | string | End date of the invoice period in YYYY-MM-DD format. | "2024-07-26" |
supplierId | string | Unique identifier for the supplier. | "1" |
sellerTinNumber | string | Tax Identification Number for the seller. | "C21540299050" |
buyerId | string | Unique identifier for the buyer. | "1" |
buyerTinNumber | string | Tax Identification Number | |
"C21540299050" | for the buyer. | ||
totalExcludingTax | string | Total amount excluding tax. | "1000" |
taxTotal | string | Total tax amount for the invoice. | "60" |
documentTotal | string | Total invoice amount including tax. | "1060" |
totalPayableAmount | string | The total amount payable. | "1060" |
documentLineItems | array | List of line items in the invoice (details provided below). | See individual line items below. |
lineItemId | string | Unique identifier for the line item. | "1" |
lineItemSubtotal | string | Subtotal for the line item. | "1000" |
totalTax | string | Total tax for the line item. | "60" |
lineItemTotal | string | Total amount for the line item, including tax. | "1060" |
invoiceMethod | string | The invoicing method (e.g., non-peppol). | "non-peppol" |
Sample Response Body
Success Response (HTTP 200 OK)
{
"status": "success",
"message": "Invoice data validated successfully.",
"validationResults": [
{
"documentId": "jsjfsfjkf",
"validationStatus": "Valid",
"validationMessages": []
}
]
}
Validation Error Response (HTTP 400 Bad Request)
{
"status": "error",
"message": "Validation failed. Please review the errors.",
"validationResults": [
{
"documentId": "jsjfsfjkf",
"validationStatus": "Invalid",
"validationMessages": [
{
"field": "documentIssueDate",
"message": "Document issue date cannot be in the future."
},
{
"field": "sellerTinNumber",
"message": "Seller Tin Number is invalid."
}
]
}
]
}
Server Error Response (HTTP 500 Internal Server Error)
{
"status": "error",
"message": "Internal server error. Please try again later."
}
Response Fields:
- status: Indicates the status of the API call (e.g.,
"success"
,"error"
). - message: A human-readable message providing further information about the result.
- validationResults (optional): An array containing the validation details for each document in the request.
- documentId: The unique identifier for the document that was validated.
- validationStatus: Indicates whether the document is valid or invalid.
- validationMessages (optional): A list of validation error messages, specifying the fields and the corresponding issues if any.
Responses
Status Code | Description |
---|---|
200 OK | Invoice data validated successfully. |
400 Bad Request | Invalid or malformed request. |
500 Internal Server Error | An error occurred on the server. |