adyen_flutter_dropin 1.1.1 copy "adyen_flutter_dropin: ^1.1.1" to clipboard
adyen_flutter_dropin: ^1.1.1 copied to clipboard

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

example/lib/main.dart

import 'dart:convert';
import 'dart:developer';

import 'package:adyen_flutter_dropin/adyen_flutter_dropin.dart';
import 'package:adyen_flutter_dropin/enums/adyen_response.dart';
import 'package:adyen_flutter_dropin/exceptions/adyen_exception.dart';
import 'package:flutter/material.dart';

import 'mock_data.dart';

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

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

class _MyAppState extends State<MyApp> {
  String? paymentResult;

  AdyenResponse? dropInResponse;

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        floatingActionButton: FloatingActionButton(
          child: Icon(Icons.add),
          onPressed: () async {
            try {
              dropInResponse = await FlutterAdyen.openDropIn(
                  paymentMethods: jsonEncode(examplePaymentMethods),
                  baseUrl: '$baseUrl/',
                  clientKey: clientKey,
                  locale: locale,
                  shopperReference: '',
                  returnUrl: 'adyendropin://',
                  amount: '100',
                  lineItem: {},
                  currency: currency,
                  additionalData: {},
                  headers: headers);
              setState(() {
                paymentResult = dropInResponse?.name;
              });
            } on AdyenException catch (e) {
              setState(() {
                paymentResult = e.error.name;
              });
            } catch (e) {
              log(e.toString());
            }
          },
        ),
        appBar: AppBar(
          title: const Text('Flutter Adyen'),
        ),
        body: Center(
          child: Text('Payment Result: $paymentResult\n'),
        ),
      ),
    );
  }
}
1
likes
160
pub points
40%
popularity

Publisher

verified publisherbastianschmalbach.dev

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

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on adyen_flutter_dropin