digetpay_plugin 0.3.0
digetpay_plugin: ^0.3.0 copied to clipboard
Pure-Dart DigetPay payment plugin: hosted (PCI-safe) checkout via WebView plus transaction management over the DigetPay REST API.
example/lib/main.dart
import 'package:digetpay_plugin/digetpay_plugin.dart';
import 'package:flutter/material.dart';
import 'log_console.dart';
import 'pages/home_page.dart';
/// Your DigetPay **publishable / restricted mobile** API key.
///
/// Use a client-scoped key here — never a server secret (anything shipped in an
/// app can be extracted). Prefer passing it at build time, e.g.
/// `flutter run --dart-define=DIGETPAY_API_KEY=...`.
const String _apiKey = String.fromEnvironment(
'DIGETPAY_API_KEY',
defaultValue: '<your-api-key>',
);
void main() {
// Initialize the SDK once at startup.
DigetPaySdk.initialize(
apiKey: _apiKey,
baseUrl: kDigetPayDefaultBaseUrl,
logger: digetPayLog, // remove in production, or gate behind kDebugMode
);
runApp(const DigetPayExampleApp());
}
/// The DigetPay integration-guide example app.
class DigetPayExampleApp extends StatelessWidget {
/// Creates the example app.
const DigetPayExampleApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'DigetPay Example',
theme: ThemeData(colorSchemeSeed: Colors.indigo, useMaterial3: true),
home: HomePage(apiKeyConfigured: _apiKey != '<your-api-key>'),
);
}
}