flutter_payunit 0.0.5 copy "flutter_payunit: ^0.0.5" to clipboard
flutter_payunit: ^0.0.5 copied to clipboard

Pay Unit SDK Package facilitates the intergration of payments on your applications with a single button and on the go.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_payunit/flutter_payunit.dart';

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

class App extends StatelessWidget {
  const App({super.key});

  @override
  Widget build(BuildContext context) => const MaterialApp(
        debugShowCheckedModeBanner: false,
        home: Scaffold(
          body: PayButton(),
        ),
      );
}

class PayButton extends StatelessWidget {
  const PayButton({
    super.key,
  });

  @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: const EdgeInsets.only(left: 30, right: 30),
            child: PayUnitButton(
              apiUsername: "xxxxxx-xxxxxxx-xxxxxx-xxxxxx",
              apiPassword: "xxxxxx-xxxxxxx-xxxxxx-xxxxxx",
              apiKey: 'live_xxxxxxxxxxxxxxxxxxxxxxxxxxx',
              mode: 'live', // test or live
              totalAmount: 1000,
              currency: 'XAF',
              paymentCountry: 'CM',
              actionAfterProccess: (transactionId, transactionStatus) {
                print(
                    "Transaction id is : $transactionId  and transaction status : $transactionStatus");
                if (transactionStatus == 'SUCCESS') {
                  // Do this if the transaction succeeds
                  print('The tranaction $transactionId is Successfull');
                } else {
                  // Do this if the transaction fails
                  print('The tranaction $transactionId Failed');
                }
              },
              returnUrl:
                  'https://webhook.site/d457b2f3-dd71-4f04-9af5-e2fcf3be8f34',
              notifyUrl:
                  'https://webhook.site/d457b2f3-dd71-4f04-9af5-e2fcf3be8f34',
            ),
          ),
        ));
  }
}
0
likes
150
points
38
downloads

Publisher

unverified uploader

Weekly Downloads

Pay Unit SDK Package facilitates the intergration of payments on your applications with a single button and on the go.

Repository (GitLab)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

auto_size_text, dio, flutter, intl, logger, url_launcher

More

Packages that depend on flutter_payunit