Skip to content
jagaweb.Book the Review
Compliance

LHDN e-Invoicing: WooCommerce Plugin Setup for Malaysia

8 min readBy JagaWeb Compliance Team

Connecting WooCommerce checkouts to the MyInvois API, generating compliant QR codes, and TIN validation.

The Inland Revenue Board of Malaysia (LHDN) has mandated e-invoicing via the MyInvois system. For e-commerce stores running WooCommerce, integrating this at the checkout level is critical for tax compliance.

1. API Authentication via MyInvois

Your WooCommerce system needs to communicate securely with LHDN's API. You must configure OAuth 2.0 authentication using the Client ID and Client Secret generated from your MyInvois portal.

In your custom integration or plugin configuration, ensure tokens are cached securely (e.g., using Redis) to avoid rate limits when generating invoices during high-traffic checkout events.

2. Buyer TIN Validation at Checkout

To issue a valid e-invoice for B2B transactions, you must capture and validate the buyer's Tax Identification Number (TIN). Modify your WooCommerce checkout fields to include a TIN input. Before the order is finalized, your backend should ping the LHDN Validate TIN endpoint:

// Example conceptual API call
$response = wp_remote_get( 'https://preprod-api.myinvois.hasil.gov.my/api/v1.0/tin/validate?tin=' . $buyer_tin );

If invalid, the checkout must prompt the user to correct the data.

3. Generating Compliant QR Codes on Receipts

Upon successful validation by LHDN, the API returns a unique identifier and a validation link. LHDN requires this link to be rendered as a QR code on the final PDF receipt or email sent to the customer. Use a PHP library like endroid/qr-code to generate this dynamically within WooCommerce's woocommerce_email_order_meta hook.


Need Expert Help?

E-commerce compliance is complex. JagaWeb ensures platforms like TechFix Malaysia operate smoothly within regulatory bounds. Get our RM5,000 Ownership & Access Review to audit your checkout compliance, or subscribe to our RM450/month Care Plan for seamless infrastructure support. Contact us today.

PROTECT YOUR ASSETS

Ready to verify who owns your website?

Replace uncertainty with a decision-ready ownership and access report. The fixed Ownership & Access Review is RM1,500 before SST and includes a 30-day action plan.

WhatsApp