Skip to content

Flutter — platform notes

pdirect_pay declares Android and iOS plugins only. Web, macOS, Linux, and Windows are unsupported — neither in the pubspec.yaml nor at runtime. If your Flutter app targets one of those, use the HTTP API directly.

minSdkVersion 21 (Android 5.0 Lollipop). Set this in android/app/build.gradle:

android {
defaultConfig {
minSdkVersion 21
targetSdkVersion 34
}
}

Required:

<uses-permission android:name="android.permission.INTERNET" />

The SDK computes the device fingerprint from ANDROID_ID and Build.FINGERPRINT — neither requires runtime permissions.

Only if you’ll surface paymentMethod: 'google_pay':

<application>
<meta-data
android:name="com.google.android.gms.wallet.api.enabled"
android:value="true" />
</application>

Set the merchant IDs on PdirectPayConfig.googlePayMerchantId and googlePayGatewayMerchantId.

The card payment flow loads Mastercard’s hosted session in an embedded WebView. This is provided by the webview_flutter transitive dependency — no extra config needed.

If your app crashes immediately after PdirectPay.init, the likeliest cause is a missing kotlin runtime. Add to your top-level build.gradle:

buildscript {
ext.kotlin_version = '1.9.0'
// ...
}

platform :ios, '12.0' in ios/Podfile.

Only if you’ll surface paymentMethod: 'apple_pay':

  1. Enable the Apple Pay capability on your target in Xcode.
  2. Add a merchant ID under Signing & Capabilities → Apple Pay.
  3. Set PdirectPayConfig.applePayMerchantId to the same identifier.

No keys are required for the gateway flow. The SDK uses standard URLSession and the gateway only serves over HTTPS, so no ATS exception is needed.

Terminal window
cd ios
pod install --repo-update

If pod install complains about deployment-target mismatches with your existing pods, raise IPHONEOS_DEPLOYMENT_TARGET in the Podfile post-install hook.

PdirectPayConfig.pinnedSpkiSha256 returns a list of pinned SPKI SHA-256 hashes. Currently empty in production — pinning is on the roadmap but not yet enforced.

PdirectPaymentBody.mastercardPaymentMethod accepts 'HOSTED_SESSION' or 'DIRECT_CAPTURE'. Only HOSTED_SESSION is implemented — passing 'DIRECT_CAPTURE' falls back to the standard submit endpoint with a logged warning. Track the Flutter changelog for when this lands.

Configuration fields exist on PdirectPayConfig and the pay: ^2.0.0 dependency is included, but the public SDK does not yet expose a top-level method to invoke a native-pay charge. The pay package gives you the button and the token — you then pass the token to PdirectPaymentBody.nativePayToken on /payments/collect.

This will be tightened up in a future release with a single PdirectPayCheckout.nativePayMode flag.

Not supported. The plugin’s pubspec.yaml does not declare a web, macos, linux, or windows block, and there’s no platform-specific implementation in the source tree.

If you target Flutter Web, you have two options:

  1. Build that part of your product as a separate Angular app and use @mms/pdirect-pay.
  2. Talk to the HTTP API directly via package:http or package:dio. The gateway’s CORS policy allows browser origins.