Skip to content

Flutter — installation

The Flutter SDK ships as pdirect_pay on pub.dev.

Dart SDK^3.8.1
Flutter>=3.3.0
AndroidminSdkVersion 21
iOS12.0+

Web, macOS, Linux, and Windows are not supported. The package’s pubspec.yaml only declares Android and iOS plugin classes.

Terminal window
flutter pub add pdirect_pay

Or add manually to pubspec.yaml:

dependencies:
pdirect_pay: ^3.0.0

Pin to a major version (^3.0.0) and let minors and patches roll forward. See Versioning for the policy.

Run:

Terminal window
flutter pub get
flutter pub deps | grep pdirect_pay

You 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).

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:

Terminal window
cd ios
pod install

Apple 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).

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.

  1. Configure the SDK for your environment.
  2. Read the quickstart to wire up an end-to-end checkout.
  3. Skim the API reference for everything beyond the drop-in widget.
  4. Read platform notes for any Android- or iOS-specific gotchas.