AppTransaction
AppTransaction#
Represents the app transaction information returned by getAppTransactionIOS(). Contains metadata about the app's purchase and installation.
iOS only. Mirrors AppTransaction (iOS 16+) — the JWS-verified record of how the app was acquired (Apple docs).
Native reference: Apple · StoreKit AppTransaction
Fields#
| Name | Summary |
|---|---|
bundleId | App bundle identifier |
appVersion | Current app version |
originalAppVersion | Version when user originally purchased/downloaded |
originalPurchaseDate | Original purchase timestamp |
deviceVerification | Device verification data |
deviceVerificationNonce | Nonce for device verification |
environment | Environment: "Sandbox" or "Production" |
signedDate | Date when the transaction was signed |
appId | App ID number |
appVersionId | App version ID number |
preorderDate | Preorder date (optional) |
appTransactionId | Stable app transaction ID. Introduced on iOS 18.4, macOS 15.4, tvOS 18.4, watchOS 11.4, and visionOS 2.4; StoreKit back-deploys it across the supported AppTransaction runtime range when built with Xcode 16.4+. |
originalPlatform | Original platform. OpenIAP uses StoreKit's compatibility string on the AppTransaction baseline and the typed value on iOS 18.4, macOS 15.4, tvOS 18.4, watchOS 11.4, and visionOS 2.4 or later. Xcode 16.4+ provides the compatibility path; the Xcode 27 SDK also adds the back-deployed managed value. |
revocationDate | App-acquisition revocation timestamp. The Xcode 27 SDK exposes this back-deployed property on Apple 16+. |
storeType | Store channel of the original app acquisition, such as consumer, education, or enterprise (Xcode 27 / Apple 27). |
Type Definition#
swift
struct AppTransaction {
let bundleId: String
let appVersion: String
let originalAppVersion: String
let originalPurchaseDate: Double // epoch ms
let deviceVerification: String
let deviceVerificationNonce: String
let environment: String // "Sandbox" | "Production"
let signedDate: Double // epoch ms
let appId: Double
let appVersionId: Double
let preorderDate: Double? // epoch ms
// iOS 18.4+ properties
let appTransactionId: String?
let originalPlatform: String?
// Published by the Xcode 27 SDK; availability follows each StoreKit property
let revocationDate: Double? // epoch ms
let storeType: String?
}Usage Example#
swift
import OpenIap
// Get app transaction (iOS only)
let appTransaction = try await OpenIapModule.shared.getAppTransactionIOS()
if let transaction = appTransaction {
print("Bundle ID: \(transaction.bundleId)")
print("Original version: \(transaction.originalAppVersion)")
print("Environment: \(transaction.environment)")
// Check if user originally purchased on a different platform (iOS 18.4+)
if let platform = transaction.originalPlatform {
print("Originally purchased on: \(platform)")
}
}