paystack_payment 0.0.4 copy "paystack_payment: ^0.0.4" to clipboard
paystack_payment: ^0.0.4 copied to clipboard

A Flutter package for integrating Paystack payments with support for channels, metadata, and split payments.

example/lib/main.dart

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

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: const PaymentScreen(),
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    final paystack = PaystackPayment(secretKey: 'sk_test_key');

    return Scaffold(
      appBar: AppBar(title: const Text('Paystack Payment Demo')),
      body: Center(
        child: ElevatedButton(
          onPressed: () {
            paystack.pay(
              context: context,
              email: 'user@example.com',
              amount: 1000.00,
              currency: 'NGN',
              onSuccess: (response) {
                ScaffoldMessenger.of(context).showSnackBar(
                  SnackBar(
                    content: Text(
                      'Success: ${response.code} - ${response.message} (Ref: ${response.reference})',
                    ),
                  ),
                );
              },
              onError: (response) {
                ScaffoldMessenger.of(context).showSnackBar(
                  SnackBar(content: Text('Error: ${response.message}')),
                );
              },
              onCancel: (response) {
                ScaffoldMessenger.of(context).showSnackBar(
                  SnackBar(content: Text('Cancelled: ${response.message}')),
                );
              },
            );
          },
          child: const Text('Pay N1000'),
        ),
      ),
    );
  }
}
4
likes
150
points
49
downloads

Publisher

verified publisherbolxtine.com

Weekly Downloads

A Flutter package for integrating Paystack payments with support for channels, metadata, and split payments.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, http, webview_flutter

More

Packages that depend on paystack_payment