A flutter plugin for integrating Mobile Money Payments to your flutter apps
Read Time:1 Minute, 22 Second

A flutter plugin for integrating Mobile Money Payments to your flutter apps

0 0
A flutter plugin for integrating Mobile Money Payments to your flutter apps

Add Mobile Money payments to your flutter apps using the FlutterWave api gateway.

Features

  • Recieve Payments through Mobile Money in Uganda
  • Supports MTN Momo Transactions
  • Supports Airtel Money Transactions
  • Verify Charges your have made before adding value

Getting started

Get your api keys, head over to https://dashboard.flutterwave.com/settings/apis

You might also want to read about flutterwaves documentation. For this head to https://developer.flutterwave.com/reference

Usage

Create an instance of the UgandaMobileMoney class.

const secretKey = "FLWSECK-XXXXX-X"; // flutterwave secret key
UgandaMobileMoney _mobileMoney = UgandaMobileMoney(secretKey); 

Initiate Payments

void chargeClient() async {
    MomoPayResponse response = await _mobileMoney.chargeClient(
        MomoPayRequest(
            txRef: "MC-01928403", // should be unique for each transaction
            amount: "1500", // amount in UGX you want to charge
            email: "tst@gmail.com", // email of the person you want to charge
            phoneNumber: "256123456723", // clients phone number
            fullname: "Ojangole Joran", // full name of client
            redirectUrl: "https://yoursite.com", // redirect url after payment
            voucher: "128373", // useful for vodafone. you can ignore this
            network: UgandaNetwork.mtn // network, can be either mtn or airtel
            ),
        );

    print(response.message);
  }

To Verify transactions

   void verifyTransaction() {
    _mobileMoney.verifyTransaction(taxRef).then((value) {
      if (value == TransactionStatus.failed) {
        ScaffoldMessenger.of(context)
            .showSnackBar(SnackBar(content: Text("Failed")));
      } else if (value == TransactionStatus.pending) {
        ScaffoldMessenger.of(context)
            .showSnackBar(SnackBar(content: Text("Pending")));
      } else if (value == TransactionStatus.success) {
        ScaffoldMessenger.of(context)
            .showSnackBar(SnackBar(content: Text("Success")));
      } else if (value == TransactionStatus.unknown) {
        ScaffoldMessenger.of(context)
            .showSnackBar(SnackBar(content: Text("Unknown")));
      } else {
        ScaffoldMessenger.of(context)
            .showSnackBar(SnackBar(content: Text("Unknown")));
      }
    });
  }

Additional information

Please contact me if your have any feature requests or file issues via the respository.

You can also buy me a rolex : https://dashboard.flutterwave.com/donate/7nacgysd7ilf

GitHub

View Github

Happy
Happy
0 %
Sad
Sad
0 %
Excited
Excited
0 %
Sleepy
Sleepy
0 %
Angry
Angry
0 %
Surprise
Surprise
0 %

Average Rating

5 Star
0%
4 Star
0%
3 Star
0%
2 Star
0%
1 Star
0%

Deja una respuesta

Entrada anterior A health and lifestyle app concept
Entrada siguiente Airline App where you can learn everything you need to know about your next journey and how to make it safe and on budget