-
Couldn't load subscription status.
- Fork 1k
Description
Summary
Optimistic payment method deletion in CustomerSheet does not allow for custom removal logic in detachPaymentMethod(paymentMethodId) on CustomerAdapter.
I have a CustomerAdapter implementation with logic in detachPaymentMethod(paymentMethodId) that prevents the removal of payment methods in specific cases. This works in SDK version 24.9.0: A thrown error is displayed in the sheet and the payment method is not removed in the UI.
Starting in version 24.10.0 by commit 8867c51, optimistic removal does not respect a thrown error from detachPaymentMethod(paymentMethodId). The thrown error displays in the sheet, but the payment method is removed from the UI regardless. The payment method is correctly not actually detached in either version; Closing the sheet and re-opening it will fetch and display the payment method again.
The commit states that doing optimistic deletion will lead to a situation where they can still be in the list, which seems to be the exact issue.
To reproduce
Implement a CustomerAdapter where an error is thrown in detachPaymentMethod(paymentMethodId). The payment method will be removed from the UI even though it is not detached on backend.
iOS version
18.4
SDK version
24.10.0