flutter_adyen_dropin_plugin

Note: This library is not official from Adyen.

Flutter plugin to integrate with the Android and iOS libraries of Adyen. This library enables you to open the Drop-in method of Adyen with just calling one function.

The Plugin supports 3dSecure v2 and one time payment. It was not tested in a recurring payment scenario.

Prerequisites

Credentials

You need to have the following information:

  • clientKey (from Adyen)
  • amount & currency
  • sessionData (e.g userId)
  • Adyen Environment (TEST, LIVE_EUROPE etc..)
  • countryCode (de-DE, en-US etc..)
  • session info (all response after request /sessions) use for Android
  • sessionData (after request /sessions you can get it)

Setup

Android

In the MainActivity.java in your application extend FlutterFragmentActivity and add these line to onCreate, this allows adyen to get the Activity of your app.

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    AdyenSetup.setActivity(this);
    AdyenSetup.setLauncherActivity(this);
}

Build Gradle

You need to set minSdkVersion and targetSdkVersion, compileSdkVersion (required by latest Adyen)

android {
    ...
    compileSdkVersion 34

    defaultConfig {
        ...
        minSdkVersion 24
        targetSdkVersion 34
    }
}

iOS

You need to add a URL_SCHEME if you do not have one yet.

Here is how to add one.

Target

You need to change your app target to iOS 13 or higher (required by latest Adyen)

Flutter Implementation

To start a Payment you need to call the plugin like so:

String dropInStatus = '';
try {
    dropInStatus = await FlutterAdyenDropIn.openDropIn(
    sessionData: "<YOUR-SESSION-DATA>",
    clientKey: "<YOUR-CLIENT-KEY>",
    currency: "USD",
    value: 1000,
    sessionId: "<YOUR-SESSION-ID>",
    countryCode: "en-US",
    sessionInfo: {"FIELD": "<YOUR-SESSION-INFO>"},
    );
} catch (e) {
    print(e);
}

Payment Status

All the status of the payment you can receive. Check here for more detail

PAYMENT_CANCELED (when you close the pop up)
Authorised
Cancelled
Error
Refused