0% found this document useful (0 votes)
183 views58 pages

Airpay Flutter Package Integration Doc

Uploaded by

priyanshydv10
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
183 views58 pages

Airpay Flutter Package Integration Doc

Uploaded by

priyanshydv10
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 58

VERSION 2.0.

7
DATE – 21/12/2023

PRESENTED BY: AIRPAY PAYMENT SERVICES


AIRPAY PAYMENT SERVICES PVT LTD
EMPRESSA 14, WESTERN EXPRESS HIGHWAY, SAHAR AIRPORT RD, ANDHERI EAST, MUMBAI

Flutter Integration Kit


Flutter Integration Kit

ABSTRACT

This document specifies the technical aspect of integrating Flutter Package.

2 PRIVATE & CONFIDENTIAL COPYRIGHT AIRPAY PAYMENT SERVICES PVT LTD


Flutter Integration Kit

DISCLAIMER

This documentation shall only be used for evaluating the planned services designated herein and may
contain information that is privileged, confidential, Proprietary, or otherwise protected from disclosure.
As a result, this document or content thereof shall not be disclosed, used, or duplicated, in whole or in
part, for any purpose other than the Scope of Work assigned by airpay Payment Services to your
company ("Recipient"). Upon completion of service or termination of service, the Recipient shall return
all materials, including, without limiting the generality of the foregoing, all originals, copies,
reproductions, and summaries of confidential information. Any unauthorized use or disclosure by the
directors, officers, or employees of the Recipient shall be deemed to be unauthorized use or disclosure
by the Recipient and the Recipient shall indemnify and hold harmless the airpay Payment Services from
and against all damages, losses, costs, and expenses incurred because of such breach. airpay payment
services may seek injunctive relief restraining the unauthorized disclosure or use of confidential
information in addition to any other legal or equitable remedy otherwise available.

3 PRIVATE & CONFIDENTIAL COPYRIGHT AIRPAY PAYMENT SERVICES PVT LTD


Flutter Integration Kit

VERSION HISTORY

VERSION # IMPLEMENTED REVISION APPROVED APPROVAL REASONS


BY DATE BY DATE
1.0 Tushar [21/12/2023] Kunal Shah [21/12/2023] Initial
Khandekar Draft
2.0.7 Tushar [07/02/2024] Kunal Shah [07/02/2024] Minor tweaks
Khandekar have been
implemented
in the SDK kit,
specifically
concerning
updates to
dependencies.

4 PRIVATE & CONFIDENTIAL COPYRIGHT AIRPAY PAYMENT SERVICES PVT LTD


Flutter Integration Kit

TABLE OF CONTENTS

ABSTRACT ...................................................................................................................................................... 2
Disclaimer...................................................................................................................................................... 3
Version History .............................................................................................................................................. 4
INITIAL CONFIGURATION -............................................................................................................................. 6
REQUEST PARAMETER TO CALL AIRPAY PACKAGE – ...................................................................................... 7
Request – .................................................................................................................................................. 7
PRIVATEKEY LOGIC – .................................................................................................................................. 9
CHECKSUM LOGIC – ................................................................................................................................ 10
RESPONSE MESSAGE - ................................................................................................................................. 10
Code Response ........................................................................................................................................ 10
RESPONSE FROM THE PAYMENT GATEWAY............................................................................................. 14
MANIFEST CHANGES - ................................................................................................................................. 14
pubspecs.yaml CHANGES - .......................................................................................................................... 14
SUMMARY – ................................................................................................................................................ 16
FOR SUPPORT – ........................................................................................................................................... 16
REQUEST AND RESPONSE PARAMETER TABLE ............................................................................................ 17
Request Parameter: - .......................................................................................................................... 17
Response Parameters .......................................................................................................................... 20
Sample code for reference – ....................................................................................................................... 22

5 PRIVATE & CONFIDENTIAL COPYRIGHT AIRPAY PAYMENT SERVICES PVT LTD


Flutter Integration Kit

INITIAL CONFIGURATION -

The developer needs to invoke SDK using the code below.

Flutter V3 Airpay plugin for payment integration.

Use this package as a library -

Add airpay_package as a dependency in your pubspec.yaml file. You can now include an
airpayPackage in your project.

See the airpayPackage

Depend on it -

Run this command:

With Dart:
$ dart pub add airpay_package

With Flutter:
$ flutter pub add airpay_package

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

dependencies:
airpay_flutter_package: ^2.0.7

Alternatively, your editor might support dart pub get or flutter pub get. Check
the docs for your editor to learn more.

Import it :

Now in your Dart code, you can use:

import 'package:airpay_package/airpay_package.dart';

Just make sure that your activity has set windowSoftInputMode to adjustResize in
AndroidManifest.xml
<application>
<activity android:windowSoftInputMode=“adjustResize”>
</activity>
</application >

6 PRIVATE & CONFIDENTIAL COPYRIGHT AIRPAY PAYMENT SERVICES PVT LTD


Flutter Integration Kit

REQUEST PARAMETER TO CALL AIRPAY PACKAGE –

REQUEST –

UserRequest user = UserRequest(


privatekey: privatekey.toString(),
checksum: checksum.toString(),
mercid: merchantID,
protoDomain: domainPath,
buyerFirstName: fname.text,
buyerLastName: lname.text,
buyerEmail: email.text,
buyerPhone: phone.text,
buyerAddress: fullAddress.text,
buyerPinCode: pincode.text,
orderid: orderId.text,
amount: amount.text,
buyerCity: city.text,
buyerState: state.text,
buyerCountry: country.text,
currency: "356",
isocurrency: "INR",
chmod: "",
customvar: "test",
txnsubtype: txn_subtype.text,
wallet: "0",
isStaging: this.isSandbox,
successUrl: successURL,
failedUrl: failedURL,
appName: “”, // App name value to display on Appbar title
colorCode: "", // Please pass hexadecimal color code value – For Ex. “0xFF0D47A1”
sb_nextrundate: subscription_date.text,
sb_period: dropdownValue.toString(),

7 PRIVATE & CONFIDENTIAL COPYRIGHT AIRPAY PAYMENT SERVICES PVT LTD


Flutter Integration Kit

sb_frequency: subscription_frequency.text,
sb_amount: subscription_amount.text,
sb_isrecurring: "1",
sb_recurringcount: subscription_rec_count.text,
sb_retryattempts: subRetryValue,
sb_maxamount: subscription_max_amount.text
);

Navigator.push(
context,
MaterialPageRoute(
builder: (BuildContext context) => new AirPay(
user: user,
closure: (status, response) => {onComplete(status, response)}),
),
);
}

8 PRIVATE & CONFIDENTIAL COPYRIGHT AIRPAY PAYMENT SERVICES PVT LTD


Flutter Integration Kit

Screenshot for reference –

PRIVATEKEY LOGIC –

9 PRIVATE & CONFIDENTIAL COPYRIGHT AIRPAY PAYMENT SERVICES PVT LTD


Flutter Integration Kit

var date = new DateTime.now();


var format = DateFormat("yyyy-MM-dd");
var formattedDate = format.format(date);
var temp = utf8.encode(
'${kAirPaySecretKey.toString()}@${kAirPayUserName.toString()}:|:${kAirPayPassword.toString()}');
var privatekey = sha256.convert(temp);

CHECKSUM LOGIC –

var siindexvar =
'${subscription_date.text}${subscription_frequency.text}${dropdownValue.toString()}${subscription_am
ount.text}${"1"}${subscription_rec_count.text}${subRetryValue.toString()}';

if(txn_subtype.text.toString() == "12"){
siindexvar = siindexvar;
}else{
siindexvar = "";
}

var setAllStr =
'${email.text}${fname.text}${lname.text}${fullAddress.text}${city.text}${state.text}${country.text}${amo
unt.text.toString()}${orderId.text.toString()}${siindexvar.toString()}$formattedDate';

// key for checksum


var sTemp2 =
utf8.encode('${kAirPayUserName.toString()}~:~${kAirPayPassword.toString()}');
var sKey = sha256.convert(sTemp2);

// checksum
var sAllData = utf8.encode('$sKey@$setAllStr');
var checksum = sha256.convert(sAllData);

RESPONSE MESSAGE -

CODE RESPONSE

10 PRIVATE & CONFIDENTIAL COPYRIGHT AIRPAY PAYMENT SERVICES PVT LTD


Flutter Integration Kit

onComplete method:

onComplete(status, response) {

var resp = response.toJson();

print(resp);

var txtStsMsg = resp['STATUSMSG'] ?? "";

var txtSts = resp['TRANSACTIONSTATUS'] ?? "";

Navigator.pop(context);

if (txtStsMsg == '') {

txtStsMsg = response['STATUSMSG'] ?? "";

txtSts = response['TRANSACTIONSTATUS'] ?? "";

if (txtStsMsg == 'Invalid Checksum') {

// txtStsMsg = "Transaction Canceled";

//For SecureHash Validation Logic -

var transid = resp['MERCHANTTRANSACTIONID'] ?? "";

var apTransactionID = resp['TRANSACTIONID'] ?? "";

var amount = resp['TRANSACTIONAMT'] ?? "";

var transtatus = resp['TRANSACTIONSTATUS'] ?? "";

var message = resp['STATUSMSG'] ?? "";

var customer_vpa ="";

var customer_fvpa ="";

var chmode = resp['CHMOD'] ?? "";

11 PRIVATE & CONFIDENTIAL COPYRIGHT AIRPAY PAYMENT SERVICES PVT LTD


Flutter Integration Kit

var subscriptionID = resp['SUBSCRIPTION_ID'] ?? "";

var secureHash = resp['AP_SECUREHASH'] ?? "";

if(!chmode.toString().isEmpty && chmode.toString() == "upi" ){

customer_vpa = resp['CUSTOMERVPA'] ?? "";

customer_fvpa = ":$customer_vpa";

var merchantid = ""; //Please enter Merchant Id

var username = ""; //Please enter Username

// Calculate the CRC32 checksum

var sParam =

'${transid}:${apTransactionID}:${amount}:${transtatus}:${message}:${merchantid}:${username}$custom
er_fvpa';

var checkSumResult = Crc32.calculate(sParam);

if(checkSumResult.toString() == secureHash.toString()){

Fluttertoast.showToast(

msg: "Securehash matched",

toastLength: Toast.LENGTH_LONG,

gravity: ToastGravity.BOTTOM,

timeInSecForIosWeb: 1,

backgroundColor: Colors.white24,

textColor: Colors.white,

fontSize: 16.0

);

12 PRIVATE & CONFIDENTIAL COPYRIGHT AIRPAY PAYMENT SERVICES PVT LTD


Flutter Integration Kit

}else{

Fluttertoast.showToast(

msg: "Securehash mis-matched",

toastLength: Toast.LENGTH_LONG,

gravity: ToastGravity.BOTTOM,

timeInSecForIosWeb: 1,

backgroundColor: Colors.white24,

textColor: Colors.white,

fontSize: 16.0

);

AwesomeDialog(

context: context,

dialogType: DialogType.NO_HEADER,

headerAnimationLoop: true,

animType: AnimType.BOTTOMSLIDE,

//title: "AirPay",

desc: 'Transaction Status: ' + txtSts +

'\nTransaction Status Message: ' +

txtStsMsg)

.show();

13 PRIVATE & CONFIDENTIAL COPYRIGHT AIRPAY PAYMENT SERVICES PVT LTD


Flutter Integration Kit

RESPONSE FROM THE PAYMENT GATEWAY

MERCHANTTRANSACTIONID = orderid you have send to airpay system is returned back


TRANSACTIONID = airpay transaction reference number
TRANSACTIONAMT = transaction amount
STATUS = successful = 200
STATUSMSG = Response message received from payment gateway.
SECUREHASH = Secure hash generated by airpay
All fields are mandatory except MESSAGE.
(** This method is mandatory. You can get it from the settings page of your airpay merchant account. *
This method ismandatory)
chmod variable contains Payment Modes available for user. for e.g. If you want to show only Credit
Card/Debit Card, then value of the chmod variable will be "pg". If you want Netbanking and Prepaid
card then value of the chmod variable will be "nb_ppc".If you want to show all payment options
activated for you at airpay, then leave this variable blank.
Various modes passed this way separated by underscore element.
(If you want to show all payment options activated for you at airpay, then leave this variable blank.)

MANIFEST CHANGES -

In the AndroidManifest.xml file located at android/app/src/main you need to add this permission inside
the manifest tag and also need to add xmlns:tools value -

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.example.airpay_example">

<uses-permission android:name="android.permission.INTERNET" />

And need to add Meta-data tag inside the application tag value -
For reference shared code below –
<meta-data
android:name="flutterEmbedding"
android:value="2" />

PUBSPECS.YAML CHANGES -

14 PRIVATE & CONFIDENTIAL COPYRIGHT AIRPAY PAYMENT SERVICES PVT LTD


Flutter Integration Kit

name: airpay_example
description: A new Flutter project.

# The following line prevents the package from being accidentally published to
# pub.dev using `pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev

# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as
CFBundleVersion.
# Read more about iOS versioning at
#
https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference
/Articles/CoreFoundationKeys.html
version: 1.0.0+1

environment:
sdk: ">=2.12.0 <3.0.0"

dependencies:
flutter:
sdk: flutter
airpay_flutter_package: ^2.0.7
#airpay_flutter_package:
# path: ../
# git:
# url:
# ref: main

# The following adds the Cupertino Icons font to your application.


# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2
alert_dialog: ^1.0.1
awesome_dialog: ^2.1.2
email_validator: ^2.1.16
intl: ^0.18.0
url_launcher: ^6.1.14
fluttertoast: ^8.2.2

15 PRIVATE & CONFIDENTIAL COPYRIGHT AIRPAY PAYMENT SERVICES PVT LTD


Flutter Integration Kit

dev_dependencies:
flutter_test:
sdk: flutter

SUMMARY –

Flutter is intended to provide an example to Merchant for integrating merchant Payment Solution.
For a summary of features, please see the Airpay_Flutter_SDK_Integration.pdf file.

FOR SUPPORT –

- Tech/integration Support Team


- Customer Support Team

16 PRIVATE & CONFIDENTIAL COPYRIGHT AIRPAY PAYMENT SERVICES PVT LTD


Flutter Integration Kit

REQUEST AND RESPONSE PARAMETER TABLE


REQUEST PARAMETER: -

Method Name Input Data Data Length Example


Format
buyerEmail String 6-50 [email protected]
buyerPhone String 8-15 9898989898

buyerFirstName String 1-50 Name


buyerLastName String 1-50 Name
buyerAddress String 4-255 Mumbai
buyerCity String 2-50 Mumbai

buyerState String 2-50 Maharashtra


buyerCountry String 2-50 India
buyerPinCode String 4-8 400001
amount String 1-7 50.00
chmod String 0-15 Payment Mode (not required)
• ppc - prepaid card
• pg - payment gateway
• nb - Netbanking
• pgcc - Credit card
• pgdc - Debit card
• cash - Cash
• emi - EMI
• rtgs - RTGS
• upi - UPI
• btqr - Bharat QR
• payltr - Pay later
• va - Virtual account
• enach - eNACH
• remit - Remittance

17 PRIVATE & CONFIDENTIAL COPYRIGHT AIRPAY PAYMENT SERVICES PVT LTD


Flutter Integration Kit

chmod variable contains Payment Modes available for


user. for e.g. If you want to show only Credit
Card/Debit Card, then value of the chmod variable will
be "pg". If you want Netbanking and Prepaid card then
value of the chmod variable will be "nb_ppc".If you
want to show all payment options activated for you at
airpay, then leave this variable blank.

checksum String 1-100 Generate Checksum **

privatekey String 1-100 Generate Private Key **

mercid String 1-15 Provide by airpay **

successUrl String 10-255 Valid working Url


failedUrl String 10-255 Valid working Url – Keep same as Success Url
customvar String 1-100 Alphanumeric, Space, =

txnsubtype String 1 For Normal Txn – “” (Blank Value)


//For Subscription – 12
wallet String 1 Numeric
currency Integer 3 Eg. 356
isocurrency String 3 Eg. INR
orderid String 20 Test123
protoDomain String 10-255 Valid working Url – Keep same as Success Url
isStaging String 5 true : For Staging ,
false: For Production
appName String 0-255 App name value to display on Appbar title
colorCode String 10 Please pass Hexadecimal color code value – Ex.
“0xFF0D47A1”
sb_nextrundate Date 103 Subscription next run date (length 103, required for
enabling subscription)

mm/dd/yyyy date must be current date+1 (t+1)


sb_period D|W|M|Y|A 1 Subscription period (length 1, required for enabling
subscription)

Day/Week/Month/Year/Adhoc
sb_frequency Numeric 1-999 Subscription frequency (length 1-999, required for
enabling subscription)
sb_amount Numeric 1-6 .2 Subscription amount (length 1-6 .2, required for
enabling subscription)
sb_isrecurring Numeric 1 Is subscription recurring (length 1, required for

18 PRIVATE & CONFIDENTIAL COPYRIGHT AIRPAY PAYMENT SERVICES PVT LTD


Flutter Integration Kit

enabling subscription)
sb_recurringcount Numeric 1-999 Subscription Recurring Count (length 1-999, required
for enabling subscription and Is Subscription Recurring
is Yes , if recurring count is 999 than subscription is set
as never ending end date its apply only for enach
transaction)
sb_retryattempts Numeric 1 Subscription retry attempts (length 1, required for
enabling subscription)
sb_maxamount Numeric 1-6 .2 Maximum amount can charge, and greater than or
equal to the amount (Not required)

19 PRIVATE & CONFIDENTIAL COPYRIGHT AIRPAY PAYMENT SERVICES PVT LTD


Flutter Integration Kit

RESPONSE PARAMETERS

Field Type Description

STATUS Numeric Transaction Payment Status (required)


Success - 200
Transaction in Process - 211
Failed - 400
Dropped - 401
Cancel - 402
Incomplete - 403
Bounced - 405
No Records – 503

TXN_MODE Alphanumeric Transaction mode LIVE or Sandbox

TXN_DATE_TIME Date Transaction Date and Time

TXN_CURRENCY_CODE Numeric Payment Currency (eg:- 356)

CURRENCY_CODE Alphanumeric Payment Currency (eg:- inr)

TRANSACTIONID Numeric orderid you have send to airpay system (required)

TRANSACTIONAMT Numeric Transaction amount (required)

TRANSACTIONSTATUS Numeric Transaction status code (eg:- 200(success),402(cancelled))

STATUSMSG Alphanumeric Transaction payment status


SUCCESS
TRANSACTION IN PROCESS
FAILED
DROPPED
CANCEL
INCOMPLETE
BOUNCED
NO RECORDS

MERCHANTTRANSACTIONID Numeric Merchant transaction id.

MERCHANTKEY Numeric Merchant key.

CUSTOMVAR Alphanumeric customvar value received from payment gateway.

AP_SECUREHASH Alphanumeric Secure hash generated by Airpay Server.

20 PRIVATE & CONFIDENTIAL COPYRIGHT AIRPAY PAYMENT SERVICES PVT LTD


Flutter Integration Kit

CHMOD Alphanumeric Chanel of Payment done

FULLNAME Alphanumeric Customer name.

EMAIL Alphanumeric Customer Email

CONTACTNO Numeric Customer phone

APTRANSACTIONID Numeric airpay transaction reference number (required)

ISRISK Numeric If the transaction is risk

BILLEDAMOUNT Numeric Billed Amount

CUSTOMERVPA Alphanumeric VPA will return if channel is upi


Card issur name, this field is available in pg,emi,express
CARDISSUER Alphanumeric payment
Card number masked, this field is available in pg,emi,express
CARD_DETAILS Numeric payment

BANKNAME Alphanumeric Name of the bank, this field is available in pg,emi,pos

CARDCOUNTRY Alphanumeric Card issued country, this field is available in pg,emi,pos

CARDTYPE Alphanumeric Type of Card Credit/Debit/Unknown

SUBSCRIPTION_ID Alphanumeric Airpay Subscription Id

TRANSACTIONREASON Alphanumeric Failed Reason

21 PRIVATE & CONFIDENTIAL COPYRIGHT AIRPAY PAYMENT SERVICES PVT LTD


Flutter Integration Kit

SAMPLE CODE FOR REFERENCE –

import 'package:airpay_flutter_package/airpay_package.dart';
import 'package:airpay_flutter_package/screens/airpay_home_new.dart';
import 'package:awesome_dialog/awesome_dialog.dart';
import 'package:email_validator/email_validator.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:intl/intl.dart';
import 'dart:convert';
import 'package:crypto/crypto.dart';
import 'package:crc32_checksum/crc32_checksum.dart';

class Home extends StatefulWidget {


final bool isSandbox;
Home({required this.isSandbox});

@override
_HomeState createState() => _HomeState(isSandbox: isSandbox);
}

class _HomeState extends State<Home> {


final bool isSandbox;

final RegExp _emojiRegex = RegExp(

22 PRIVATE & CONFIDENTIAL COPYRIGHT AIRPAY PAYMENT SERVICES PVT LTD


Flutter Integration Kit

r'[\u{1F600}-\u{1F64F}\u{1F300}-\u{1F5FF}\u{1F680}-\u{1F6FF}\u{1F700}-\u{1F77F}\u{1F780}-
\u{1F7FF}\u{1F800}-\u{1F8FF}\u{1F900}-\u{1F9FF}\u{1FA00}-\u{1FA6F}\u{1FA70}-\u{1FAFF}\u{1FAB0}-
\u{1FAB6}\u{1FAC0}-\u{1FAC2}\u{1FAD0}-\u{1FAD9}\u{1FADA}-\u{1FADB}\u{1FADC}-
\u{1FADD}\u{1FAE0}-\u{1FAE1}\u{1FAE2}-\u{1FAE3}\u{1FAE4}-\u{1FAE5}\u{1FAE6}-\u{1FAE7}\u{1FAE8}-
\u{1FAE9}\u{1FAEA}-\u{1FAEB}]',
unicode: true,
);
final RegExp regex = RegExp(r'[^a-zA-Z]');
final RegExp email_regex = RegExp(r'^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$');

_HomeState({required this.isSandbox});

bool isSuccess = false;


bool isVisible = false;
bool isSubVisible = false;
TextEditingController fname = TextEditingController();
TextEditingController lname = TextEditingController();
TextEditingController email = TextEditingController();
TextEditingController phone = TextEditingController();
TextEditingController city = TextEditingController();
TextEditingController state = TextEditingController();
TextEditingController country = TextEditingController();
TextEditingController pincode = TextEditingController();
TextEditingController orderId = TextEditingController();
TextEditingController amount = TextEditingController();
TextEditingController fullAddress = TextEditingController();
TextEditingController subscription_date = TextEditingController();
TextEditingController subscription_frequency = TextEditingController();
TextEditingController subscription_max_amount = TextEditingController();
TextEditingController subscription_amount = TextEditingController();
TextEditingController subscription_rec_count = TextEditingController();
TextEditingController txn_subtype = TextEditingController();

23 PRIVATE & CONFIDENTIAL COPYRIGHT AIRPAY PAYMENT SERVICES PVT LTD


Flutter Integration Kit

DateTime selectedDate = DateTime.now().add(Duration(days: 2)); // Start from 2 days in the future


List<String> subscription_period = ['Day', 'Week', 'Month', 'Year', 'Adhoc'];
List<String> subscription_retry = ['No', 'Yes'];

String dropdownValue ="";


String subRetryValue ="";
//const List<String> list = <String>['One', 'Two', 'Three', 'Four'];

void _showAddress() {
setState(() {
isVisible = !isVisible;

});
}
void _showSubscription() {
setState(() {
isSubVisible = !isSubVisible;
});
}

@override
void initState() {
super.initState();
dropdownValue = "D";
subRetryValue = "0"; //Default value set as 0
fname.text = "";
lname.text = "";
email.text = "";
phone.text = "";
fullAddress.text = "";

24 PRIVATE & CONFIDENTIAL COPYRIGHT AIRPAY PAYMENT SERVICES PVT LTD


Flutter Integration Kit

pincode.text = "";
orderId.text = "";
amount.text = "";
city.text = "";
state.text = "";
country.text = "";
}

int calculateCRC32(String input) {


final List<int> crcTable = List<int>.generate(256, (int index) {
var crc = index;
for (var j = 0; j < 8; j++) {
if (crc & 1 == 1) {
crc = (crc >> 1) ^ 0xEDB88320;
} else {
crc >>= 1;
}
}
return crc & 0xFFFFFFFF;
});

int crc = 0xFFFFFFFF;


final List<int> bytes = input.codeUnits;

for (final byte in bytes) {


crc = (crc >> 8) ^ crcTable[(crc ^ byte) & 0xFF];
}

return crc ^ 0xFFFFFFFF;


}

onComplete(status, response) {

25 PRIVATE & CONFIDENTIAL COPYRIGHT AIRPAY PAYMENT SERVICES PVT LTD


Flutter Integration Kit

var resp = response.toJson();


print(resp);
var txtStsMsg = resp['STATUSMSG'] ?? "";
var txtSts = resp['TRANSACTIONSTATUS'] ?? "";
Navigator.pop(context);
if (txtStsMsg == '') {
txtStsMsg = response['STATUSMSG'] ?? "";
txtSts = response['TRANSACTIONSTATUS'] ?? "";
}
if (txtStsMsg == 'Invalid Checksum') {
// txtStsMsg = "Transaction Canceled";
}

var transid = resp['MERCHANTTRANSACTIONID'] ?? "";


var apTransactionID = resp['TRANSACTIONID'] ?? "";
var amount = resp['TRANSACTIONAMT'] ?? "";
var transtatus = resp['TRANSACTIONSTATUS'] ?? "";
var message = resp['STATUSMSG'] ?? "";
var customer_vpa ="";
var customer_fvpa ="";
var chmode = resp['CHMOD'] ?? "";
var subscriptionID = resp['SUBSCRIPTION_ID'] ?? "";
var secureHash = resp['AP_SECUREHASH'] ?? "";

//(!TextUtils.isEmpty(transaction.getChMode()) &&
transaction.getChMode().equalsIgnoreCase("upi")){
if(!chmode.toString().isEmpty && chmode.toString() == "upi" ){
customer_vpa = resp['CUSTOMERVPA'] ?? "";
customer_fvpa = ":$customer_vpa";
}
var merchantid = ""; //Please enter Merchant Id

26 PRIVATE & CONFIDENTIAL COPYRIGHT AIRPAY PAYMENT SERVICES PVT LTD


Flutter Integration Kit

var username = ""; //Please enter Username

// Calculate the CRC32 checksum

var sParam =

'${transid}:${apTransactionID}:${amount}:${transtatus}:${message}:${merchantid}:${username}$custom
er_fvpa';

var checkSumResult = Crc32.calculate(sParam);

if(checkSumResult.toString() == secureHash.toString()){
Fluttertoast.showToast(
msg: "Securehash matched",
toastLength: Toast.LENGTH_LONG,
gravity: ToastGravity.BOTTOM,
timeInSecForIosWeb: 1,
backgroundColor: Colors.white24,
textColor: Colors.white,
fontSize: 16.0
);
}else{
Fluttertoast.showToast(
msg: "Securehash mis-matched",
toastLength: Toast.LENGTH_LONG,
gravity: ToastGravity.BOTTOM,
timeInSecForIosWeb: 1,
backgroundColor: Colors.white24,
textColor: Colors.white,

27 PRIVATE & CONFIDENTIAL COPYRIGHT AIRPAY PAYMENT SERVICES PVT LTD


Flutter Integration Kit

fontSize: 16.0
);
}

AwesomeDialog(
context: context,
dialogType: DialogType.NO_HEADER,
headerAnimationLoop: true,
animType: AnimType.BOTTOMSLIDE,
//title: "AirPay",
desc: 'Transaction Status: ' +
txtSts +
'\nTransaction Status Message: ' +
txtStsMsg)
.show();
}

void ValidateFields() {
var msg = '';
if (fname.text.length < 2) {
msg = 'Enter first name';
} else if (RegExp(r"^[a-zA-Z0-9]+$").hasMatch(fname.text) == false) {
msg = 'Enter a valid first name';
} else if (lname.text.isEmpty) {
msg = 'Enter last name';
} else if (RegExp(r"^[a-zA-Z0-9]+$").hasMatch(lname.text) == false) {
msg = 'Enter a valid last name';
} else if (email.text.isEmpty && phone.text.isEmpty) {
msg = 'Enter an email ID or phone number';
} else if (email.text.isNotEmpty &&
RegExp(r"^[a-zA-Z0-9.a-zA-Z0-9._`{|}~]+@[a-zA-Z0-9]+\.[a-zA-Z]+")

28 PRIVATE & CONFIDENTIAL COPYRIGHT AIRPAY PAYMENT SERVICES PVT LTD


Flutter Integration Kit

.hasMatch(email.text) ==
false) {
msg = "Please enter a valid email";
} else if (phone.text.isNotEmpty && phone.text.length < 10) {
msg = 'Enter a valid phone number';
} else if (orderId.text.isEmpty) {
msg = 'Enter order ID';
} else if (amount.text.isEmpty) {
msg = 'Enter an amount to proceed';
} else if (amount.text == '0') {
msg = 'Enter valid amount to proceed';
}
else if(txn_subtype.text == "12" && subscription_date.text.toString().isEmpty){
msg = 'Enter valid Subscription Next Run Date';
}
else if(txn_subtype.text == "12" && subscription_frequency.text.toString().isEmpty){
msg = 'Enter valid Subscription Frequency';
}
else if(txn_subtype.text == "12" && subscription_max_amount.text.toString().isEmpty){
msg = 'Enter valid Subscription Max Amount';
}
else if(txn_subtype.text == "12" && subscription_amount.text.toString().isEmpty){
msg = 'Enter valid Subscription Amount';
}
else if(txn_subtype.text == "12" && subscription_rec_count.text.toString().isEmpty){
msg = 'Enter valid Subscription Recurring Count';
}

if (msg.isNotEmpty) {
AwesomeDialog(
context: context,
dialogType: DialogType.NO_HEADER,

29 PRIVATE & CONFIDENTIAL COPYRIGHT AIRPAY PAYMENT SERVICES PVT LTD


Flutter Integration Kit

headerAnimationLoop: true,
animType: AnimType.BOTTOMSLIDE,
btnOkOnPress: () {},
btnOkColor: Colors.red,
desc: msg)
.show();
return;
}

//Testing Credentails
String domainPath =
''; // Please enter same input as successurl

String kAirPaySecretKey = ''; // Please enter secret Key

String kAirPayUserName = ''; //Please enter username

String kAirPayPassword = ''; //Please enter password

String merchantID = ''; //Please enter merchant id

String successURL =
''; // Please enter successurl

String failedURL =
''; // Please enter same input as successurl

//Private Key and Checksum

30 PRIVATE & CONFIDENTIAL COPYRIGHT AIRPAY PAYMENT SERVICES PVT LTD


Flutter Integration Kit

var date = new DateTime.now();


var format = DateFormat("yyyy-MM-dd");
var formattedDate = format.format(date);
var temp = utf8.encode(
'${kAirPaySecretKey.toString()}@${kAirPayUserName.toString()}:|:${kAirPayPassword.toString()}');
var privatekey = sha256.convert(temp);

//In case of Subscription -


var siindexvar =
'${subscription_date.text}${subscription_frequency.text}${dropdownValue.toString()}${subscription_am
ount.text}${"1"}${subscription_rec_count.text}${subRetryValue.toString()}';
if(txn_subtype.text.toString() == "12"){
siindexvar = siindexvar;
}else{
siindexvar = "";
}

var setAllStr =

'${email.text}${fname.text}${lname.text}${fullAddress.text}${city.text}${state.text}${country.text}${amo
unt.text
.toString()}${orderId.text
.toString()}${siindexvar.toString()}$formattedDate';

// key for checksum


var sTemp2 =
utf8.encode('${kAirPayUserName
.toString()}~:~${kAirPayPassword
.toString()}');
var sKey = sha256.convert(sTemp2);
// checksum

31 PRIVATE & CONFIDENTIAL COPYRIGHT AIRPAY PAYMENT SERVICES PVT LTD


Flutter Integration Kit

var sAllData = utf8.encode('$sKey@$setAllStr');

var checksum = sha256.convert(sAllData);

UserRequest user = UserRequest(


privatekey: privatekey.toString(),
checksum: checksum.toString(),
mercid: merchantID,
protoDomain: domainPath,
buyerFirstName: fname.text,
buyerLastName: lname.text,
buyerEmail: email.text,
buyerPhone: phone.text,
buyerAddress: fullAddress.text,
buyerPinCode: pincode.text,
orderid: orderId.text,
amount: amount.text,
buyerCity: city.text,
buyerState: state.text,
buyerCountry: country.text,
currency: "356",
isocurrency: "INR",
chmod: "",
customvar: "test",
txnsubtype: txn_subtype.text,
wallet: "0",
isStaging: this.isSandbox, //True for the Staging
successUrl: successURL,
failedUrl: failedURL,
appName: "", // App name value to display on Appbar title
colorCode: "", // Please pass hexadecimal color code value – For Ex. “0xFF0D47A1”

32 PRIVATE & CONFIDENTIAL COPYRIGHT AIRPAY PAYMENT SERVICES PVT LTD


Flutter Integration Kit

sb_nextrundate: subscription_date.text,
sb_period: dropdownValue.toString(),
sb_frequency: subscription_frequency.text,
sb_amount: subscription_amount.text,
sb_isrecurring: "1",
sb_recurringcount: subscription_rec_count.text,
sb_retryattempts: subRetryValue,
sb_maxamount: subscription_max_amount.text
);

Navigator.push(
context,
MaterialPageRoute(
builder: (BuildContext context) => new AirPay(
user: user,
closure: (status, response) => {onComplete(status, response)}),
),
);
}

Future<void> _selectDate(BuildContext context) async {


final DateTime? picked = await showDatePicker(
context: context,
initialDate: selectedDate,
firstDate: DateTime.now().add(Duration(days: 2)), // Set the minimum selectable date
lastDate: DateTime(2101), // Set a far future date as the maximum selectable date
);

if (picked != null && picked != selectedDate) {

33 PRIVATE & CONFIDENTIAL COPYRIGHT AIRPAY PAYMENT SERVICES PVT LTD


Flutter Integration Kit

setState(() {
selectedDate = picked;
final formattedDate = DateFormat('dd/MM/yyyy').format(selectedDate.toLocal());
//subscription_date.text = selectedDate.toLocal().toString().split(' ')[0];
subscription_date.text = formattedDate;

});
}
}

@override
Widget build(BuildContext context) {
String newValue = "";
return Scaffold(
appBar: AppBar(
centerTitle: true,
title: Image.asset(
'assets/airpays.png',
height: 40,
color: Colors.white,
width: 200,
),
backgroundColor: Colors.blue[900],
),
backgroundColor: Colors.grey[400],
body: SafeArea(
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,

34 PRIVATE & CONFIDENTIAL COPYRIGHT AIRPAY PAYMENT SERVICES PVT LTD


Flutter Integration Kit

children: [
Card(
margin: EdgeInsets.fromLTRB(8.0, 8, 8.0, 4),
color: Colors.white,
child: Padding(
padding: const EdgeInsets.fromLTRB(12.0, 2.0, 12.0, 15.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Text(
'Personal Information',
style: TextStyle(
fontSize: 20.0,
color: Colors.blue[900],
fontWeight: FontWeight.bold),
),
SizedBox(
height: 15.0,
),
Row(
children: [
Expanded(
child: Text(
'First Name *',
style: TextStyle(
fontSize: 18.0, color: Colors.blue[900]),
)),
SizedBox(
width: 10.0,
),
Expanded(

35 PRIVATE & CONFIDENTIAL COPYRIGHT AIRPAY PAYMENT SERVICES PVT LTD


Flutter Integration Kit

child: Text(
'Last Name *',
style: TextStyle(
fontSize: 18.0, color: Colors.blue[900]),
),
),
],
),
Row(
children: [
Expanded(
child: TextFormField(
inputFormatters: [
// FilteringTextInputFormatter.allow(RegExp(r'^[a-zA-Z0-9]+$')),
FilteringTextInputFormatter.deny(_emojiRegex),
FilteringTextInputFormatter.deny(regex),

new LengthLimitingTextInputFormatter(18),
],
keyboardType: TextInputType.name,
decoration: InputDecoration(
hintText: 'First Name',
// contentPadding: EdgeInsets.all(2.0),
hintStyle: TextStyle(
color: Colors.grey, fontSize: 15.0),
),
controller: fname,
)),
SizedBox(
width: 10.0,
),
Expanded(

36 PRIVATE & CONFIDENTIAL COPYRIGHT AIRPAY PAYMENT SERVICES PVT LTD


Flutter Integration Kit

child: TextFormField(
inputFormatters: [
FilteringTextInputFormatter.deny(_emojiRegex),
FilteringTextInputFormatter.deny(regex),
// FilteringTextInputFormatter.allow(RegExp(r'^[a-zA-Z0-9]+$')),
new LengthLimitingTextInputFormatter(18),
],
keyboardType: TextInputType.name,
decoration: InputDecoration(
hintText: 'Last Name',
// contentPadding: EdgeInsets.all(2.0),
hintStyle: TextStyle(
color: Colors.grey, fontSize: 15.0),
),
controller: lname,
),
),
],
),
SizedBox(
height: 8.0,
),
Container(
child: TextFormField(
validator: (value) => EmailValidator.validate(value!)
? null
: "Please enter a valid email",
inputFormatters: [
FilteringTextInputFormatter.deny(_emojiRegex),

// FilteringTextInputFormatter.allow(RegExp(r'^[a-zA-Z0-9]+$')),
],

37 PRIVATE & CONFIDENTIAL COPYRIGHT AIRPAY PAYMENT SERVICES PVT LTD


Flutter Integration Kit

keyboardType: TextInputType.emailAddress,
decoration: InputDecoration(
hintText: 'Email Id',
// contentPadding: EdgeInsets.all(2.0),
hintStyle:
TextStyle(color: Colors.grey, fontSize: 15.0),
),
controller: email,
),
),
SizedBox(
height: 8.0,
),
Container(
child: TextFormField(
keyboardType: TextInputType.number,
inputFormatters: <TextInputFormatter>[
FilteringTextInputFormatter.deny(_emojiRegex),
new LengthLimitingTextInputFormatter(
10), // for mobile
FilteringTextInputFormatter.digitsOnly
], // Only numbers can be entered
decoration: InputDecoration(
hintText: 'Phone',
// contentPadding: EdgeInsets.all(2.0),
hintStyle:
TextStyle(color: Colors.grey, fontSize: 15.0),
),
controller: phone,
),
),
SizedBox(

38 PRIVATE & CONFIDENTIAL COPYRIGHT AIRPAY PAYMENT SERVICES PVT LTD


Flutter Integration Kit

height: 15.0,
),
],
),
),
),
Visibility(
visible: true,
child: Card(
margin: EdgeInsets.fromLTRB(8.0, 8, 8.0, 4),
color: Colors.white,
child: Padding(
padding: EdgeInsets.fromLTRB(8.0, 8, 8.0, 4),
child: Column(
children: [
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Text(
'Address',
style: TextStyle(
color: Colors.blue[900],
fontSize: 20.0,
fontWeight: FontWeight.bold),
),
IconButton(
onPressed: () {
_showAddress();
},
icon: isVisible
? Icon(Icons.arrow_drop_up)

39 PRIVATE & CONFIDENTIAL COPYRIGHT AIRPAY PAYMENT SERVICES PVT LTD


Flutter Integration Kit

: Icon(Icons.arrow_drop_down),
color: Colors.black,
)
],
),
Visibility(
visible: isVisible,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment:
CrossAxisAlignment.stretch,
children: [
Container(
child: TextFormField(
inputFormatters: <TextInputFormatter>[
// FilteringTextInputFormatter.allow(RegExp(r'(^[0-9]{0,7}(?:\.[0-9]{0,2})?)')),
FilteringTextInputFormatter.deny(_emojiRegex),
new LengthLimitingTextInputFormatter(
254),
],
keyboardType: TextInputType.text,
decoration: InputDecoration(
hintText: 'Full Address',
// contentPadding: EdgeInsets.all(2.0),
hintStyle: TextStyle(
color: Colors.grey,
fontSize: 15.0),
),
controller: fullAddress,
),
),
SizedBox(

40 PRIVATE & CONFIDENTIAL COPYRIGHT AIRPAY PAYMENT SERVICES PVT LTD


Flutter Integration Kit

height: 8.0,
),
Container(
child: TextFormField(
inputFormatters: <TextInputFormatter>[
// FilteringTextInputFormatter.allow(RegExp(r'(^[0-9]{0,7}(?:\.[0-9]{0,2})?)')),
FilteringTextInputFormatter.deny(_emojiRegex),
new LengthLimitingTextInputFormatter(
18),
],
keyboardType: TextInputType.text,
decoration: InputDecoration(
hintText: 'City Name',
// contentPadding: EdgeInsets.all(2.0),
hintStyle: TextStyle(
color: Colors.grey,
fontSize: 15.0),
),
controller: city,
),
),
SizedBox(
height: 8.0,
),
Row(
children: [
Expanded(
child: Text(
'State Name',
style: TextStyle(
fontSize: 18.0,
color: Colors.blue[900]),

41 PRIVATE & CONFIDENTIAL COPYRIGHT AIRPAY PAYMENT SERVICES PVT LTD


Flutter Integration Kit

)),
SizedBox(
width: 8.0,
),
Expanded(
child: Text(
'Country Name',
style: TextStyle(
fontSize: 18.0,
color: Colors.blue[900]),
),
),
],
),
Row(
children: [
Expanded(
child: TextFormField(
inputFormatters: <TextInputFormatter>[
// FilteringTextInputFormatter.allow(RegExp(r'(^[0-9]{0,7}(?:\.[0-9]{0,2})?)')),
FilteringTextInputFormatter.deny(_emojiRegex),
new LengthLimitingTextInputFormatter(
18),
],
keyboardType: TextInputType.name,
decoration: InputDecoration(
hintText: 'State',
// contentPadding: EdgeInsets.all(2.0),
hintStyle: TextStyle(
color: Colors.grey,
fontSize: 15.0),
),

42 PRIVATE & CONFIDENTIAL COPYRIGHT AIRPAY PAYMENT SERVICES PVT LTD


Flutter Integration Kit

controller: state,
)),
SizedBox(
width: 10.0,
),
Expanded(
child: TextFormField(
inputFormatters: <
TextInputFormatter>[
// FilteringTextInputFormatter.allow(RegExp(r'(^[0-9]{0,7}(?:\.[0-9]{0,2})?)')),
FilteringTextInputFormatter.deny(_emojiRegex),
new LengthLimitingTextInputFormatter(
18),
],
keyboardType: TextInputType.name,
decoration: InputDecoration(
hintText: 'Country ',
// contentPadding: EdgeInsets.all(2.0),
hintStyle: TextStyle(
color: Colors.grey,
fontSize: 15.0),
),
controller: country,
),
),
],
),
SizedBox(
height: 8.0,
),
Container(
child: TextFormField(

43 PRIVATE & CONFIDENTIAL COPYRIGHT AIRPAY PAYMENT SERVICES PVT LTD


Flutter Integration Kit

inputFormatters: <TextInputFormatter>[
FilteringTextInputFormatter.deny(_emojiRegex),
FilteringTextInputFormatter
.digitsOnly,
new LengthLimitingTextInputFormatter(
8),
],
keyboardType: TextInputType.number,
decoration: InputDecoration(
hintText: 'PinCode',
// contentPadding: EdgeInsets.all(2.0),
hintStyle: TextStyle(
color: Colors.grey,
fontSize: 15.0),
),
controller: pincode,
),
),
SizedBox(
height: 15.0,
),
],
),
),
//Subscription Child
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Text(
'Subscription',
style: TextStyle(

44 PRIVATE & CONFIDENTIAL COPYRIGHT AIRPAY PAYMENT SERVICES PVT LTD


Flutter Integration Kit

color: Colors.blue[900],
fontSize: 20.0,
fontWeight: FontWeight.bold),
),
IconButton(
onPressed: () {
_showSubscription();
},
icon: isSubVisible
? Icon(Icons.arrow_drop_up)
: Icon(Icons.arrow_drop_down),
color: Colors.black,
)
],
),

Visibility(
visible: isSubVisible,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment:
CrossAxisAlignment.stretch,
children: [
Container(
child: TextFormField(
inputFormatters: <TextInputFormatter>[
FilteringTextInputFormatter.deny(_emojiRegex),
FilteringTextInputFormatter
.digitsOnly,
new LengthLimitingTextInputFormatter(
2),
],

45 PRIVATE & CONFIDENTIAL COPYRIGHT AIRPAY PAYMENT SERVICES PVT LTD


Flutter Integration Kit

keyboardType: TextInputType.number,
decoration: InputDecoration(
hintText: 'Txn Subtype',
// contentPadding: EdgeInsets.all(2.0),
hintStyle: TextStyle(
color: Colors.grey,
fontSize: 15.0),
),
controller: txn_subtype,
),
),
SizedBox(
height: 15.0,
),
Text(
'Subscription Next Run Date',
style: TextStyle(
fontSize: 18.0,
color: Colors.blue[900]),
),
SizedBox(
height: 10.0,
),
Container(
child: TextFormField(
inputFormatters: <TextInputFormatter>[
// FilteringTextInputFormatter.allow(RegExp(r'(^[0-9]{0,7}(?:\.[0-9]{0,2})?)')),
FilteringTextInputFormatter.deny(_emojiRegex),
new LengthLimitingTextInputFormatter(
254),
],
keyboardType: TextInputType.text,

46 PRIVATE & CONFIDENTIAL COPYRIGHT AIRPAY PAYMENT SERVICES PVT LTD


Flutter Integration Kit

decoration: InputDecoration(
hintText: 'Subscription Next Run Date',
// contentPadding: EdgeInsets.all(2.0),
hintStyle: TextStyle(
color: Colors.grey,
fontSize: 15.0),
),
controller: subscription_date,
onTap: () => _selectDate(context),
),
),
SizedBox(
height: 10.0,
),
Text(
'Period',
style: TextStyle(
fontSize: 18.0,
color: Colors.blue[900]),
),
SizedBox(
height: 10.0,
),
DropdownMenu<String>(
initialSelection: subscription_period.first,
onSelected: (String ? value){
setState(() {
dropdownValue = value!;
if(dropdownValue =="Day"){
dropdownValue = "D";
}else if(dropdownValue =="Week"){
dropdownValue = "W";

47 PRIVATE & CONFIDENTIAL COPYRIGHT AIRPAY PAYMENT SERVICES PVT LTD


Flutter Integration Kit

}else if(dropdownValue =="Month"){


dropdownValue = "M";
}else if(dropdownValue =="Year"){
dropdownValue = "Y";
}else if(dropdownValue =="Adhoc"){
dropdownValue = "A";
}

});
},
dropdownMenuEntries:
subscription_period.map<DropdownMenuEntry<String>>((String value) {
return DropdownMenuEntry<String>(value: value, label: value);
}).toList(),
),
SizedBox(
height: 10.0,
),
Row(
children: [
Expanded(
child: Text(
'Frequency',
style: TextStyle(
fontSize: 18.0,
color: Colors.blue[900]),
)),
SizedBox(
height: 10.0,
),
Expanded(
child: Text(

48 PRIVATE & CONFIDENTIAL COPYRIGHT AIRPAY PAYMENT SERVICES PVT LTD


Flutter Integration Kit

'Max Amount',
style: TextStyle(
fontSize: 18.0,
color: Colors.blue[900]),
),
),
],
),
Row(
children: [
Expanded(
child: TextFormField(
inputFormatters: <TextInputFormatter>[
// FilteringTextInputFormatter.allow(RegExp(r'(^[0-9]{0,7}(?:\.[0-9]{0,2})?)')),
FilteringTextInputFormatter.deny(_emojiRegex),
new LengthLimitingTextInputFormatter(
18),
],
keyboardType: TextInputType.number,
decoration: InputDecoration(
hintText: 'Frequency',
// contentPadding: EdgeInsets.all(2.0),
hintStyle: TextStyle(
color: Colors.grey,
fontSize: 15.0),
),
controller: subscription_frequency,
)),
SizedBox(
width: 10.0,
),
Expanded(

49 PRIVATE & CONFIDENTIAL COPYRIGHT AIRPAY PAYMENT SERVICES PVT LTD


Flutter Integration Kit

child: TextFormField(
inputFormatters: <
TextInputFormatter>[
FilteringTextInputFormatter.allow(RegExp(r'(^[0-9]{0,7}(?:\.[0-9]{0,2})?)')),
FilteringTextInputFormatter.deny(_emojiRegex),
new LengthLimitingTextInputFormatter(
18),
],
keyboardType: TextInputType.number,
decoration: InputDecoration(
hintText: 'Max Amount ',
// contentPadding: EdgeInsets.all(2.0),
hintStyle: TextStyle(
color: Colors.grey,
fontSize: 15.0),
),
controller: subscription_max_amount,
),
),
],
),
SizedBox(
height: 10.0,
),
Row(
children: [
Expanded(
child: Text(
'Subcription Amount',
style: TextStyle(
fontSize: 18.0,
color: Colors.blue[900]),

50 PRIVATE & CONFIDENTIAL COPYRIGHT AIRPAY PAYMENT SERVICES PVT LTD


Flutter Integration Kit

)),
SizedBox(
height: 10.0,
),
Expanded(
child: Text(
'Recurring Count',
style: TextStyle(
fontSize: 18.0,
color: Colors.blue[900]),
),
),
],
),
Row(
children: [
Expanded(
child: TextFormField(
inputFormatters: <TextInputFormatter>[
FilteringTextInputFormatter.allow(RegExp(r'(^[0-9]{0,7}(?:\.[0-9]{0,2})?)')),
FilteringTextInputFormatter.deny(_emojiRegex),
new LengthLimitingTextInputFormatter(
18),
],
keyboardType: TextInputType.number,
decoration: InputDecoration(
hintText: 'Subscription Amount',
// contentPadding: EdgeInsets.all(2.0),
hintStyle: TextStyle(
color: Colors.grey,
fontSize: 15.0),
),

51 PRIVATE & CONFIDENTIAL COPYRIGHT AIRPAY PAYMENT SERVICES PVT LTD


Flutter Integration Kit

controller: subscription_amount,
)),
SizedBox(
height: 10.0,
),
Expanded(
child: TextFormField(
inputFormatters: <
TextInputFormatter>[
new LengthLimitingTextInputFormatter(3),
// FilteringTextInputFormatter.allow(RegExp(r'(^[0-9]{0,7}(?:\.[0-9]{0,2})?)')),
FilteringTextInputFormatter.deny(_emojiRegex),
FilteringTextInputFormatter.digitsOnly,
new LengthLimitingTextInputFormatter(
18),
],
keyboardType: TextInputType.number,
decoration: InputDecoration(
hintText: 'Recurring Count',
// contentPadding: EdgeInsets.all(2.0),
hintStyle: TextStyle(
color: Colors.grey,
fontSize: 15.0),
),
controller: subscription_rec_count,
),
),
],
),
SizedBox(
height: 10.0,
),

52 PRIVATE & CONFIDENTIAL COPYRIGHT AIRPAY PAYMENT SERVICES PVT LTD


Flutter Integration Kit

Text(
'Retry Attempts:',
style: TextStyle(
fontSize: 18.0,
color: Colors.blue[900]),
),
SizedBox(
height: 10.0,
),
DropdownMenu<String>(
initialSelection: subscription_retry.first,
onSelected: (String ? value){
setState(() {
subRetryValue = value!;

if(subRetryValue == "No"){
subRetryValue = "0";
}else {
subRetryValue = "1";
}

});
},
dropdownMenuEntries:
subscription_retry.map<DropdownMenuEntry<String>>((String value) {
return DropdownMenuEntry<String>(value: value, label: value);
}).toList(),
),
SizedBox(
height: 10.0,
),

53 PRIVATE & CONFIDENTIAL COPYRIGHT AIRPAY PAYMENT SERVICES PVT LTD


Flutter Integration Kit

],
),
),

],

)),
)),
Card(
margin: EdgeInsets.all(8.0),
color: Colors.white,
child: Padding(
padding: EdgeInsets.all(8.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Text(
'Transaction Information',
style: TextStyle(
fontSize: 20.0,
color: Colors.blue[900],
fontWeight: FontWeight.bold),
),
SizedBox(
height: 15.0,
),
Row(
children: [
Expanded(
child: Text(
'Order Id *',

54 PRIVATE & CONFIDENTIAL COPYRIGHT AIRPAY PAYMENT SERVICES PVT LTD


Flutter Integration Kit

style: TextStyle(
fontSize: 18.0, color: Colors.blue[900]),
)),
SizedBox(
width: 8.0,
),
Expanded(
child: Text(
'Amount *',
style: TextStyle(
fontSize: 18.0, color: Colors.blue[900]),
),
),
],
),
Row(
children: [
Expanded(
child: TextFormField(
inputFormatters: [
new LengthLimitingTextInputFormatter(20),
FilteringTextInputFormatter.deny(_emojiRegex),
FilteringTextInputFormatter.allow(
RegExp(r'([a-zA-Z0-9])')),
],
keyboardType: TextInputType.name,
decoration: InputDecoration(
hintText: 'Order Id',
// contentPadding: EdgeInsets.all(2.0),
hintStyle: TextStyle(
color: Colors.grey, fontSize: 15.0),
),

55 PRIVATE & CONFIDENTIAL COPYRIGHT AIRPAY PAYMENT SERVICES PVT LTD


Flutter Integration Kit

controller: orderId,
)),
SizedBox(
width: 8.0,
),
Expanded(
child: TextFormField(
inputFormatters: [
FilteringTextInputFormatter.deny(_emojiRegex),
FilteringTextInputFormatter.allow(RegExp(
r'(^[0-9]{0,7}(?:\.[0-9]{0,2})?)')),
],
keyboardType: TextInputType.number,
decoration: InputDecoration(
hintText: 'Amount',
// contentPadding: EdgeInsets.all(2.0),
hintStyle: TextStyle(
color: Colors.grey, fontSize: 15.0),
),
controller: amount,
),
),
],
),
SizedBox(
height: 15.0,
),
],
),
),
),
Container(

56 PRIVATE & CONFIDENTIAL COPYRIGHT AIRPAY PAYMENT SERVICES PVT LTD


Flutter Integration Kit

margin: EdgeInsets.all(8.0),
child: ElevatedButton(
// padding: EdgeInsets.fromLTRB(2.0, 11.0, 2.0, 11.0),
onPressed: () {
ValidateFields();
},
// color: Colors.blue[900],
child: Text(
'NEXT',
style: TextStyle(color: Colors.white, fontSize: 20),
),
),
),
Container(
margin: EdgeInsets.all(8.0),
child: ElevatedButton(
// padding: EdgeInsets.fromLTRB(2.0, 11.0, 2.0, 11.0),
onPressed: () {
Navigator.pop(context);
},
// color: Colors.blue[900],
child: Text(
'BACK',
style: TextStyle(color: Colors.white, fontSize: 20),
),
),
)
],
),
),
));
}

57 PRIVATE & CONFIDENTIAL COPYRIGHT AIRPAY PAYMENT SERVICES PVT LTD


Flutter Integration Kit

58 PRIVATE & CONFIDENTIAL COPYRIGHT AIRPAY PAYMENT SERVICES PVT LTD

You might also like