ipg_flutter 1.1.3 copy "ipg_flutter: ^1.1.3" to clipboard
ipg_flutter: ^1.1.3 copied to clipboard

Flutter version of Onepay internet payment gateway

example/lib/main.dart

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

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

class MyApp extends StatelessWidget {
  const MyApp({super.key});
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'IPG Flutter Demo',
      home: const IpgDemoScreen(),
    );
  }
}

class IpgDemoScreen extends StatefulWidget {
  const IpgDemoScreen({super.key});
  @override
  State<IpgDemoScreen> createState() => _IpgDemoScreenState();
}

class _IpgDemoScreenState extends State<IpgDemoScreen> {

  late Ipg ipg;

  @override
  void initState() {
    super.initState();
    ipg = Ipg.init(
      appToken: 'your_token',
      appId: 'your_app_id',
      firstName: 'John',
      lastName: 'Doe',
      email: 'john.doe@sample.com',
      phoneNumber: '0000000000',
    );

    ipg.addCardEventCallback = (status, message) {
      debugPrint("ADD CARD CALLBACK: $status");
    };

    ipg.getCustomersEventCallback = (customers, message) {
      debugPrint("GET CUSTOMERS CALLBACK: $customers");
    };

    ipg.customerPaymentEventCallback = (paymentStatus, message){
      debugPrint("CUSTOMERS PAYMENT CALLBACK: STATUS $paymentStatus, MESSAGE: $message");
    };
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text("IPG Demo")),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            ElevatedButton(
              onPressed: () => ipg.addNewCard(context),
              child: const Text("Add New Card"),
            ),
            const SizedBox(height: 20),
            ElevatedButton(
              onPressed: () => ipg.getCustomers(),
              child: const Text("Get Customers"),
            ),
            const SizedBox(height: 20),
            ElevatedButton(
              // Currently LKR and USD are supported
              onPressed: () => ipg.makeCustomerPayment("100.00", "LKR", "tok_1e3a3bcd"),
              child: const Text("Customer Payment"),
            ),
          ],
        ),
      ),
    );
  }

  @override
  void dispose() {
    ipg.dispose();
    super.dispose();
  }
}
1
likes
130
points
29
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Flutter version of Onepay internet payment gateway

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

basic_utils, convert, device_info_plus, flutter, http, pointycastle, webview_flutter

More

Packages that depend on ipg_flutter