flutter_flexible_pay 0.0.1 copy "flutter_flexible_pay: ^0.0.1" to clipboard
flutter_flexible_pay: ^0.0.1 copied to clipboard

outdated

Provides you the ability to make payments on flutter using any of Google approved merchants via Google Pay. Available for both IOS & Android.

flutter_flexible_pay #

pub

Make payments via Google approved merchants across the globe. Supports IOS & Android Payment Request API.

Usage #

AndroidManifest #

<meta-data
    android:name="com.google.android.gms.wallet.api.enabled"
    android:value="true" />

Load the payment configurations like so; #


  import 'package:flutter_flexible_pay/flutter_flexible_pay.dart';

  /// This example file was used to implement stripe payment
  /// For other payment, remove "stripe:*" key occurrences and replace with "gatewayMerchantId"
  /// See project example to see the contents of payment_profile_google_pay.json
  /// *IOS support will be added soonest*
  Future<void> loadConfiguration() async {
    final String response =
    await rootBundle.loadString('assets/configurations/payment_profile_google_pay.json');
    final data = await json.decode(response);
    // Set the payment profile and configurations
    FlutterFlexiblePay.setPaymentConfig(data);
  }

  @override
  void initState() {
    super.initState();
    loadConfiguration();
  }

Make Payments like so; #

  
  _makePayment(dynamic product) async {
      var environment = 'test'; // or 'production'
      if (!(await FlutterFlexiblePay.isAvailable(environment))) {
        _showToast(scaffoldContext, "Google Pay Not Available!");
      } else {
  
        PaymentItem product = PaymentItem(
            countryCode: "US",
            currencyCode: "USD",
            amount: product["amount"], // string
            label: product["name"], // the product name or label
        );
  
        FlutterFlexiblePay.makePayment(product).then((Result result) {
          if (result.status == ResultStatus.success) {
            _showToast(scaffoldContext, 'Success');
          }
        }).catchError((dynamic error) {
          _showToast(scaffoldContext, error.toString());
        });
      }
    }
  

Doc for creating custom payment data: #

This goes into your .json file Google Pay

1
likes
0
pub points
20%
popularity

Publisher

unverified uploader

Provides you the ability to make payments on flutter using any of Google approved merchants via Google Pay. Available for both IOS & Android.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on flutter_flexible_pay