flutter - 如何在颤动条纹 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);
},
),
解决方案
使用直接 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
推荐阅读
- javascript - 如何从角度的对象数组中进行选择?
- python - 在 SQLAlchemy 中将 CTE 与多个引擎一起使用时出现 UnboundExecutionError
- simulation - 如何在 Anylogic 中创建具有不同标准的代理?
- ios - iOS 应用程序传输“尝试将空对象插入 com.webobjects.foundation.NSMutableDictionary”
- r - 在 r 中使用 list.files 的工作表名称
- c# - 如何在 ActionFilterAttribute 的 OnActionExecuting 中区分 C# 中的两个休息调用
- vba - 检查字符串是否包含在另一个字符串中
- javascript - 旧式 JavaScript 的参数中的 JavaScript ES6 花括号
- python - 为什么python在定义时评估函数的参数而不是在调用时?
- python - 覆盖 Postgres 的 celery 结果表 (celery_taskmeta)