<!--
{
  "availability" : [
    "iOS: 18.1.0 -",
    "iPadOS: 18.1.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SecureElementCredential",
  "identifier" : "/documentation/SecureElementCredential/CredentialSession/transceive(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SecureElementCredential"
    ],
    "preciseIdentifier" : "s:23SecureElementCredential0C7SessionC10transceivey10Foundation4DataVAGYaKF"
  },
  "title" : "transceive(_:)"
}
-->

# transceive(_:)

Send a wired command Application Protocol Data Unit (APDU) to the credential to complete a transaction or a card content management task.

```
func transceive(_ data: Data) async throws -> Data
```

## Parameters

`data`

The APDU as a <doc://com.apple.documentation/documentation/Foundation/Data> instance.

## Return Value

A response APDU.

## Discussion

Before calling this method, make sure the credential session state is [`CredentialSession.State.wired(credential:)`](/documentation/SecureElementCredential/CredentialSession/State-swift.enum/wired(credential:)). The state transitions to [`CredentialSession.State.management`](/documentation/SecureElementCredential/CredentialSession/State-swift.enum/management) if the call encounters a [`CredentialSession.ErrorCode.resourceUnavailable`](/documentation/SecureElementCredential/CredentialSession/ErrorCode/resourceUnavailable) error; otherwise the state remains unchanged.

Use this method to perform the web presentment transaction after calling `performWiredTransaction(using:over:instanceaid:)`.

> Note: When performing a ``doc://SecureElementCredential/documentation/SecureElementCredential/CredentialSession/transceive(_:)`` call, the system grants your app a 15-second grace period from invalidating the session, in the event your app goes into the background.

- The most common errors are:
  - [`CredentialSession.ErrorCode.invalidSessionState`](/documentation/SecureElementCredential/CredentialSession/ErrorCode/invalidSessionState): The session isn’t in the [`CredentialSession.State.wired(credential:)`](/documentation/SecureElementCredential/CredentialSession/State-swift.enum/wired(credential:)) state.
  - [`CredentialSession.ErrorCode.commandNotSupported`](/documentation/SecureElementCredential/CredentialSession/ErrorCode/commandNotSupported): The APDU represents an unsupported Secure Element command.
  - [`CredentialSession.ErrorCode.resourceUnavailable`](/documentation/SecureElementCredential/CredentialSession/ErrorCode/resourceUnavailable): The system resource is unavailable. The session transitions to [`CredentialSession.State.management`](/documentation/SecureElementCredential/CredentialSession/State-swift.enum/management).
  - [`CredentialSession.ErrorCode.acquiredResourceRelinquished`](/documentation/SecureElementCredential/CredentialSession/ErrorCode/acquiredResourceRelinquished): The shared system resource was relinquished during the operation.

---

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)