Payments
Validate Customer
In a nutshell
Validate customer identification details for Dedicated Virtual Accounts.
Availability
This is only required if you're using the Dedicated Virtual Accounts feature and your business falls under any of these categories: Betting, Financial services, and General Services.
Copy linkIntroduction
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 endpoint.
Copy linkBank account validation
Bank account validation requires that you provide the customer's BVN and a bank account connected to that BVN.
POSTapi.paystack.co/customer/CUS_xnxdt6s1zg1f4nx/identification
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
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();
<?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;
?>
Copy linkTesting
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:
{
"country": "NG",
"type": "bank_account",
"account_number": "0111111111",
"bvn": "222222222221",
"bank_code": "007",
"first_name": "Uchenna",
"last_name": "Okoro"
}
Copy linkListen 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.
Prerequisite
You need a basic knowledge of webhooks before proceeding with this section.
{
"event": "customeridentification.success",
"data": {
"customer_id": 82796315,
"customer_code": "CUS_xnxdt6s1zg1f4nx",
"email": "[email protected]",
"identification": {
"country": "NG",
"type": "bank_account",
"bvn": "200*****677",
"account_number": "012****789",
"bank_code": "007"
}
}
}
{
"event": "customeridentification.failed",
"data": {
"customer_id": 82796315,
"customer_code": "CUS_xnxdt6s1zg1f4nx",
"email": "[email protected]",
"identification": {
"country": "NG",
"type": "bank_account",
"bvn": "200*****677",
"account_number": "012****789",
"bank_code": "007"
},
"reason": "Account number or BVN is incorrect"
}
}
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:
- Account couldn't be resolved. Please try again
- Account name or BVN is incorrect
- Account number or BVN is incorrect
A validated customer's name can't be updated
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 and the customer's name can only be updated by a re-validation.
Copy linkReasons to validate a customer
- Local regulations require that customer information is validated before creating account numbers on their behalf.
- It allows us name the bank account using the name registered to the provided BVN