Moov's partnership with MX allows mutual customers to verify bank accounts through instant account verification (IAV).

To enable instant account verification (IAV), you will need to:

- Set up your accounts
- Get authorization code
- Pass the MX authorization code to Moov's bank account `POST` [endpoint](https://docs.moov.io/api/sources/bank-accounts/create/)

## [Set up your accounts](https://docs.moov.io/guides/sources/bank-accounts/verification/mx/#set-up-your-accounts)

You will need an MX account and a Moov account in order to use this integration. If you don't have a Moov account, you can [sign up](https://dashboard.moov.io/signup) for one. Refer to our [quick start](https://docs.moov.io/guides/quick-start) guide for guidance on getting your API keys and configuring your Moov account once you've signed up.

Before you can use the Moov + MX integration, you will also need to have an **API key** and a **client ID** for your MX account.

Your MX account must also have the following enabled:

- `has_payment_processing`
- `has_platform_api`
- `has_account_verification`

## [Create an authorization code](https://docs.moov.io/guides/sources/bank-accounts/verification/mx/#create-an-authorization-code)

An authorization code is a one-time use token used to authenticate your application with MX. You'll create an authorization code by passing the following information to the `Request Payment Processor Authorization Code` [MX endpoint](https://docs.mx.com/api#processor_token_client_endpoints_authorization_code).

Ask

```json
{
  "payment_processor_authorization_code": {
    "user_guid": "USR-ba246888-cc62-40a6-8967-baa76dbf1cc7",
    "member_guid": "MBR-4145eb50-3721-4f48-a983-d874c8bd5eb9",
    "account_guid": "ACT-dc10aeb9-66a0-4c5c-b6a7-720b637f1fb6"
  }
}
```

## [Pass the authorization code to Moov](https://docs.moov.io/guides/sources/bank-accounts/verification/mx/#pass-the-authorization-code-to-moov)

Once you've successfully created an authorization code, you'll pass that authorization code to Moov via the bank account `POST` [endpoint](https://docs.moov.io/api/sources/bank-accounts/create/).

Ask

```zsh
curl -X POST "https://api.moov.io/accounts/{accountID}/bank-accounts"
  -H "Authorization: Bearer {token}" \
  -H "x-moov-version: v2024.01.00" \
  --data-raw '{
    "mx": {
      "authorizationCode": "mx-authorization-code"
    }
  }'\
```

Ask

```javascript
const moov = moov(token);

const accountID = "accountID";
const iavAuth = {
  mx: {
    authorizationCode: "token"
  }
};

moov.accounts.bankAccounts.link({accountID, iavAuth});
```

Moov will then retrieve bank account details directly from MX, so you won’t need to directly handle sensitive bank information when linking bank accounts.

The bank account must have passed validation with MX, otherwise the bank account will be added in the `verificationFailed` status.
