首页 > 解决方案 > 如何在颤动条纹 gpay 集成中获取付款人电子邮件?

问题描述

我的代码是这样的:实际上我想获取买家的电子邮件 ID。为此我打印了查看日志。但我没有得到付款人的电子邮件 ID。

StripePayment.setOptions(StripeOptions(publishableKey: _credential, androidPayMode: 'test'));

   RaisedButton(
             child: Text("Google Pay"),
            onPressed: () {
              if (Platform.isIOS) {
              _controller.jumpTo(450);
               }
              StripePayment.paymentRequestWithNativePay(
              androidPayOptions: AndroidPayPaymentRequest(
              totalPrice: "0.40",
              currencyCode: "EUR",
              billingAddressRequired: true,
              shippingAddressRequired: true,
              ),
             applePayOptions: ApplePayPaymentOptions(
              countryCode: 'DE',
              currencyCode: 'EUR',
              items: [
                ApplePayItem(
                  label: 'Test',
                  amount: '0.1',
                )
              ],
            ),
          ).then((token) {
            setState(() {
              print(token.tokenId);
              print(token.toJson());
              tokenId = token.tokenId;
              if(tokenId!=null||tokenId!=''){
                getPayment_Api();
              }
            });
          }).catchError(setError);
        },
      ),

标签: flutterstripe-paymentspayment-gatewaygoogle-pay

解决方案


使用直接 Google Pay API,当您请求时会返回此字段emailRequired

我不熟悉您使用的 API,但我假设它是https://github.com/jonasbark/flutter_stripe_payment/。如果是这样,它看起来不像公开emailRequired属性:https ://github.com/jonasbark/flutter_stripe_payment/blob/master/lib/src/android_pay_payment_request.dart


推荐阅读