binoxuspay 1.0.6 copy "binoxuspay: ^1.0.6" to clipboard
binoxuspay: ^1.0.6 copied to clipboard

Binoxus Pay : Un package flutter fonctionnant avec webview afin de facilité la collecte de paiement par carte de paiement et mobile money.

example/lib/main.dart

import 'package:binoxuspay/model/binoxuspay_response.dart';
import 'package:binoxuspay/widgets/server_less_binoxuspay.dart';
import 'package:flutter/material.dart';

// PROJECT IMPORTS
import 'package:binoxuspay/binoxuspay.dart';

void main() async {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Binoxus Payment Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const MyHomePage(title: 'BinoxusPay Demo Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});
  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            const Text(
              'Commencer le paiement',
            ),
            const SizedBox(
              height: 20.0,
            ),
            TextButton.icon(
                style: OutlinedButton.styleFrom(
                  foregroundColor: Colors.blue,
                  side: const BorderSide(
                      color: Colors.blue, width: 1), // Outline border
                  shape: RoundedRectangleBorder(
                    borderRadius: BorderRadius.circular(12), // Border radius
                  ),
                  padding: const EdgeInsets.symmetric(
                      horizontal: 24, vertical: 12), // Text color
                ),
                onPressed: () {
                  // CONFIG
                  var configs = IBinoxusPayConfigs(
                    token: 'ONE_TIME_TOKEN',
                  );
                  var paymentBody = IBinoxusPaymentBody(
                    systemRef: '66fe6faa804a97fc60faae19',
                  );

                  Navigator.of(context).push(
                    // OUVRIR LA PAGE DE PAIEMENT
                    MaterialPageRoute(
                      builder: (context) => ServerLessBinoxusPayCheckout(
                        title: "Binoxus Pay",
                        titleBackgroundColor: Colors.blue.shade900,
                        titleStyle: const TextStyle(color: Colors.white),
                        configs: configs,
                        paymentBody: paymentBody,
                        onResponse: (responseValue) {
                          debugPrint("onResponse : $responseValue");
                          if (responseValue.binStatus ==
                              EApiResponseStatusCode.bIN000) {
                            // CHECK PAYMENT STATUS
                            if (responseValue.paymentStatus ==
                                IPaymentStatus.approved) {
                              // PAYMENT SUCCEED
                            } else {
                              // PAYMENT FAILS
                            }
                          } else {
                            // PAYMENT FAILS
                          }
                        },
                        onError: (errorValue) {
                          debugPrint("onError : $errorValue");
                          // PAYMENT FAILS
                        },
                      ),
                    ),
                  );
                },
                label: const Text("Payer"),
                icon: const Icon(
                  Icons.monetization_on,
                  color: Colors.blue,
                ))
          ],
        ),
      ),
    );
  }
}
2
likes
140
points
33
downloads

Publisher

unverified uploader

Weekly Downloads

Binoxus Pay : Un package flutter fonctionnant avec webview afin de facilité la collecte de paiement par carte de paiement et mobile money.

Homepage

Documentation

API reference

License

unknown (license)

Dependencies

animate_do, confetti, dio, flutter, flutter_dotenv, flutter_svg, http_interceptor, percent_indicator, rxdart

More

Packages that depend on binoxuspay