paygilant_plugin 4.2.11
paygilant_plugin: ^4.2.11 copied to clipboard
Paygilant Plugin exposes a dart interface, which wraps the native SDK, and enables a smooth integration with the Flutter development environment.
example/example.md
paygilant_plugin example #
import 'package:paygilant_plugin/paygilant_plugin.dart';
Future<void> startPaygilant() async {
// 1. Initialize once at app start with the server URL Paygilant gave you.
try {
await PaygilantPlugin.init('https://YOUR_PAYGILANT_SERVER_URL', toAskPermissions: true);
} catch (e) {
final message = e.toString();
final policyNotApproved = message.contains('SET_APPROVE_POLICY_TO_TRUE') ||
message.contains('setApprovePolicy method to true'); // Android / iOS
if (!policyNotApproved) {
// A real failure (for example no connection to the server): handle it in your app.
return;
}
// 2. The privacy policy was not accepted yet, so nothing was sent. Show your own policy UI and, once the
// user accepts, approve it. The session starts then; there is no need to call init again.
final accepted = await showYourPrivacyPolicyDialog(); // your own UI
if (!accepted) return;
await PaygilantPlugin.setApprovePolicy(true);
}
// 3. Session ID for your backend calls.
final sessionId = await PaygilantPlugin.getSessionId;
}
On iOS, add the Access WiFi Information capability and declare the permissions you ask for in Info.plist.