connect_ips_flutter 1.0.1+4 copy "connect_ips_flutter: ^1.0.1+4" to clipboard
connect_ips_flutter: ^1.0.1+4 copied to clipboard

Unofficial plugin for integrating connect ips gateway via flutter

example/lib/main.dart

import 'dart:developer';

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

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

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

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Connect IPS Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(
          seedColor: Colors.redAccent,
        ),
        useMaterial3: true,
      ),
      home: const MyHomePage(title: 'Connect IPS demo'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({
    super.key,
    required this.title,
  });

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  // late ConnectIps connectIps;

  // @override
  // void initState() {
  //   super.initState();
  //   connectIps = ConnectIps(
  //     config: const CIPSConfig.stag(
  //       creditorPath: 'private_key.pem', // path of the .pem file
  //       merchantID: 007, // merchant ID provided by NCHL
  //       appID: 'MER-550-APP-1', // app ID provided by NCHL
  //       appName: 'APPNAME', // app name provided by NCHL
  //       transactionID:
  //           'earthier_0015', // unique transaction ID for every transaction
  //       successUrl:
  //           'https://dev.earthier.net/transaction/success', // your success url set for connect IPS after successful transaction
  //       failureUrl:
  //           'https://dev.earthier.net/transaction/failure', // your failure url set by connect IPS afetr failure
  //       transactionAmount: 1000, // transaction amount in paisa
  //     ),
  //     onMessage: (
  //       connectIPS, {
  //       description,
  //       event,
  //       needsPaymentConfirmation,
  //       statusCode,
  //     }) {
  //       log(
  //         'Description: $description, Status Code: $statusCode, Event: $event, NeedsPaymentConfirmation: $needsPaymentConfirmation',
  //       );
  //       connectIPS.close(context);
  //     },
  //     onPaymentResult: (paymentResult, connectIps) {
  //       log('result => $paymentResult');
  //       connectIps.close(context);
  //     },
  //     onReturn: ([payment]) {
  //       log('redirection after payment completion : $payment');
  //     },
  //   );
  // }

  final config = CIPSConfig.stag(
    merchantID: 007,
    appID: 'MER-550-APP-1',
    appName: 'APPNAME',
    transactionID: 'TXN-007',
    successUrl: 'https://example.com/success',
    failureUrl: 'https://example.com/transaction/failure',
    transactionAmount: 1000,
    creditorKey: () async {
      return '<--- creditor key that is fetched from the server --->';
    },
  );

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Text(widget.title),
      ),
      body: Center(
        child: ConnectIPSPaymentButton(
          config: config,
          onMessage: (
            connectIPS, {
            description,
            event,
            needsPaymentConfirmation,
            statusCode,
          }) {
            log('message: $description, event: $event, statusCode: $statusCode ');
          },
          onPaymentResult: (paymentResult, connectIps) {
            log('payment result => $paymentResult');
          },
        ),
      ),
    );
  }
}
5
likes
140
points
0
downloads
screenshot

Publisher

unverified uploader

Weekly Downloads

Unofficial plugin for integrating connect ips gateway via flutter

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

asn1lib, crypto, cupertino_icons, flutter, flutter_inappwebview, flutter_svg, http, internet_connection_checker, intl, pointycastle

More

Packages that depend on connect_ips_flutter