Moamalat Flutter Package

  • The moamalat_payment package is a Flutter plugin designed to simplify integrating Moamalat payment solutions into your Flutter applications.

Features

  • Seamlessly integrate Moamalat payment gateway.
  • Provides a customizable MoamalatButton widget to initiate payment transactions.

Installation

To install the moamalat_pay package, add it to your pubspec.yaml file:

  • dependencies:
  • moamalat_pay: ^0.0.6

Getting started

  • The MoamalatPayment class is a Flutter widget designed to seamlessly integrate the Moamalat payment gateway into your Flutter application. This widget leverages a WebView to load the Moamalat payment page, presenting the transaction details to the user. It also manages the response from Moamalat and routes it to the designated callback functions.
  • Constructor
  • The MoamalatPayment class includes a constructor that accepts the following parameters:
  • merchantId: Your unique merchant ID provided by Moamalat.
  • merchantReference: A distinct reference number for the transaction.
  • terminalId: The terminal ID issued by Moamalat.
  • amount: The transaction amount to be processed.
  • merchantSecretKey: The secret key provided by Moamalat for transaction authentication.
  • environmentBaseURL: Enviournemnt base URL if it is dev or uat.
  • messageCallBack: A callback function triggered upon successful completion of the payment. This function receives a TransactionSuccess object as an argument.
  • errorCallBack: A callback function executed when an error occurs during the payment process. This function receives a PaymentError object as an argument.

Methods

Callbacks

  • The MoamalatPayment class has two callback functions:
  • messageCallBack: This callback function is called when the payment is completed successfully. It takes a TransactionSucsses object as a parameter.
  • errorCallBack: This callback function is called when an error occurs during the payment process. It takes a PaymentError object as a parameter.

Usage

  • import 'package:moamalat_payment/moamalat_pay.dart';

Example

  • MoamalatButton(
  • text: "Pay moamalat",
  • merchantID: "10813159",
  • secretKey:"6433313836646164663238333336326435",
  • terminalID: "13659450",
  • merchantReference: "1234",
  • amount: "150",
  • environmentBaseURL:"your env url",
  • time: "",
  • btnColor: Colors.yellow,
  • btnTxtColor: Colors.black,
  • tapValidation: () {
  • return true;
  • },
  • messageCallBack: (message) {
  • },
  • errorCallBack: (String val) {
  • },
  • ),