Published in


Mobile payments using Flutterwave Android SDK

Flutterwave is a new startup that aggregates payment services for more than 60 gateways from around the globe. The startup provides an easy and reliable payment solution for businesses worldwide. Started in 2016, they aim to make it easier for Africans to build global businesses that can make and accept any payment, anywhere from across Africa and around the world.

For this post we are going to create a simple Android application using Flutterwave’s Android SDK to demonstrate card payments as well as M-PESA payments. Flutterwave’s Android SDK really cuts short the amount of time a developer was to integrate a payment solution were they to develop everything from scratch. Let’s get started.

Set up your account on Rave

You first need to set up your account on Rave here. After you’ve completed the sign up process and verified your account, head over to the dashboard section. On the left bottom corner, flip the switch labelled Turn on Sandbox to enter Sandbox mode.

Turn on Sandbox

Click on Settings then API and take note of your API keys.

Take note of your API keys

Creating the app

We are going to start with an Empty Activity in Android Studio and give it a name. The first thing we are going to do is add the necessary permissions for our app to work in the AndroidManifest.

<uses-permission android:name=”android.permission.INTERNET”/>

Next, we head over to the build.gradle(Project) file and add the Jitpack dependency before we add the Flutterwave SDK.

allprojects {
repositories {
maven { url '' }

Then on the build.gradle(app) file we add the Flutterwave Android library and sync the project.

dependencies {
implementation 'com.github.Flutterwave:rave-android:'

Creating the layout

We are going to use a very simple layout to display this since the button is where we are going to focus our method on anyway in the MainActivity. You are free to play around with your own designs but I’ll keep it simple.

This is how it should appear on screen:

Checkout page


The “Pay” button is our primary focus on this app, so we are going to initialize it and set an OnClickListener with the method makePayment(). In this method we will use the RavePayManager() method which takes some parameters. We will integrate Card and M-PESA payment methods for this app. Ensure you copy your Public Key as well as your Encryption Key from the Rave dashboard. Add the following code to your activity:

The fields are hard coded but you can make them pick user input if you’d like. Flutterwave supports multiple currencies so you can use the currency of your choice if it is supported.

Run your app

When you run your app it should look like this when you tap the Pay button:

Payment screens

For the test cards you can use the ones provided here.

Confirming your payment

After making a successful payment you can confirm your transaction details on the Flutterwave dashboard on the Transactions menu. I’ve been using the Sandbox for testing other payments so you’ll see different payment figures.

Transactions from your payments

In addition you’ll also receive an email using the email address you provided with details of your transaction.

This is basically what it takes to integrate payments into your Android apps using Flutterwave Android SDK. You should take a look at their documentation and learn more about using it in your apps. I have hosted the source code on GitHub. Feel free to engage me on Twitter and in the comments as well. Happy coding!




Developer Circle: Nairobi

Recommended from Medium

How to use create a Custom Toolbar in Android Studio

How to add Custom Toolbar in Android

Android Quiz App using Firebase | Android Studio | Java

Test Jetpack Compose UI easily with Role SemanticProperty

Create an application CoroutineScope using Hilt

ExoPlayer 2.12 - What’s new

Dagger-Android with MVVM: Dependency Injection for Android

How to Setup AVD/Emulator-Android Studio In Manjoro

Oculus VR Hello World for Android Developers

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Licio Lentimo

Licio Lentimo

I write content on Android and Web technologies. Currently focusing on Cybersecurity. Find me on

More from Medium

Basics for your first Android App: REST API, Database, and Fragment Navigation

Wireless Debugging — Android Apps

Using custom keystore in android gradle

A Journey to Implement Web Socket in Your Android App using Scarlet