fib_online_payment 1.1.2 copy "fib_online_payment: ^1.1.2" to clipboard
fib_online_payment: ^1.1.2 copied to clipboard

A Flutter package for handling FIB Online Payments, including authentication, payment creation, cancellation, status checks, and refunds.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:fib_online_payment/fib_online_payment.dart';
import 'package:fib_online_payment/src/models/payment_request.dart';

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

class MyApp extends StatelessWidget {
  final FibPayment fibPayment = FibPayment(
      clientId: 'YOUR_CLIENT_ID',
      clientSecret: 'YOUR_CLIENT_SECRET',
      environment: 'YOUR_ENVIRONMENT'); // YOUR_ENVIRONMENT=dev, stage or prod

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: Text('FIB Online Payment Example')),
        body: Center(
          child: ElevatedButton(
            onPressed: () async {
              try {
                final token = await fibPayment.authenticate();
                final payment = await fibPayment.createPayment(
                  PaymentRequest(
                      amount: '100.00',
                      description: 'Test Payment',
                      statusCallbackUrl: 'https://your-callback-url.com',
                      redirectUri: "https://your-redirect-uri.com"),
                  token,
                );

                print('Payment Created: ${payment.paymentId}');
                print('Payment QR Code: ${payment.qrCode}');
                print('Payment readable code: ${payment.readableCode}');

                // Check payment status.
                final status = await fibPayment.checkPaymentStatus(
                    payment.paymentId, token);
                print('Payment Status: ${status.status}');

                // Cancel payment example.
                await fibPayment.cancelPayment(payment.paymentId, token);
                await Future.delayed(
                    Duration(seconds: 5)); // Wait for cancellation to process.
                final postCancelStatus = await fibPayment.checkPaymentStatus(
                    payment.paymentId, token);
                print('Post Cancel Status: ${postCancelStatus.status}');
              } catch (e) {
                print('Error: $e');
              }
            },
            child: Text('Process Payment'),
          ),
        ),
      ),
    );
  }
}
6
likes
140
points
14
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter package for handling FIB Online Payments, including authentication, payment creation, cancellation, status checks, and refunds.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

flutter, flutter_dotenv, http, json_annotation

More

Packages that depend on fib_online_payment