Flutter — installation
The Flutter SDK ships as pdirect_pay on
pub.dev.
Requirements
Section titled “Requirements”| Dart SDK | ^3.8.1 |
| Flutter | >=3.3.0 |
| Android | minSdkVersion 21 |
| iOS | 12.0+ |
Web, macOS, Linux, and Windows are not supported. The package’s
pubspec.yaml only declares Android and iOS plugin classes.
Add the dependency
Section titled “Add the dependency”flutter pub add pdirect_payOr add manually to pubspec.yaml:
dependencies: pdirect_pay: ^3.0.0Pin to a major version (^3.0.0) and let minors and patches roll
forward. See Versioning for the policy.
Verify the install
Section titled “Verify the install”Run:
flutter pub getflutter pub deps | grep pdirect_payYou should see pdirect_pay 3.0.0 (or newer minor) plus its
transitive deps (dio, rxdart, flutter_secure_storage,
device_info_plus, webview_flutter, pay, crypto, uuid,
intl, pdf, printing, flutter_svg).
Platform setup
Section titled “Platform setup”Android
Section titled “Android”The plugin auto-registers via Flutter’s plugin system. The native
class is com.mms.pdirect_pay.PdirectPayPlugin.
Required permissions in android/app/src/main/AndroidManifest.xml:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> <uses-permission android:name="android.permission.INTERNET" /> <!-- ... your application tag ... --></manifest>Google Pay (optional — only if you’ll surface the
payment_method: google_pay flow):
<application> <meta-data android:name="com.google.android.gms.wallet.api.enabled" android:value="true" /></application>The plugin auto-registers via CocoaPods. Run:
cd iospod installApple Pay (optional — only if you’ll surface
payment_method: apple_pay): in Xcode, enable the Apple Pay
capability on your target. Add your merchant ID under
Signing & Capabilities → Apple Pay.
No Info.plist keys are required for the gateway flow itself. The
SDK uses the standard URLSession for networking; no special
ATS exceptions are needed (the gateway only serves over HTTPS).
Verify it imports
Section titled “Verify it imports”import 'package:flutter/material.dart';import 'package:pdirect_pay/pdirect_pay.dart';
void main() { PdirectPay.init(const PdirectPayConfig( environment: PdirectPayEnvironment.sandbox, defaultLocale: 'en', )); runApp(const MyApp());}
class MyApp extends StatelessWidget { const MyApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp(home: Scaffold( body: Center(child: Text('Pdirect SDK ready: ${PdirectPay.isInitialized}')), )); }}flutter run should print Pdirect SDK ready: true once the app
launches.
Next steps
Section titled “Next steps”- Configure the SDK for your environment.
- Read the quickstart to wire up an end-to-end checkout.
- Skim the API reference for everything beyond the drop-in widget.
- Read platform notes for any Android- or iOS-specific gotchas.