tap_google_pay_kit_flutter 1.0.6 copy "tap_google_pay_kit_flutter: ^1.0.6" to clipboard
tap_google_pay_kit_flutter: ^1.0.6 copied to clipboard

Flutter plugin compatible version of TapGooglePayKit library for Android only.

example/lib/main.dart

import 'dart:async';

import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:tap_google_pay_kit_flutter/models/model.dart';
import 'package:tap_google_pay_kit_flutter/tap_google_pay_kit_flutter.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  var mSDKResponse;

  // App configuration to use TapGooglePayKitFlutter
  Future<void> configureApp() async {
    TapGooglePayKitFlutter.configureSDK(
      secretKey: "sk_test_xxxxxxxxxxxxxxxxxx",
      bundleId: "com.xxx.xxxxxxx",
      countryCode: "US",
      transactionCurrency: "USD",
      sdkMode: SDKMode.Sandbox,
      allowedMethods: AllowedMethods.ALL,
      allowedCardNetworks: [AllowedCardNetworks.VISA.name],
      gatewayID: "xxxxx",
      gatewayMerchantID: "122xxxxx",
      amount: "23",
    );
  }

  // Start SDK and Call the methods from TapGooglePayKitFlutter

  Future<void> startSDK() async {
    try {
      configureApp();
      var tapGooglePaySDKResult =
          await TapGooglePayKitFlutter.getGooglePayToken;

      setState(() {
        mSDKResponse = tapGooglePaySDKResult;
      });
    } catch (ex) {
      if (kDebugMode) {
        print("Exception >>>> ${ex.toString()}");
      }
    }
  }

  // Build Widget
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: Padding(
            padding: const EdgeInsets.all(8.0),
            child: Text(
              mSDKResponse == null
                  ? ""
                  : "SDK RESPONSE : ${mSDKResponse.toString()}",
            ),
          ),
        ),
        bottomSheet: TapGooglePayKitFlutter.googlePayButton(
          googlePayButtonType: GooglePayButtonType.NORMAL_GOOGLE_PAY,
          onTap: () {
            startSDK();
          },
        ),
      ),
    );
  }
}
3
likes
150
points
205
downloads

Publisher

unverified uploader

Weekly Downloads

Flutter plugin compatible version of TapGooglePayKit library for Android only.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on tap_google_pay_kit_flutter

Packages that implement tap_google_pay_kit_flutter