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 standard_checkout_kit
This will add a line like this to your package's pubspec.yaml (and run an implicit dart pub get):
dependencies: standard_checkout_kit: ^1.0.2
Now in your Dart code, you can use:
import 'package:standard_checkout_kit/checkout_plugin.dart';
Usage
Below is the example of the sample code
example/lib/main.dartimport 'package:flutter/material.dart'; import 'dart:async'; import 'package:flutter/services.dart'; import 'package:standard_checkout_kit/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: [ ElevatedButton( style: ButtonStyle( backgroundColor: WidgetStateProperty.all(Colors.blue), ), onPressed: () { openCheckout( requestParameters: requestParameters, secureKey: secureKey); }, child: const Text( 'Pay', style: TextStyle(color: Colors.white), ), ), ])), ), ); } @override void initState() { super.initState(); _obj = CheckoutPlugin(); } void openCheckout({required Map requestParameters, required String secureKey}) async { var requestParameters = { "city": "Mumbai", "country": "IN", "currency": "INR", "device": Platform.operatingSystem, "email": "test@abc.com", "hostUrl": "https://test.paymentz.com/transaction/Checkout", "memberId": "13219", "orderDescription": "TestinTransaction", "paymentBrand": "", "paymentMode": "", "phone": "1234567890", "postCode": "400064", "state": "MH", "street": "Malad", "telnocc": "+91", "terminalId": "", "toType": "paymentz" }; var secureKey = "YOUR_SECRET_KEY"; try { var eventSuccess = CheckoutPlugin.EVENT_SUCCESS; var eventFailed = CheckoutPlugin.EVENT_FAILED; obj.on(eventSuccess, handlePaymentSuccess); obj.on(eventFailed, handlePaymentFail); _obj.payment(requestParameters, secureKey); } catch (e) { debugPrint('Error: e'); } }; @override void dispose() { super.dispose(); _obj.clear(); } void _handlePaymentSuccess(PaymentResponse response) { print('In Success Main' + response.response.toString()); _obj.clear(); } void _handlePaymentFail(PaymentResponse 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.
Mode | Brand |
---|