Skip to main content

Concepts

This guide will walk you through the steps needed to transfer funds using Flutterwave’s API with Python. You’ll learn how to:
  1. Set up your server app: Create a Python project and install the dependencies needed to configure your workspace.
  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 new Python project by running the following command:
Next, create a virtual environment for the project.

Installing Your Dependencies

Next, install the required dependencies for making HTTP requests and loading environment variables.

Configuring Your Environment

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

Initializing your Project

In your Python project, create a app.py and import the required dependencies.

Step 2: Fetch 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.

Step 3: Resolve Account

Next, validate the account before making the transfer.

Step 4: Initiate Transfer

Initiate the transfer once the bank account details have been verified.

Step 5: Fetch Transfer Status

Check the status of the transfer using the transfer ID returned from the previous step.

Calling the Requests

Make the requests to simulate the bank transfer using all the functions created above.
The code example above includes fetching the bank code, resolving the account, initiating the transfer, and fetching the transfer status for verification.

The Complete App

Here is how your entire app.py should look like on completing the steps above.
Run the command below to start the app.

Next Step

Check out the features you can integrate with our APIs and our Python SDK. Also checkout our best practices and error handling guides to learn how to build more robust applications.