Home > front end >  I want to connect google pay with stripe in my flutter app
I want to connect google pay with stripe in my flutter app

Time:12-31

I want to use google pay in my app and I want to get my money in stripe dashboard

I try flutter pay package now I am able to see google pay sheet

I am indian citizen so I am not able to test google pay global in India so how can I test my app? and I don't know how google pay response when payment is success

please attach some documentation or some example to integrate google pay with stripe in flutter

I use this package:- https://pub.dev/packages/pay

Here is my code for open google pay sheet:-

import 'package:pay/pay.dart' as pay;

Widget _paymentOptions() {
    return Row(
      mainAxisAlignment: MainAxisAlignment.center,
      children: [
        pay.GooglePayButton(
          paymentConfigurationAsset: PaymentJson.googlePay,
          paymentItems: _paymentItems,
          width: 300,
          style: pay.GooglePayButtonStyle.black,
          type: pay.GooglePayButtonType.pay,
          margin: const EdgeInsets.only(top: 15.0),
          onPaymentResult: (val) {
            log(val.toString(), name: "Google Pay");
          },
          loadingIndicator: const Center(
            child: CircularProgressIndicator(),
          ),
        ),
        pay.ApplePayButton(
          paymentConfigurationAsset: PaymentJson.applePay,
          paymentItems: _paymentItems,
          width: 300,
          style: pay.ApplePayButtonStyle.black,
          type: pay.ApplePayButtonType.buy,
          margin: const EdgeInsets.only(top: 15.0),
          onPaymentResult: (val) {
            log(val.toString(), name: "Apple Pay");
          },
          childOnError: const Text(
            "Apple pay Not Available Now",
            style: TextStyle(
                color: Colors.black, fontSize: 16, fontWeight: FontWeight.bold),
          ),
          one rror: (e) {
            print(e);
            showAppSnackBar("Google pay Not Available Now");
          },
          loadingIndicator: const Center(
            child: CircularProgressIndicator(),
          ),
        ),
      ],
    );
  }


  final _paymentItems = [
    pay.PaymentItem(
      label: 'Total',
      amount: '99.99',
      status: pay.PaymentItemStatus.final_price,
    )
  ];

CodePudding user response:

have you checked this https://pub.dev/packages/flutter_stripe#pay-plugin-support

It's the stripe package and it fully supports the Pay plugin

CodePudding user response:

You can test Google Pay using test cards by following the instructions outlined at: https://developers.google.com/pay/api/android/guides/resources/test-card-suite or https://github.com/google-pay/google-pay-button/discussions/70

It involves joining the googlepay-test-mode-stub-data Google group and using the integration in TEST mode (i.e. environment set to TEST)

  • Related