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

Fields#

NameSummary
bundleIdApp bundle identifier
appVersionCurrent app version
originalAppVersionVersion when user originally purchased/downloaded
originalPurchaseDateOriginal purchase timestamp
deviceVerificationDevice verification data
deviceVerificationNonceNonce for device verification
environmentEnvironment: "Sandbox" or "Production"
signedDateDate when the transaction was signed
appIdApp ID number
appVersionIdApp version ID number
preorderDatePreorder date (optional)
appTransactionIdStable 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+.
originalPlatformOriginal 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.
revocationDateApp-acquisition revocation timestamp. The Xcode 27 SDK exposes this back-deployed property on Apple 16+.
storeTypeStore 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)")
    }
}