# Validate Customer

> Validate customer identification details for Dedicated Virtual Accounts.

<callout title="Availability" type="info">

This is only required if you're using the [Dedicated Virtual Accounts](/payments/channels/dedicated-virtual-accounts) feature and your business falls under any of these categories: Betting, Financial services, and General Services.

</callout>

## Introduction

The customer validation endpoint is used to verify identification details provided by your customers. You can validate a customer by sending a `POST` request to the [Validate Customer](/api/customer#validate) endpoint.

## Bank account validation

Bank account validation requires that you provide the customer's BVN and a bank account connected to that BVN.

<request-response>
<template v-slot:curl="">

```bash
curl https://api.paystack.co/customer/CUS_xnxdt6s1zg1f4nx/identification \
  -H "Authorization: Bearer $PAYSTACK_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "country": "NG",
    "type": "bank_account",
    "account_number": "0123456789",
    "bvn": "20012345677",
    "bank_code": "007",
    "first_name": "Asta",
    "last_name": "Lavista"
  }' \
  -X POST
```

</template>

<template v-slot:js="">

```javascript
const https = require("https");

const params = JSON.stringify({
  "country": "NG",
  "type": "bank_account",
  "account_number": "0123456789",
  "bvn": "20012345677",
  "bank_code": "007",
  "first_name": "Asta",
  "last_name": "Lavista"
});

const options = {
  hostname: "api.paystack.co",
  port: 443,
  path: "/customer/CUS_xnxdt6s1zg1f4nx/identification",
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.PAYSTACK_SECRET_KEY}`,
    "Content-Type": "application/json",
  },
};

const req = https.request(options, (res) => {
  let data = "";
  res.on("data", (chunk) => {
    data += chunk;
  });
  res.on("end", () => {
    console.log(res.statusCode, JSON.parse(data));
  });
});

req.on("error", (error) => {
  console.error(error);
});

req.write(params);
req.end();
```

</template>

<template v-slot:php="">

```php
<?php
$fields = [
  "country" => "NG",
  "type" => "bank_account",
  "account_number" => "0123456789",
  "bvn" => "20012345677",
  "bank_code" => "007",
  "first_name" => "Asta",
  "last_name" => "Lavista",
];

$curl = curl_init();
curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.paystack.co/customer/CUS_xnxdt6s1zg1f4nx/identification",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => json_encode($fields),
  CURLOPT_HTTPHEADER => array(
    "Authorization: Bearer " . getenv("PAYSTACK_SECRET_KEY"),
    "Content-Type: application/json",
    "Cache-Control: no-cache",
  ),
));
$response = curl_exec($curl);
echo curl_getinfo($curl, CURLINFO_HTTP_CODE) . " " . $response;
?>
```

</template>

<template v-slot:response="">

```json
{
  "status": true,
  "message": "Customer Identification in progress"
}
```

</template>
</request-response>

### Testing

Customers can only be validated with live keys. However, for testing purposes during your integration, you can make make use of this credential with your test key:

```json
{
  "country": "NG",
  "type": "bank_account",
  "account_number": "0111111111",
  "bvn": "222222222221",
  "bank_code": "007",
  "first_name": "Uchenna",
  "last_name": "Okoro"
}
```

## Listen for verification status

The verification of the details provided happens asynchronously, and we will send a `customeridentification.success` or `customeridentification.failed` event to your webhook URL when the verification is complete.

<callout title="Prerequisite" type="info">

You need a basic knowledge of [webhooks](/developer-tools/integration/webhooks) before proceeding with this section.

</callout>

<code-tabs :labels="{"success":"Success","failed":"Failed"}">
<template v-slot:success="">

```json
{
  "event": "customeridentification.success",
  "data": {
    "customer_id": 82796315,
    "customer_code": "CUS_xnxdt6s1zg1f4nx",
    "email": "bojack@horsinaround.com",
    "identification": {
      "country": "NG",
      "type": "bank_account",
      "bvn": "200*****677",
      "account_number": "012****789",
      "bank_code": "007"
    }
  }
}
```

</template>

<template v-slot:failed="">

```json
{
  "event": "customeridentification.failed",
  "data": {
    "customer_id": 82796315,
    "customer_code": "CUS_xnxdt6s1zg1f4nx",
    "email": "bojack@horsinaround.com",
    "identification": {
      "country": "NG",
      "type": "bank_account",
      "bvn": "200*****677",
      "account_number": "012****789",
      "bank_code": "007"
    },
    "reason": "Account number or BVN is incorrect"
  }
}
```

</template>
</code-tabs>

When a customer validation fails, we return the cause of the failure in the `data.reason` parameter. We return the following reasons for a failed customer validation:

1. Account couldn't be resolved. Please try again
2. Account name or BVN is incorrect
3. Account number or BVN is incorrect

<callout title="A validated customer's name can't be updated" type="info">

When a customer is validated successfully, the customer's `first_name` and `last_name` are automatically updated to correspond with the name on their BVN.
Once this is set, you'll no longer be able to update the customer's name using the  [Update Customer](/api/customer#update) and the customer's name can only be updated by a re-validation.

</callout>

## Reasons to validate a customer

1. Local regulations require that customer information is validated before creating account numbers on their behalf.
2. It allows us name the bank account using the name registered to the provided BVN
