qosic_dart 0.1.0+1 copy "qosic_dart: ^0.1.0+1" to clipboard
qosic_dart: ^0.1.0+1 copied to clipboard

A non-official package to use Qosic USSD's mobile money provider on your Dart and Flutter app

example/main.dart

import 'dart:async';
import 'dart:developer';

import 'package:qosic_dart/qosic_dart.dart';

void main(List<String> args) async {
  final qosic = QosicDart(
    moovKey: 'XXXXXXXX',
    mtnKey: 'XXXXXXXX',
    password: 'XXXXXXXX',
    username: 'XXXXXXXX',
  );

  await qosic
      .pay(
    network: QosicNetwork.mtn,
    phoneNumber: 'XXXXXXXX',
    amount: '1',
  )
      .then(
    (value) {
      Timer.periodic(const Duration(seconds: 10), (timer) async {
        final status = await qosic.getPaymentStatus(
          transactionReference: value!,
          network: QosicNetwork.mtn,
          country: QosicCountry.benin,
        );

        if (status == QosicStatus.successfull || status == QosicStatus.failed) {
          timer.cancel();
          if (status == QosicStatus.successfull) {
            print("Success for payment");
          } else {
            print("Payment failed");
          }
        }
      });
    },
  ).catchError(
    (error) {
      print('$error');
    },
  );
}
3
likes
95
pub points
21%
popularity

Publisher

verified publisherelikemmedehou.com

A non-official package to use Qosic USSD's mobile money provider on your Dart and Flutter app

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

dio

More

Packages that depend on qosic_dart