Flutter app integration


Flutter supports using shared packages contributed by other developers to the Flutter and Dart ecosystems. This allows quickly building an app without having to develop everything from scratch. This plugin will support in integrating payment gateway into your flutter application.
To refer offical doumentation of the flutter plugin click here .

In our API Specifications you can find a full list of parameters that can be sent in the initial request.


Use this package as a library

Run this command with flutter :

$ flutter pub add checkout_plugin

This will add a line like this to your package's pubspec.yaml (and run an implicit dart pub get):

dependencies:
  checkout_plugin: ^0.0.3

Now in your Dart code, you can use:

import 'package:checkout_plugin/checkout_plugin.dart';

Below is the example of the sample code

example/lib/main.dart
import 'package:flutter/material.dart';
import 'dart:async';
import 'package:flutter/services.dart';
import 'package:checkout_plugin/checkout_plugin.dart';

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

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State {
  String _platformVersion = 'Unknown';
  late CheckoutPlugin _obj;

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Checkout Plugin Sample App'),
        ),
        body: Center(
            child: Row(
                mainAxisAlignment: MainAxisAlignment.center,
                children: [
                  RaisedButton(onPressed: openCheckout, child: Text('Pay'))
                ])),
      ),
    );
  }

  @override
  void initState() {
    super.initState();
    _obj = CheckoutPlugin();
  }

  void openCheckout() async {
    var options = {
      'secureKey': 'yourSecureKey',
      'requestParameters': {
        'memberId': '1234567',
        'paymentMode': 'CC',
        'terminalId': '',
        'merchantTransactionId': 'uniqueOrderId',
        'amount': '1.00',
        'currency': 'USD',
        'toType': 'docspartner',
        'paymentBrand': 'VISA',
        'merchantRedirectUrl': 'https://www.merchantredirecturl.com',
        'tmplAmount': '1.00',
        'tmplCurrency': 'USD',
        'orderDescription': 'Test Transaction',
        'country': 'UK',
        'state': 'NA',
        'street': '19 Scrimshire Lane',
        'city': 'Aston',
        'email': 'abc@domain.com',
        'postCode': 'CH5 3LJ',
        'telnocc': '+44',
        'phone': '07730432996',
        'hostUrl': 'https://www.hostURL.com/',
        'device': 'ios' // depending on device ios/android
      }
    };

    try {
      _obj.clear();
      var event_success = CheckoutPlugin.EVENT_SUCCESS;
      var event_failed = CheckoutPlugin.EVENT_FAILED;

      _obj.on(event_success, _handlePaymentSuccess);
      _obj.on(event_failed, _handlePaymentFail);
      _obj.payment(options);
    } catch (e) {
      debugPrint('Error: e');
    }
  }

  @override
  void dispose() {
    super.dispose();
    _obj.clear();
  }

  void _handlePaymentSuccess(PaymentSuccessResponse response) {
    print('In Success Main' + response.response.toString());
    _obj.clear();
  }

  void _handlePaymentFail(PaymentFailureResponse response) {
    print('In Fail Main' + response.response.toString());
    _obj.clear();
  }
}
            

Payment Modes and Brands

Find below the list of payment modes and brands for standard checkout.

Show all modes and brands

Mode Brand