Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Oct 13, 2024. It is now read-only.
/ hover_ussd Public archive

A flutter plugin to make payments by usehover.com ussd gateway using Android Intent and receiving the transaction information back in response.

License

Notifications You must be signed in to change notification settings

lucdotdev/hover_ussd

Repository files navigation

hover_ussd

build Pub Star on GitHub Flutter Website License: MIT

drawing

A flutter plugin to make payments by usehover.com ussd gateway using Android Intent and receiving the transaction information back in response. android only

Getting Started

 <meta-data
        android:name="com.hover.ApiKey"  
        android:value="<YOUR_API_TOKEN>"/>

Usage

  • Initialize the plugin in main method
void main() {
  WidgetsFlutterBinding.ensureInitialized();
  HoverUssd().initialize();
  runApp(MyApp());
}
  • Start a transaction
import 'package:hover_ussd/hover_ussd.dart';
...
final HoverUssd _hoverUssd = HoverUssd();

///Begin transaction
void send(){
   ///First param @String [action_id]
   ///Second param @ Map [step_variables]
  _hoverUssd.sendUssd("c6e45e62", {"price": "4000"});
}

///Listen for transaction status
 _hoverUssd.onTransactiontateChanged.listen((event) {
        // Do something with new state
        if (event == TransactionState.succesfull) {
          print("succesfull");
        } else if (event == TransactionState.waiting) {
          print("pending");
        } else if (event == TransactionState.failed) {
          print('failed');
        }
  });
///You can listen with StreamBuilder to update ui
 StreamBuilder(
     stream: _hoverUssd.onTransactiontateChanged,
        builder: (BuildContext context, AsyncSnapshot snapshot) {
                  if (snapshot.data == TransactionState.succesfull) {
                    return Text("succesfull");
                  } else if (snapshot.data == TransactionState.waiting) {
                    return Text("pending");
                  } else if (snapshot.data == TransactionState.failed) {
                    return Text("failed");
                  }
          return Text("no transaction");
   },
);

Features

  • start a transaction
  • listen for result
  • customization
  • translation

Important

  • support only basic feature
  • always in developpement
  • this isn't a officialy plugin

Maintainers

About

A flutter plugin to make payments by usehover.com ussd gateway using Android Intent and receiving the transaction information back in response.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published