【发布时间】:2022-11-08 22:36:22
【问题描述】:
获取 customerId、ephemeralKey 和 clientSecret 后,我使用 Configuration 对象(包括应用名称、customerConfiguration(customerId、ephemeralKey 和 GooglePayConfiguration.
然后我调用presentWithPaymentIntent(clientSecrent, customerConfiguration),其中客户配置是第一步创建的对象。
文档说,如果您通过客户配置并且用户选中“保存以备将来付款”复选框,则在下一次付款时,PaymentSheet 将显示已保存的卡,但出于某种原因,对我来说它没有。
我已经检查了 customerId 对于当前客户来说它总是一样的,只有 ephemeralKey 改变了新的付款,这似乎是正确的。
知道我可能做错了什么吗? iOS 客户端按预期工作,因此服务器端配置正常。
谢谢!
代码示例:
PaymentSheet.GooglePayConfiguration googlePayConfiguration = new PaymentSheet.GooglePayConfiguration(getGooglePayEnvironment(), countryCode);
PaymentSheet.CustomerConfiguration customerConfiguration = new PaymentSheet.CustomerConfiguration(mViewModel.getCustomerId(), mViewModel.getEphemeralKey());
PaymentSheet.Configuration configuration = new PaymentSheet.Configuration(getString(R.string.app_name),
customerConfiguration,
googlePayConfiguration,
null,
null);
mPaymentSheet.presentWithPaymentIntent(mViewModel.getClientSecret(), configuration);
【问题讨论】:
-
您能否分享您在致电以出示付款单时使用的代码以及您的后端提供的数据样本?我假设您大致遵循本指南:stripe.com/docs/payments/accept-a-payment?platform=android。
-
@RyanM 感谢您的评论。是的,我点击了那个链接。我用代码示例编辑了我的问题。
-
您可以记录
customerConfiguration的值并将其作为单独的sn-p 共享吗?未显示已保存付款方式的一个常见原因是预期与提供的配置值不匹配。
标签: android stripe-payments payment stripe-payment-intent