从 SDK 界面禁用 Stripe 卡编辑

问题描述 投票:0回答:1

我有以下代码,应显示一个条带 SDK 界面,在其中添加卡并在系统中注册卡。

PaymentSheet.Address address = new PaymentSheet.Address(
                    PersistentManager.getCityForId(HVariant.getCityVariant()).getDisplayName(),
                    HVariant.getCountryVariant(),
                    null,
                    null,
                    null,
                    HVariant.getCountryVariant());
            PaymentSheet.BillingDetails.Builder billingDetails =
                    new PaymentSheet.BillingDetails.Builder().address(address);

            PaymentSheet.CustomerConfiguration customerConfiguration = new PaymentSheet.CustomerConfiguration(
                    resp.getStripe().getCustomer(),
                    resp.getStripe().getEphemeralKey()
            );
            mPaymentSheet.presentWithSetupIntent(
                    resp.getStripe().getClientSecret(),
                    new PaymentSheet.Configuration(
                            "Avara",
                            customerConfiguration,
                            null,
                            null,
                            billingDetails.build()
                    )
            );

enter image description here

如果用户不存在卡,则打开输入卡的表单并注册卡。 如果用户已有一张卡,它会打开该工作表,您可以在其中看到现有卡,并允许您添加新卡。该表有一个

Edit
按钮,按下该按钮,我可以从条带中删除该卡。这确实破坏了应用程序的核心业务逻辑,因为用户需要始终在系统中添加一张卡。

如何从界面禁用删除卡功能?我发现

setCanDeletePaymentOptions
类上有一个
PaymentSessionConfig
,但我不知道如何将其设置为他
paymentSheet

android stripe-payments
1个回答
0
投票

对于 iOS SDK,请检查 PaymentSheet.Configuration 的此属性:

/// This is an experimental feature that may be removed at any time.
/// If true (the default), the customer can delete all saved payment methods.
/// If false, the customer can't delete if they only have one saved payment method remaining.
@_spi(ExperimentalAllowsRemovalOfLastSavedPaymentMethodAPI) public var allowsRemovalOfLastSavedPaymentMethod = true
© www.soinside.com 2019 - 2024. All rights reserved.