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.

Click on Settings
then API
and 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 'https://jitpack.io' }
}
}
Then on the build.gradle(app)
file we add the Flutterwave Android library and sync the project.
dependencies {
implementation 'com.github.Flutterwave:rave-android:1.0.49.1'
}
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:

MainActivity
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:



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.

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!