问题描述
我的代码是这样的: 实际上我想获取买家的电子邮件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);
},
解决方法
使用直接的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