<!--
{
  "availability" : [
    "iOS: 18.1.0 -",
    "iPadOS: 18.1.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SecureElementCredential",
  "identifier" : "/documentation/SecureElementCredential/CredentialTransaction/performTransaction(using:options:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SecureElementCredential",
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:32_SecureElementCredential_SwiftUI0C11TransactionC07performF05using7optionsy0abC00C7SessionC0C0V_AI20CardEmulationOptionsVtYaKF"
  },
  "title" : "performTransaction(using:options:)"
}
-->

# performTransaction(using:options:)

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

```
func performTransaction(using credential: Credential, options: CardEmulationOptions = .init()) async throws
```

## Parameters

`credential`

The credential to activate and transition into card emulation state.

`options`

The options to activate the credential with, defaults to none.

## Discussion

If this call succeeds, the session state trasitions to [`CredentialSession.State.cardEmulation(credential:)`](/documentation/SecureElementCredential/CredentialSession/State-swift.enum/cardEmulation(credential:)).

Card emulation ends after 60 seconds, at which point the the event stream publishes a [`CredentialSession.Event.cardEmulationTimeout`](/documentation/SecureElementCredential/CredentialSession/Event/cardEmulationTimeout) event. If you complete your transaction before the timeout, call [`endCardEmulation()`](/documentation/SecureElementCredential/CredentialSession/endCardEmulation()) to exit card emulation mode.

The caller needs to invoke [`invalidate()`](/documentation/SecureElementCredential/CredentialTransaction/Configuration/invalidate()) after completing each transaction.

> Important: Calling this method may generate a billable event to the credential provider.

> Throws: An ``doc://SecureElementCredential/documentation/SecureElementCredential/CredentialSession/ErrorCode``. The most common errors are:
> 
> - ``doc://SecureElementCredential/documentation/SecureElementCredential/CredentialSession/ErrorCode/invalidView``: The transaction has no associated scene.
> - ``doc://SecureElementCredential/documentation/SecureElementCredential/CredentialSession/ErrorCode/userCanceledAuthorization``: The user dismissed the authorization sheet.
> - ``doc://SecureElementCredential/documentation/SecureElementCredential/CredentialSession/ErrorCode/resourceUnavailable``: The system resource is unavailable.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)