我想在我的 Flutter 应用中将 Google Pay 与 Stripe 连接

Dip*_*iya 6 payment dart stripe-payments flutter google-pay

我想在我的应用程序中使用Google Pay,并且想在 Stripe 仪表板中获取资金。

我尝试了 Flutter 付费套餐,现在我可以看到 Google 付费表了。

我是印度公民,因此无法在印度测试 Google Pay Global,那么如何测试我的应用?而且我不知道付款成功后Google Pay如何反应。

请附上一些文档或一些示例,以将 Google Pay 与 Flutter 中的 Stripe 集成。

我使用这个包: https: //pub.dev/packages/pay

这是我打开 Google Pay 表的代码:

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),
          ),
          onError: (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,
    )
  ];
Run Code Online (Sandbox Code Playgroud)

小智 2

检查这个:支付插件支持

这是 Stripe 包,它完全支持 Pay 插件。