stripe / stripe-ios

Stripe iOS SDK
https://stripe.com
MIT License
2.11k stars 975 forks source link

[Feature] Difficulties to use CustomerSheet just to add/save a payment method #4172

Closed mikehaydan closed 1 hour ago

mikehaydan commented 3 hours ago

Is your feature request related to a problem? Please describe.

We have deferred payments and if payment will be removed from CustomerSheet, without our server control, users may lose money. We need to use a CustomerSheet just to add a payment method without displaying saved ones. Or, at least, do not allow to remove a payment method.

Describe the solution you'd like

Possible solutions:

Describe alternatives you've considered

I tried to use a custom adapter, which overrides fetchPaymentMethods:

final class AppStripeCustomerAdapter: StripeCustomerAdapter {

    override func fetchPaymentMethods() async throws -> [STPPaymentMethod] {
        []
    }
}

But, in this case, after adding a payment method, bottom sheet display an empty list, which might be confusing for the users (See screenshots below):

Additional context

Screenshot 2024-10-22 at 09 49 02 Screenshot 2024-10-22 at 09 49 23

seanzhang-stripe commented 3 hours ago

Hi @mikehaydan you can already achieve it with PaymentSheet. Here's how it works

The PaymentSheet won't display existing saved payment method because customer is absent from PaymentSheet.Configuration() , and PaymentSheet doesn't provide options for a customer to remove payment methods.

Hope this is helpful, let me know if you have any other questions.

mikehaydan commented 3 hours ago

hi @seanzhang-stripe that works great. thanks

seanzhang-stripe commented 1 hour ago

Happy to help. I'm going to close this ticket now. If you have any further questions, don’t hesitate to open a new one.