For the complete documentation index, see llms.txt. This page is also available as Markdown.

Managing Payment Methods

Let users manage their saved payment methods (bank cards) with OnsideKit's built-in payment methods manager screen.

OnsideKit provides a built-in screen where users can view, add, and remove the bank cards saved to their Onside account.

Present the manager

@MainActor static func presentPaymentMethodsManager(
    completion: (@MainActor (Result<Void, OnsidePaymentMethodsManagerError>) -> Void)? = nil
)
Onside.presentPaymentMethodsManager { result in
    switch result {
    case .success:
        // The manager was presented and dismissed normally.
        break
    case .failure(.loginDiscarded):
        // The user dismissed the login screen shown before the manager.
        break
    case .failure(.notSupportedInLocalTesting):
        // Not available in local-testing mode.
        break
    }
}

completion is optional (= nil), so you can also call Onside.presentPaymentMethodsManager() with no arguments.

Behavior

  • Implicit login. If the user is not authenticated, OnsideKit presents the login flow first. If the user dismisses it, the completion fails with .loginDiscarded. See Authentication & User Account.

  • Local testing. When the SDK is initialized with a .storekit configuration, this screen is unavailable and the call fails with .notSupportedInLocalTesting. See Local Testing.

Errors

OnsidePaymentMethodsManagerError:

Case
Cause

.loginDiscarded

The user dismissed the login flow shown before the manager.

.notSupportedInLocalTesting

The SDK is running in local-testing mode (a .storekit configuration was passed to initialize).

Customizing presentation

The manager is presented in a window owned by the SDK. You can choose which UIWindowScene it uses and override its theme via OnsideDelegate, using the .paymentMethodsManager screen case.

Looking to configure Apple Pay? That's a separate setup — see Apple Pay.

Last updated

Was this helpful?