pay_with_paystack 1.0.9 copy "pay_with_paystack: ^1.0.9" to clipboard
pay_with_paystack: ^1.0.9 copied to clipboard

Flutter Plugin that enable users make Paystack payment with either Mobile Money or Card on the fly provided you use the secret key provided to you from Paystack

example/example.md

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

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

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Flutter Paystack Payment'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({Key? key, required this.title}) : super(key: key);
  final String title;
  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            TextButton(
                onPressed: () {
                  final uniqueTransRef = PayWithPayStack().generateUuidV4();

                  PayWithPayStack().now(
                      context: context,
                      secretKey:
                          "sk_live_XXXXXXXXXXXXXXXXXXX",
                      customerEmail: "popekabu@gmail.com",
                      reference:
                          uniqueTransRef,
                      currency: "GHS",
                      amount: "20000",
                      transactionCompleted: () {
                        print("Transaction Successful");
                      },
                      transactionNotCompleted: () {
                        print("Transaction Not Successful!");
                      });
                },
                child: const Text(
                  "Pay With PayStack",
                  style: TextStyle(fontSize: 23),
                ))
          ],
        ),
      ), // This trailing comma makes auto-formatting nicer for build methods.
    );
  }
}
50
likes
160
pub points
94%
popularity

Publisher

unverified uploader

Flutter Plugin that enable users make Paystack payment with either Mobile Money or Card on the fly provided you use the secret key provided to you from Paystack

Homepage

Documentation

API reference

License

MIT (license)

Dependencies

flutter, http, uuid, webview_flutter

More

Packages that depend on pay_with_paystack