Paymentgateway Plugin Flutter

Flutter plugin for Paymentgateway SDK.

NOTE

Android Payment Gateway integration is still under development. This plugin will work for iOS for now.

pub package

Getting Started

This flutter plugin is a wrapper around our Android and iOS SDKs.

The following documentation is only focused on the wrapper around our native Android and iOS SDKs.

Prerequisites

Development Tools:

  • Xcode 14 and above
  • Flutter 3.3.0 & Dart 3.4.4 and above

Installation

This plugin is available on Pub: https://pub.dev/packages/payment_gateway_plugin

Add this to dependencies in your app's pubspec.yaml

payment_gateway_plugin: ^1.0.0

Note for Android: Make sure that the minimum API level for your app is 19 or higher.

In android project add this dependencies in build.gradle file

dependencies {
    .
    .
    .
    // This is one of the dependency
    implementation 'androidx.appcompat:appcompat:1.3.1'
}

Note for iOS: Make sure that the minimum deployment target for your app is iOS 10.0 or higher. Also, This is not support SIMULATOR you can run onlly in real iPhone devices.

Run flutter packages get in the root directory of your app.

Usage

Sample code to integrate can be found in example/lib/main.dart.

Import package

import 'package:payment_gateway_plugin/payment_gateway_plugin.dart';

Create Paymentgateway instance

PaymentGatewayPlugin.open(
          '<PAYMENT_URL>', request)

Passing Payment params and URL

// For payment parammeters to refer 
// https://pgandroidintegrations.docs.stoplight.io/request-param-list

var params = {
'api_key': '<API_KEY>',
'hash': '<HASH_KEY>',
'order_id': 'TEST4000',
'mode': 'LIVE',
'description': 'Test',
'currency': 'INR',
'amount': '2',
'name': 'Senthil',
'email': 'emailsenthil@test.com',
'phone': '9597403366',
'city': 'Chennai',
'state': 'Tamilnadu',
'country': 'IND',
'zip_code': '630501',
'address_line_1': 'ad1',
'address_line_2': 'ad2',
'return_url': 'http://localhost:8888/paymentresponse'};

PaymentGatewayPlugin.open(
          '<PAYMENT_URL>', params)

Accessing response


response = await PaymentGatewayPlugin.open(
          '<PAYMENT_API_URL>', request);
      var r=jsonDecode(response);
      print(r['status']);
      print(r['payment_response']);
    

List of Request Parameters

Request parameters are the parameters that will be send to our server API for payment initiation. Client should store the order id and the amount before payment initiation and compare it with the order id and amount in the response Json from our server post payment process to ensure no end user tampering on the requested parameters.

Please use this link for all params reference link

For UPI Payments Applications

Add the below given code to your info.plist

<dict>
    ...
    <key>LSApplicationQueriesSchemes</key>
	<array>
		<string>upi</string>
		<string>cred</string>
		<string>gpay</string>
		<string>phonepe</string>
		<string>paytmmp</string>
		<string>mobikwik</string>
		<string>com.amazon.mobile.shopping</string>
		<string>bharatpe</string>
		<string>freecharge</string>
        ...
	</array>
    ...
</dict>

List of Response Codes

Note

Below are the response codes that comes in the payment response post payment from our server, that must be handled by the client.

Please use this link for reference link

HASH Calculation

Please use this link for reference link