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: "[email protected]", // 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
Comments are closed.