adyen_drop_in_plugin 0.0.4+28 copy "adyen_drop_in_plugin: ^0.0.4+28" to clipboard
adyen_drop_in_plugin: ^0.0.4+28 copied to clipboard

Flutter plugin to integrate Adyen DropIn UI for Android and iOS.

example/lib/main.dart

import 'dart:convert';
import 'dart:io';

import 'package:adyen_drop_in_plugin/adyen_drop_in_plugin.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

import 'mock_data.dart';

void main() => runApp(MyApp());

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  String? _payment_result = 'Unknown';

  String? dropInResponse;

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        floatingActionButton: FloatingActionButton(
          child: Icon(Icons.add),
          onPressed: () async {
            try {
              final List<Map<String, String>> items = [];
              items.add({'id': '1', 'quantity': '1', 'description': 'ABC'});

              dropInResponse = await AdyenDropInPlugin.openDropIn(
                  paymentMethods: jsonEncode(examplePaymentMethods2),
                  baseUrl: 'https://f1d234e5783a85cd-Venchi-checkout-live.adyenpayments.com/checkout/v69/',
                  clientKey: 'live_25TYODACSVHW7JLKJ5FREHSE74P6GDKM',
                  accessToken: 'LSv5pFnLN4Wux3lR0r5Azy2e0Rd7aHVzD6tM4uXORz',
                  publicKey:
                  'AQEohmfxK4vJaBBCw0m/n3Q5qf3Vfo5DDptDCqtk0lCY6hEQzvnXBQFHsBDBXVsNvuR83LVYjEgiTGAH-ZrgOm8DKCodiAKIpW3joQzWSpNyp6+wdK2ePmr7ggxI=-Ce@RxxeB@>q34{SR',
                  locale: 'HK',
                  shopperReference: 'asdasda',
                  returnUrl: 'appscheme://payment',
                  amount: '1500',
                  lineItem: items,
                  currency: 'HKD',
                  merchantAccount: 'Venchi_HK_app',
                  reference:
                  '${Platform.isIOS ? 'ios' : 'android'}-components_${DateTime.now().millisecondsSinceEpoch}',
                  threeDS2RequestData: {
                    "deviceChannel": "app",
                    "challengeIndicator": "requestChallenge"
                  },
                  additionalData: {"allow3DS2": "true", "executeThreeD": "false"},
                  storePaymentMethod: true,
                  appleMerchantID: 'merchant.hk.com.venchi.crm',
                  environment: "EUROPE"
              );
            } on PlatformException catch (e) {
              if (e.code == 'PAYMENT_CANCELLED')
                dropInResponse = 'Payment Cancelled';
              else
                dropInResponse = 'Payment Error';
            }

            setState(() {
              _payment_result = dropInResponse;
            });
          },
        ),
        appBar: AppBar(
          title: const Text('Flutter Adyen'),
        ),
        body: Center(
          child: Text('Payment Result: $_payment_result\n'),
        ),
      ),
    );
  }
}
1
likes
0
points
34
downloads

Publisher

unverified uploader

Weekly Downloads

Flutter plugin to integrate Adyen DropIn UI for Android and iOS.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on adyen_drop_in_plugin

Packages that implement adyen_drop_in_plugin