pay_unit_sdk 3.1.13 copy "pay_unit_sdk: ^3.1.13" to clipboard
pay_unit_sdk: ^3.1.13 copied to clipboard

Library flutter of the most complete payment aggregator of Cameroon, pay integrate ORANGE, MTN, PAYPAL and EXPRESS UNION in some click in your Flutter application

example/main.dart

import 'dart:math';
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'package:pay_unit_sdk/pay_unit_sdk.dart';

void main() {
  runApp(App());
}

class App extends StatelessWidget {
  @override
  Widget build(BuildContext context) => MaterialApp(
        debugShowCheckedModeBanner: false,
        home: Scaffold(
          body: Home(),
        ),
      );
}

class Home extends StatefulWidget {
  @override
  _HomeState createState() => _HomeState();
}

class _HomeState extends State<Home> {
  @override
  initState() {
    super.initState();
  }

  // Generate random transaction Id
  getRandomId() {
    //initialize the Date of the day
    var now = DateTime.now();
    var rng = Random();
    //specify the format of the date
    var formatter = DateFormat('yyyyMMddHms');
    String formattedDate = "${formatter.format(now)}${rng.nextInt(100000)}";
    return formattedDate;
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        backgroundColor: Colors.grey,
        appBar: AppBar(
          elevation: 1,
          backgroundColor: Colors.white,
          title: const Text(
            "Pay unit demo",
            style: TextStyle(color: Colors.black),
          ),
          centerTitle: true,
        ),
        body: Center(
          child: Padding(
            padding: EdgeInsets.only(left: 30, right: 30),
            child: PayUnitButton(
              isTerminalPayment: false,
              hasConnexion: true,
              apiUser: "xxxxxxxxxxxxxxxxxxxxxxx",
              apiPassword: "xxxxxx-xxxxxxx-xxxxxx-xxxxxx",
              apiKey: "xxxxxxxxxxxxxxxxxxxxxxxxxxx",
              transactionId: getRandomId(),
              mode: 'live', // test or live
              transactionCallBackUrl: "",
              notiFyUrl: "",
              transactionAmount: "Enter the Amount here",
              currency: "XAF",
              buttonTextColor: Colors.black,
              productName: "Vapor max sniper edition",
              color: Colors.white,
              actionAfterProccess: (transactionId, transactionStatus) {
                print("Transaction id is : $transactionId  and transaction status : $transactionStatus");
                if (transactionStatus != "FAILED") {
                  // Do this if the transaction succeeds
                } else {
                  // Do this if the transaction fails
                }
              },
            ),
          ),
        ));
  }
}
11
likes
90
pub points
41%
popularity

Publisher

unverified uploader

Library flutter of the most complete payment aggregator of Cameroon, pay integrate ORANGE, MTN, PAYPAL and EXPRESS UNION in some click in your Flutter application

Repository (GitHub)
View/report issues

Documentation

API reference

License

unknown (LICENSE)

Dependencies

awesome_dialog, flutter, flutter_local_notifications, flutter_spinkit, fluttertoast, font_awesome_flutter, http, intl, simple_animations, webview_flutter

More

Packages that depend on pay_unit_sdk