Skip to main content

Concept

This guide will walk you through the core concepts needed to integrate Flutterwave into your Node.js server. You’ll learn how to:
  1. Set up your server app: Install dependencies and configure your Node.js environment to handle API requests.
  2. Get bank code: Retrieve a list of bank codes from Flutterwave’s API for initiating transactions.
  3. Get Account Details: Use a bank code to fetch and confirm bank account details.
  4. Initiate a transfer: Send money to the resolved bank account via Flutterwave.
  5. Fetch the transfer: Retrieve the status of a transfer to ensure it was processed.
  6. Verify a transaction is valid: Confirm the authenticity of a transaction using Flutterwave’s verification endpoint.

Step 1: Setting up your Server App

To initiate a transfer successfully, you need to whitelist your current IP address. Here is a quick guide on how to do that.
You can also use the universal address 0.0.0.0 to allow transfers from all IP addresses. However, this method offers less control compared to specifying a list of acceptable IP addresses.
Create a Node.js project by running the command below:
Then, create an app.js and .env file in your project directory.

Install your Dependencies

Install the Flutterwave Node.js SDK and dotenv package.

Configuring your Environment

Log into your Flutterwave dashboard to get your API keys and add the keys to your .env file.

Initialize the runFullTransferFlow Function

Next, update the app.js by importing the required dependencies, add dummy data, and initialize a runFullTransferFlow() function.

Step 2: Get Bank Code

Before you make a transfer to any bank, you need the bank code. It is a unique identifier that every bank has. You will use this to identify the bank you want to transfer to. Update the runFullTransferFlow function as shown below:

Step 3: Get Account Details

Next, validate the account before making the transfer.

Step 4: Initiate the Transfer

To initiate the transfer, update the next method in the runFullTransferFlow function.
You cannot use the same reference for multiple transactions. If you want to run the request more than once, be sure to update the reference key in your Dummydata reference.

Step 5: Fetch the Transfer Data

Add runFullTransferFlow function to retrieve the transaction data.

Step 6: Transaction Verification

Cross-reference the retrieved data with your dummy data to ensure consistency before updating your customer balance.

The Complete App

Here is how your entire app.js should look like on completing the steps above.

Next Step

Check out other available features you can integrate from our Node.js SDK. Also, check out our best practices and error handling guides to learn how to build more robust applications.