Generated from iOS SDK 27.1. Availability is shown on each declaration; permissions and entitlements still apply.
Functions and constants
method · iOS 18.1+performCardEmulationTransactionWithCurrentCredential
TypeScriptperformCardEmulationTransactionWithCurrentCredential(scene: _UIKit_UIScene, options?: _SecureElementCredential_CredentialSession_CardEmulationOptions): Promise<void>
Swift declarationfunc performCardEmulationTransactionWithCurrentCredential(over scene: UIScene, options: CredentialSession.CardEmulationOptions = .init()) async throws
Activate the current credential in Wired mode to enter Card Emulation mode.
This call leads to the following sequence of events.
1. Prompts the user to authorize Card Emulation.
2. Deselects the instance on the wired interface.
3. Calls the broker interface with authorization information (if applicable). See the integration guide in the [Apple Business Register](https://register.apple.com) for more information about this interface.
4. Makes the instance available over the contactless interface and transition the session to emulation state.
This process is guaranteed to preserve contents of the Clear On Reset buffer in the operating system running on the Secure Element. This allows you to create some context in wired mode that remains valid later in card emulation mode.
Use the following flow to call this method:
1. Call ``acquirePresentmentAssertion()`` before calling this function to ensure that UI from other applications' payment tasks don't interfere with this transaction.
2. Relinquish the asssertion with ``CredentialSession/PresentmentIntentAssertion/relinquish()`` immediately prior to calling `performCardEmulationTransactionWithCurrentCredential(over:options:)`.
3. After presenting the credential, call ``CredentialSession/endWiredMode()`` to return to management mode.
4. If you have further proprietary payment UI to perform, use ``acquirePresentmentAssertion()`` to re-acquire the assertion. Perform your tasks, then call ``CredentialSession/PresentmentIntentAssertion/relinquish()`` again. Re-acquiring the assertion is subject to the limit of two assertions in an 80-second span.
The credential session state must be ``CredentialSession/State-swift.enum/wired(credential:)`` prior to calling this method. The state transitions to ``CredentialSession/State-swift.enum/management`` if the call encounters a ``CredentialSession/ErrorCode/resourceUnavailable`` error; otherwise the state remains unchanged.
> Important: Calling this method may generate a billable event to the credential provider.
- Parameters:
- scene: The <doc://com.apple.documentation/documentation/UIKit/UIScene> the authentication sheet appears over.
- options: Options with which to transition the credential to card emulation mode.
- Throws: An ``CredentialSession/ErrorCode``. The most common errors are:
- ``CredentialSession/ErrorCode/userCanceledAuthorization``: The user dismissed the authorization sheet.
method · iOS 18.1+endCardEmulation
TypeScriptendCardEmulation(): Promise<void>
Swift declarationfunc endCardEmulation() async throws
Ends card emulation and transitions the session to management state.
method · iOS 18.1+performTransaction
TypeScriptperformTransaction(credential: _SecureElementCredential_CredentialSession_Credential, scene: _UIKit_UIScene, options?: _SecureElementCredential_CredentialSession_CardEmulationOptions): Promise<void>
Swift declarationfunc performTransaction(using credential: CredentialSession.Credential, over scene: UIScene, options: CredentialSession.CardEmulationOptions = .init()) async throws
Prompts the user for authorization and then activate a credential for card emulation.
1. Call ``acquirePresentmentAssertion()`` before calling this function to ensure that UI from other applications' payment tasks don't interfere with this transaction.
2. Relinquish the asssertion with ``CredentialSession/PresentmentIntentAssertion/relinquish()`` immediately prior to calling `performTransaction(using:over:options:)`.
3. After presenting the credential, call ``CredentialSession/endCardEmulation()`` to return to management mode.
4. If you have further proprietary payment UI to perform, use ``acquirePresentmentAssertion()`` to re-acquire the assertion. Perform your tasks, then call ``CredentialSession/PresentmentIntentAssertion/relinquish()`` again. Re-acquiring the assertion is subject to the limit of two assertions in an 80-second span.
The credential session state must be ``CredentialSession/State-swift.enum/wired(credential:)`` prior to calling this method. The state transitions to ``CredentialSession/State-swift.enum/management`` if the call encounters a ``CredentialSession/ErrorCode/resourceUnavailable`` error; otherwise the state remains unchanged.
If this call succeeds the credential session state transitions to the ``CredentialSession/State-swift.enum/cardEmulation(credential:)`` state.
If not ended sooner, card emulation expires after 60 seconds and the credential session publishes a ``CredentialSession/Event/cardEmulationTimeout`` event.
> Important: Calling this method may generate a billable event to the credential provider.
- Parameters:
- credential: The credential to activate and transition into card emulation state with.
- scene: The <doc://com.apple.documentation/documentation/UIKit/UIScene> the authentication sheet appears over.
- options: Options with which to transition the credential to card emulation mode.
- Throws: An ``CredentialSession/ErrorCode``. The most common errors are:
- ``CredentialSession/ErrorCode/userCanceledAuthorization``: The user dismissed the authorization sheet.
- ``CredentialSession/ErrorCode/resourceUnavailable``: The system resource is unavailable. The session transitions to ``CredentialSession/State-swift.enum/management``.
method · iOS 18.1+performWiredTransaction
TypeScriptperformWiredTransaction(credential: _SecureElementCredential_CredentialSession_Credential, scene: _UIKit_UIScene, instanceAID: ArrayBuffer): Promise<void>
Swift declarationfunc performWiredTransaction(using credential: CredentialSession.Credential, over scene: UIScene, instanceAID: Data) async throws
Enters wired mode with user authentication.
If the person using the app chooses to authorize, the specified instance will first have an auth token delivered by the broker interface on the Secure Element as described in the [Apple Business Register](https://register.apple.com) Secure Element documents. Otherwise the session throws `userDeclined`.
Use the following flow to call this method:
1. Call ``acquirePresentmentAssertion()`` before calling this function to ensure that UI from other applications' payment tasks don't interfere with this transaction.
2. Relinquish the asssertion with ``CredentialSession/PresentmentIntentAssertion/relinquish()`` immediately prior to calling `performWiredTransaction(using:over:instanceAID:)`.
3. After presenting the credential, call ``CredentialSession/endWiredMode()`` to return to management mode.
4. If you have further proprietary payment UI to perform, use ``acquirePresentmentAssertion()`` to re-acquire the assertion. Perform your tasks, then call ``CredentialSession/PresentmentIntentAssertion/relinquish()`` again. Re-acquiring the assertion is subject to the limit of two assertions in an 80-second span.
The credential session can be in any state when calling this method. If the call succeeds, the state transitions to ``CredentialSession/State-swift.enum/wired(credential:)``. The state transitions to ``CredentialSession/State-swift.enum/management`` if the call encounters a ``CredentialSession/ErrorCode/resourceUnavailable`` error; otherwise the state remains unchanged.
An app extension calling this method needs to have the <doc://com.apple.documentation/documentation/BundleResources/Entitlements/com.apple.developer.identity-document-services.document-provider.mobile-document-types> entitlement.
> Important: Calling this method may generate a billable event to the credential provider.
- Parameters:
- credential: The credential to activate and transition into card emulation state with.
- scene: The <doc://com.apple.documentation/documentation/UIKit/UIScene> the authentication sheet appears over.
- instanceAID: The applet instance identifier of the installed credential to authorize.
- Throws: An ``CredentialSession/ErrorCode``. The most common errors are:
- ``CredentialSession/ErrorCode/credentialDoesNotExist``: The specified credential doesn't exist or the caller doesn't have access to it.
- ``CredentialSession/ErrorCode/instanceDoesNotExist``: The specified instance identifier doesn't exist in the target credential.
- ``CredentialSession/ErrorCode/userCanceledAuthorization``: The user dismissed the authorization sheet.
- ``CredentialSession/ErrorCode/resourceUnavailable``: The system resource is unavailable. The session transitions to ``CredentialSession/State-swift.enum/management``.
get · iOS 17.4+credentialSessionEvent
TypeScriptget credentialSessionEvent(): Promise<(CredentialSessionWindowSceneEvent) | null>
Swift declaration@MainActor @preconcurrency var credentialSessionEvent: CredentialSessionWindowSceneEvent? { get }
A CredentialSession event has triggered a UIKit scene creation.