Last updated:
0 purchases
payment gateway plugin
Paymentgateway Plugin Flutter #
Flutter plugin for Paymentgateway SDK.
Getting Started
Prerequisites
Installation
Usage
Example App
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: ^2.0.2
copied to clipboard
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'
}
copied to clipboard
Note for iOS: Make sure that the minimum deployment target for your app is iOS 13.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';
copied to clipboard
Create Paymentgateway instance
PaymentGatewayPlugin.open(
'<PAYMENT_URL>', request)
copied to clipboard
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': '[email protected]',
'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)
copied to clipboard
Accessing response
response = await PaymentGatewayPlugin.open(
'<PAYMENT_API_URL>', request);
var r=jsonDecode(response);
print(r['status']);
print(r['payment_response']);
copied to clipboard
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>
copied to clipboard
For Android SDK to Work
Add this code snippet to #
<project_root>/android/settings.gradle
...
include ":app"
include ":payment_gateway_plugin"
...
copied to clipboard
<project_root>/android/app/build.gradle
...
dependencies {
implementation 'androidx.appcompat:appcompat:1.6.0'
// Other dependencies
...
}
...
copied to clipboard
Make Sure that you have these codes at the respected locations #
<project_root>/android/app/src/main/res/values/colors.xml
<resources>
...
<color name="colorPrimary">#FF6200EE</color>
<color name="colorPrimaryDark">#FF3700B3</color>
<color name="colorAccent">#FF03DAC5</color>
...
</resources>
copied to clipboard
<project_root>/android/app/src/main/res/values/styles.xml
<resources>
...
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
...
</resources>
copied to clipboard
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
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.