---
title: "performTransaction(using:over:options:)"
framework: secureelementcredential
role: symbol
role_heading: Instance Method
path: "secureelementcredential/credentialsession/performtransaction(using:over:options:)"
---

# performTransaction(using:over:options:)

Prompts the user for authorization and then activate a credential for card emulation.

## Declaration

```swift
func performTransaction(using credential: CredentialSession.Credential, over scene: UIScene, options: CredentialSession.CardEmulationOptions = .init()) async throws
```

## 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.

## Mentioned in

Accessing and using secure element credentials

## Discussion

Discussion Call acquirePresentmentAssertion() before calling this function to ensure that UI from other applications’ payment tasks don’t interfere with this transaction. Relinquish the asssertion with relinquish() immediately prior to calling performTransaction(using:over:options:). After presenting the credential, call endCardEmulation() to return to management mode. If you have further proprietary payment UI to perform, use acquirePresentmentAssertion() to re-acquire the assertion. Perform your tasks, then call 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.wired(credential:) prior to calling this method. The state transitions to CredentialSession.State.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.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.

## See Also

### Performing card emulation

- [performCardEmulationTransactionWithCurrentCredential(over:options:)](secureelementcredential/credentialsession/performcardemulationtransactionwithcurrentcredential(over:options:).md)
- [CredentialSession.CardEmulationOptions](secureelementcredential/credentialsession/cardemulationoptions.md)
- [endCardEmulation()](secureelementcredential/credentialsession/endcardemulation().md)
