unofficial_mazzuma_plugin

Maintenance made-with-Flutter made-with-Dart ForTheBadge built-with-love

This is an unofficial implementation of Mazzuma's payment Api in flutter

Getting Started

Installation

Add this to your pubspec.yaml (or create it):

dependencies:
  unofficial_mazzuma_plugin: x.x.x  #latest version

Then run the flutter tooling:

flutter packages get

Or upgrade the packages with:

flutter packages upgrade

import library

import 'package:unofficial_mazzuma_plugin/unofficial_mazzuma_plugin.dart';

Example


UnofficialMazzumaPlugin mazzumaPlugin = new UnofficialMazzumaPlugin();

 void makePayment() {
    int price = 5000; //GHS 1.00 = 100peswes
    String network = "mtn";
    String recipientNumber = "vodafone";
    String recipientNetwork = '233503169330';
    String sender = "233245436757";
    String apiKey = "XXXXXXXXXXXXXXXXXXXXXX";
    
/** This denotes the direction of cash flow. For example, rmta can be understood as an acronym of the phrase
‘receive mtn to airtel’, which means you would be receiving money to your Airtel account (the recipient number) 
from an MTN number(the sender). This format would hold for all transaction requests sent to the API.
 Do not forget to append the r at beginning. **/
 
    if (userNetwork == "AIRTELTIGO") {
      paymentOption = "ratm"; 
    } else if (userNetwork == "MTN") {
      paymentOption = "rmtm";
    } else {
      paymentOption = "unknown";
    }

     final response = mazzumaPlugin.processPayment(
        price: price,
        network: network,
        recipientNumber: recipientNumber,
        sender: sender,
        option: paymentOption,
        apiKey: apiKey,
        recipientNetwork: recipientNetwork);
    print(response.toMap());
  }