adyen_dropin 0.10.0 copy "adyen_dropin: ^0.10.0" to clipboard
adyen_dropin: ^0.10.0 copied to clipboard

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

example/lib/main.dart

import 'dart:convert';

import 'package:adyen_dropin/flutter_adyen.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 {
              dropInResponse = await FlutterAdyen.openDropIn(
                  paymentMethods: jsonEncode(examplePaymentMethods),
                  baseUrl: 'https://yourdomain.com',
                  clientKey: 'clientkey',
                  publicKey: 'publickey',
                  locale: 'de_DE',
                  shopperReference: 'asdasda',
                  returnUrl: 'http://asd.de',
                  amount: '1230',
                  lineItem: {'id': '1', 'description': 'adyen test'},
                  currency: 'EUR',
                  additionalData: {});
            } 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'),
        ),
      ),
    );
  }
}
13
likes
140
points
19
downloads

Publisher

verified publisherintive.com

Weekly Downloads

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

Homepage

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on adyen_dropin

Packages that implement adyen_dropin