You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using STPPaymentOptionsViewController with SwiftUI. The ViewController shows "Add a Card" view if a customer doesn't have a card. If I try to add a card on the "Add a Card" view, it keep loading forever and doesn't call registering apis.
I was doing it for the purpose of managing payment options in a "Payment methods" menu item in the user settings in the app.
So, my behavior required not closing the controller after pressing on a method (or adding a new card), but rather setting it as a default payment method.
P.S. When I present this controller by calling present/push on payment context (present or push Payment Options Controller), it works for the first card and there is no loader.
Summary
I'm using STPPaymentOptionsViewController with SwiftUI. The ViewController shows "Add a Card" view if a customer doesn't have a card. If I try to add a card on the "Add a Card" view, it keep loading forever and doesn't call registering apis.
It worked fine with SDK 21.0.1 or lower.
Code to reproduce
The code snippet I'm using is here.
iOS version
14.4
Installation method
Swift Package Manager
SDK version
21.2.1
Other information
I've debugged the SDK and found apiAdapter on STPPaymentOptionsViewController is nil for the first card addition.
https://github.com/stripe/stripe-ios/blob/21.2.1/Stripe/STPPaymentOptionsViewController.swift#L278
This is because apiAdapter is not used if a customer doesn't have a card on the view controller initialization and also apiAdapter is defined as weak.
https://github.com/stripe/stripe-ios/blob/21.2.1/Stripe/STPPaymentOptionsViewController.swift#L88-L127
Hence, the following code is not called and the view keeps loading forever.
https://github.com/stripe/stripe-ios/blob/21.2.1/Stripe/STPPaymentOptionsViewController.swift#L437
Add a Card view keeps loading forever.
The text was updated successfully, but these errors were encountered: