Last week, we shared some news on an update to our BVN (Bank Verification Number) authentication feature that allows users to verify up to 10 BVNs simultaneously. In this tutorial, we’ll cover building a simple app that takes advantage of this new feature.
To speed up the process, clone this repository; it contains a boilerplate to get you started.
Sign up to get your secret key
Initiate a new NodeJS project, install the necessary dependencies, and create a
bvn.js file where our BVN integration code will live.
We’ll install the following dependencies with the commands below:
npm install axios express dotenv nodemon cors
yarn add axios express dotenv nodemon cors
Build the BVN controller
bvn.js file in your controller folder, copy and add the following codes to it.
From Line 1 - Line 2; we imported
Axios , Axios will enable us to make HTTP requests.
At Line 4 - Line 15; we defined our secret key, which we got from the Okra dashboard, we also added a string of BVN numbers, and we specified the BVN endpoints which we would call when making the request.
From Line 18 - Line 33; we have a method(
bvnCheck), that utilizes axios to make a request, inside the axios object, we specified the URL which is the endpoint the request will be made to, the request type
post , and the header contains our secret key and our data. Next, we returned the response, and inside the catch block, we send an error, in case an error occurs.
For a complete view of the response sent back from Okra, check out our API Reference.
This article only covers the bulk BVN verification endpoint. Check out our documentation to explore the rest of our identity-based API products! If you are passionate about open finance, visit our website to understand how you can utilize our services to drive your business.