## Validate bank account

Check with the bank that a bank account exists and that its holder name matches the name
you expect, before adding the bank account to a contact.

The account holder name from the bank is compared against `name` and `local_name`.
Titles such as `Mr.` or `นาย` are ignored.
`match` is `true` when `score` is greater than or equal to `sensitivity`.

## Endpoint signature

```http
POST https://api.reservepay.com/merchants/validate-bank-account HTTP/1.1
Content-Type: application/json
Accept: application/json
Authorization: Bearer <token>

{
  bank_code: string,
  account_number: string,
  name: string?,
  local_name: string?,
  sensitivity: number,
}
```

Returns: object

## Request arguments

### `bank_code` (string)

**Required**. The bank's code in your country's banking system. For example, in Thailand this would be the 3-digit bank code assigned by the Bank of Thailand.

### `account_number` (string)

**Required**. The bank account number. Dashes and spaces are accepted and will be stripped automatically. Only digits, dashes, and spaces are allowed.

### `name` (string)

_Optional_. The account holder's name in latin characters. Only letters (A-Z), single quotes (') and dashes (-) are allowed, up to 5 words. At least one of `name` or `local_name` must be given.

### `local_name` (string)

_Optional_. The account holder's name in the local language (e.g. Thai), up to 5 words. At least one of `name` or `local_name` must be given.

### `sensitivity` (number)

**Required**. The minimum `score`, from 0 to 1, for the name to be considered a match.

## Response attributes

### `available` (boolean)

**Always present**. Whether the bank confirmed that the bank account exists.

### `match` (boolean)

**Always present**. Whether `score` is greater than or equal to the given `sensitivity`.

### `score` (number)

**Always present**. How closely the given name matches the account holder name, from 0 (no match) to 1 (exact match).

### `similarity` (number)

**Always present**. How similar the characters of the given name are to the account holder name, from 0 to 1.

### `distance` (number)

_Nullable_. The number of characters that differ between the given name and the account holder name. Null when the bank account is not available.

### `normalized_name` (string)

_Nullable_. The given name as it was compared with the account holder name. Null when the bank account is not available.

## Errors specific to this endpoint

### `NOT_SUPPORTED`

Bank account validation is not available for your account.

### `LOOKUP_FAILED`

The bank account could not be looked up with the bank. Please try again later.

## Errors common to all endpoints

### `UNHANDLED_ERROR`

This error occurs when the server encounters an unexpected internal error that
it cannot handle gracefully. This typically happens due to bugs, infrastructure
issues, or edge cases that weren't anticipated during development.

### `INVALID_ARGUMENTS`

This error occurs when the request contains invalid or missing parameters.
Common cases include missing required fields, or values that don't match the
expected format or type.

### `BAD_VERSION`

This error occurs when making requests to an API version that does not exist.
This commonly happens when using an outdated SDK or when the API version
specified in the request URL is incorrect.
