# Go live in Malaysia

Work through this checklist before you send Malaysian e-invoices to LHDN MyInvois in production. You need Malaysian documents that already pass in sandbox and the company's real registration details.

> **Before you start**
>
> - Every Malaysian document type you will send passes in sandbox. See [Malaysia: MyInvois sandbox](https://docs.complyance.io/get-started/sandbox/#malaysia-myinvois-sandbox).
> - The company’s registered legal name, branch name, registration number and tax identification number (TIN).
> - Someone who can sign in to the company’s account in the production MyInvois portal.
> - The company’s digital certificate (`.p12`) and its PIN.

## Step 1: Onboard the company in production

A company onboarded in sandbox is not registered in production.

1. In the Invoice Portal, select **Malaysia** and **Production**.
2. Follow [Onboard a Malaysian company](https://docs.complyance.io/countries/my/onboarding/) with the company’s real details.
3. Check the legal name, branch and registration number on the review screens before you select **Complete Onboarding**.

You should see the screen that confirms onboarding.

## Step 2: Authorise the intermediary in production MyInvois

The intermediary you added in the sandbox (preprod) portal does not carry over. In the production MyInvois portal, add Complyance as the company’s intermediary, as described in [Authorise the intermediary in MyInvois](https://docs.complyance.io/countries/my/onboarding/#authorise-the-intermediary-in-myinvois).

## Step 3: Upload the digital certificate

With **Production** selected, upload the company’s certificate in the **Digital Certificate** row, as described in [Add the company’s digital certificate](https://docs.complyance.io/countries/my/onboarding/#add-the-companys-digital-certificate). Note its expiry date, and renew it before then.

## Step 4: Move your integration to production

- Create a key under **Production API keys** with **Write** access. See [Create an API key](https://docs.complyance.io/one-platform/developer-portal/api-keys/).
- With **Production** selected, link your production source to your mapping and the company’s branch. See [Manage sources and their links](https://docs.complyance.io/one-platform/developer-portal/source-management/).
- Send `"environment": "production"` and the production source’s `name:version` in every Unify request. If you use an SDK, change its environment setting; each [SDK guide](https://docs.complyance.io/sdks/) shows where.
- Check the production credit balance in **Credits**, and create a separate production webhook if you receive webhooks. See [Credits](https://docs.complyance.io/one-platform/invoice-portal/credits/) and [Set up a webhook](https://docs.complyance.io/one-platform/developer-portal/webhooks/setup/).
- If you sell to consumers, set up consolidation in the [B2C Vault](https://docs.complyance.io/one-platform/invoice-portal/b2c-vault/) with **Production** selected.

## Step 5: Check the required test cases

If your workspace uses the **Default GETS Mapping**, the test cases for Malaysia must show **Passed** in [Test your mapping](https://docs.complyance.io/one-platform/developer-portal/integration-engine/test/). Until they do, Unify refuses invoices with `412` and `failed_precondition`, in sandbox and in production.

## Step 6: Send the first production invoice

Send one real invoice, issued no more than 72 hours before you send it, and follow it with its `documentId` until `isTerminal` is `true`. See [Submit and retrieve](https://docs.complyance.io/api-reference/unify/submit-and-retrieve/#follow-the-document). `final_valid` means LHDN marked it valid. `final_invalid` means LHDN marked it invalid, and `rejected` means it failed validation before it reached LHDN. Read `errors` and `government` for the reason.

## Malaysian checks

- Production documents go to production MyInvois. They are real e-invoices, and nothing from the MyInvois sandbox carries over.
- Use the real TINs and registration numbers of the supplier and the buyer. LHDN checks taxpayer identities, so a sample value that passed your tests can be rejected in production.
- For a credit or debit note, the invoice it refers to must be valid in production MyInvois.
- A validated document can be cancelled, or rejected by the buyer, for 72 hours after LHDN marks it valid. Cancel in the MyInvois portal; see [the life of a Malaysian e-invoice](https://docs.complyance.io/countries/my/#the-life-of-a-malaysian-e-invoice).
- Check each document type against the [Malaysia field reference](https://docs.complyance.io/countries/my/fields/) and the [validation rules](https://docs.complyance.io/countries/my/validation-rules/).

## If something goes wrong

**`403` with `permission_denied`:** the key is a sandbox key. Use a production key with `"environment": "production"`.

**`404`:** the `source` is not in production. Check its name and version in Source management with **Production** selected.

**`412` with `failed_precondition`:** the required test cases for Malaysia have not all passed. Run them, then send the document again. [Unify errors](https://docs.complyance.io/api-reference/unify/errors/) lists each reason.

**`422` with `MY-DATE-002`:** the issue date and time are more than 72 hours old. Issue the document again with the current date and time.

**LHDN rejects a taxpayer identity:** confirm the TIN and registration number against the company’s or buyer’s records. Do not replace them with guessed values.

> **You are live**
>
> The company is onboarded in production, Complyance is its intermediary in MyInvois, and your first production invoice is validated by LHDN. Keep following each document to its final status.

Source: https://docs.complyance.io/countries/my/go-live/
