zolozkit_for_flutter 1.1.5 zolozkit_for_flutter: ^1.1.5 copied to clipboard
The plugin for inject to zoloz sdk
zolozkit_for_flutter #
The plugin for inject to zoloz sdk
Getting Started #
Depend on it #
Run this command:
With Flutter:
flutter pub add zolozkit_for_flutter
This will add a line like this to your package's pubspec.yaml (and run an implicit dart pub get
):
dependencies:
zolozkit_for_flutter: ^1.1.3
With iOS project support, you need to configure the private spec in ios/Podfile
:
source 'https://github.com/zoloz-pte-ltd/zoloz-demo-ios'
Import it #
Now in your Dart code, you can use:
import 'package:zolozkit_for_flutter/zolozkit_for_flutter.dart';
Get Meta Info #
Use the ZolozkitForFlutter class and its variable metaInfo to get the meta information about the ZOLOZ SDK and the user's device. The meta information is used to initialize a transaction later.
var metaInfo = await ZolozkitForFlutter.metaInfo;
Initialize a transaction #
Send a request that contains the meta information to your (merchant) server to initialize a transaction. Then your (merchant) server needs to call the initialize API to obtain the client configuration and return it to your (merchant) application. see: Server-side integration
Start the transaction flow #
start the transaction flow by calling the start method with the clientCfg
and bizCfg
, You also need to override the callback functions to handle the transaction result.
await ZolozkitForFlutter.start(
"clientCfg",
{},
(String retCode, Map<Object?, Object?>? extInfo) {
print("onInterrupted:$retCode, $extInfo");
},
(String retCode, Map<Object?, Object?>? extInfo) {
print("onCompleted:$retCode, $extInfo");
},
);