paystack_gateway_payment 1.1.6 copy "paystack_gateway_payment: ^1.1.6" to clipboard
paystack_gateway_payment: ^1.1.6 copied to clipboard

Flutter integration for Paystack: easily initialize, verify payments, and use a customizable payment button.

example/example.dart

import 'package:flutter/material.dart';
import 'package:paystack_gateway_payment/services/paystack_service.dart';
import 'package:paystack_gateway_payment/widgets/paystack_button.dart';

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Paystack Payment Example',
      theme: ThemeData(primarySwatch: Colors.blue),
      home: PaymentScreen(),
    );
  }
}

class PaymentScreen extends StatelessWidget {
  // Replace with your actual Paystack secret key
  final String paystackSecretKey = 'sk_test_xxxxxxxx';

  @override
  Widget build(BuildContext context) {
    final paystackService = PaystackService(secretKey: paystackSecretKey);

    return Scaffold(
      appBar: AppBar(title: const Text('Paystack Payment Example')),
      body: Center(
        child: PaystackButton(
          paystackService: paystackService,
          email: 'testuser@example.com',
          amount: 5000, // Amount in kobo (e.g., 5000 kobo = 50 NGN)
          callbackUrl: 'https://example.com/callback',
          buttonText: const Text('Pay Now'),
          paymentScreenTitle: 'Complete Your Payment',
          onTransactionComplete: (status, response) {
            // Handle transaction completion
            debugPrint('Transaction Status: $status');
            if (response != null) {
              debugPrint('Transaction Data: ${response.toString()}');
            }
          },
        ),
      ),
    );
  }
}
1
likes
160
points
322
downloads

Publisher

verified publisherhighvertical.com.ng

Weekly Downloads

Flutter integration for Paystack: easily initialize, verify payments, and use a customizable payment button.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, http, webview_flutter

More

Packages that depend on paystack_gateway_payment