standard_checkout_kit 1.0.1 standard_checkout_kit: ^1.0.1 copied to clipboard
The Paymentz Standard Checkout Kit Flutter plugin allows you to integrate Payment Gateway of Paymentz into your application. This plugin has been designed to minimise the complexity of handling and in [...]
standard_checkout_kit #
Flutter plugin for Paymentz Standard Checkout SDK.
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. To know more about our SDKs and how to link them within the projects, refer to the following documentation:
Android: https://docs.paymentz.com/integration/android-integration.php
iOS: https://docs.paymentz.com/integration/ios-integration.php
Flutter : https://docs.paymentz.com/integration/flutter-integration.php
Installation #
This plugin is available on Pub: https://pub.dev/packages/standard_checkout_kit
Add this to dependencies
in your app's pubspec.yaml
standard_checkout_kit: ^1.0.1
Note for Android: Make sure that the minimum API level for your app is 19 or higher.
Note for iOS: Make sure that the minimum deployment target for your app is iOS 10.0 or higher. Also, don't forget to enable bitcode for your project.
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:standard_checkout_kit/checkout_plugin.dart';
Create CheckoutPLugin instance
_pz_checkout = CheckoutPlugin();
Attach event listeners
The plugin uses event-based communication, and emits events when payment fails or succeeds.
The event names are exposed via the constants EVENT_SUCCESS
and EVENT_FAILED
from the CheckoutPlugin
class.
Use the on(String event, Function handler)
method on the CheckoutKit
instance to attach event listeners.
_pz_checkout.on(eventSuccess, _handlePaymentSuccess);
_pz_checkout.on(eventFailed, _handlePaymentFail);
The handlers would be defined somewhere as
void _handlePaymentSuccess(PaymentResponse response) {
// Do something when payment succeeds
}
void _handlePaymentFail(PaymentResponse response) {
// Do something when payment fails
}
To clear event listeners, use the clear
method on the CheckoutPlugin
instance.
_pz_checkout.clear(); // Removes all listeners
Setup options
Map<String, String> 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"
};
String secureKey = "<YOUR_SECRET_KEY>";
Open Checkout
_pz_checkout.payment(options, secureKey);
Troubleshooting #
Enabling Bitcode #
Open ios/Podfile
and find this section:
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['ENABLE_BITCODE'] = 'NO'
end
end
end
Set config.build_settings['ENABLE_BITCODE'] = 'YES'
.
Setting Swift version #
Add the following line below config.build_settings['ENABLE_BITCODE'] = 'YES'
:
config.build_settings['SWIFT_VERSION'] = '5.0'
CocoaPods could not find compatible versions for pod "standard_checkout_kit"
when running pod install
#
Specs satisfying the `standard_checkout_kit (from
`.symlinks/plugins/standard_checkout_kit/ios`)` dependency were found, but they
required a higher minimum deployment target.
This is due to your minimum deployment target being less than iOS 10.0. To change this, open ios/Podfile
in your project and add/uncomment this line at the top:
# platform :ios, '9.0'
and change it to
platform :ios, '10.0'
and run pod install
again in the ios
directory.
iOS build fails with 'standard_checkout_kit/standard_checkout_kit-Swift.h' file not found
#
Add use_frameworks! in ios/Podfile
and run pod install
again in the ios
directory.
Gradle build fails with Error: uses-sdk:minSdkVersion 16 cannot be smaller than version 19 declared in library [:standard_checkout_kit]
#
This is due to your Android minimum SDK version being less than 19. To change this, open android/app/build.gradle
, find minSdkVersion
in defaultConfig
and set it to at least 19
.
A lot of errors saying xxxx is not defined for the class 'CheckoutPlugin'
#
We export a class CheckoutPlugin
from package:standard_checkout_kit/standard_checkout_kit.dart
. Check if your code is redeclaring the CheckoutPlugin
class.
API #
Paymentz Standard Checkout Kit #
payment(map<String, String> options, String secureKey)
Open Paymentz Standard Checkout Kit.
The options
map has key
as a required property. All other properties are optional.
For a complete list of options, please see the Checkout documentation.
clear()
Clear all event listeners.