flutter_apple_pay 0.1.2+1 copy "flutter_apple_pay: ^0.1.2+1" to clipboard
flutter_apple_pay: ^0.1.2+1 copied to clipboard

outdated

Porting of Apple Pay (a mobile payment and digital wallet service by Apple Inc) to Flutter.

example/lib/main.dart

import 'dart:async';

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

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

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

class _MyAppState extends State<MyApp> {
  @override
  void initState() {
    super.initState();
  }

  Future<void> makePayment() async {
    dynamic platformVersion;
    PaymentItem paymentItems = PaymentItem(label: 'Label', amount: 51.0);
    try {
      platformVersion = await FlutterApplePay.makePayment(
        countryCode: "US",
        currencyCode: "USD",
        paymentNetworks: [PaymentNetwork.visa, PaymentNetwork.mastercard],
        merchantIdentifier: "merchant.stripeApplePayTest",
        paymentItems: [paymentItems],
      );
      print(platformVersion);
    } on PlatformException {
      platformVersion = 'Failed to get platform version.';
    }
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Apple Pay Test'),
        ),
        body: Center(
          child:
          Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
                Text('Waiting for Apple Pay modal.'),
                RaisedButton(
                  child: Text('Call payment'),
                  onPressed: () => makePayment(),
                )
            ],
          )
        ),
      ),
    );
  }
}
13
likes
0
pub points
13%
popularity

Publisher

unverified uploader

Porting of Apple Pay (a mobile payment and digital wallet service by Apple Inc) to Flutter.

Homepage

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on flutter_apple_pay