2.6.3 - iOS AppTransaction Support
· 2 min read
We're excited to announce the release of expo-iap version 2.6.3, which includes critical fixes for iOS AppTransaction functionality.
What's New
Complete AppTransaction Properties
The getAppTransactionIOS()
function now returns all properties available from Apple's StoreKit 2 AppTransaction API:
export type AppTransactionIOS = {
appTransactionID: string;
bundleID: string;
appVersion: string;
originalAppVersion: string;
originalPurchaseDate: number;
deviceVerification: string;
deviceVerificationNonce: string;
environment: string;
signedDate: number;
appID?: number;
appVersionID?: number;
originalPlatform: string;
preorderDate?: number;
};
Key Properties Added
appTransactionID
: The unique identifier for the app transactionenvironment
: Indicates whether the transaction occurred in Production, Sandbox, or Xcode environmentsignedDate
: The date when the transaction was signedappID
andappVersionID
: App Store identifiers for the app and versionoriginalPlatform
: The platform where the app was originally purchasedpreorderDate
: Available when the app was pre-ordered
Usage Example
import {getAppTransactionIOS} from 'expo-iap';
const getAppPurchaseInfo = async () => {
try {
const appTransaction = await getAppTransactionIOS();
console.log('App Transaction ID:', appTransaction.appTransactionID);
console.log('Environment:', appTransaction.environment);
console.log(
'Original Purchase Date:',
new Date(appTransaction.originalPurchaseDate),
);
// Check if app was pre-ordered
if (appTransaction.preorderDate) {
console.log('Pre-order Date:', new Date(appTransaction.preorderDate));
}
} catch (error) {
console.error('Failed to get app transaction:', error);
}
};
Why This Matters
The AppTransaction API provides crucial information about the app's purchase and installation:
- Verify app authenticity: Use the device verification data to ensure the app is legitimate
- Track installation source: Determine if the app was purchased, redeemed, or installed via TestFlight
- Environment detection: Easily identify if you're running in production or sandbox
- Pre-order support: Handle pre-ordered apps appropriately
Requirements
- iOS 16.0 or later
- The function will throw an error on older iOS versions
Bug Fixes
This release also includes:
- Fixed missing properties in AppTransaction type definition
- Corrected property names to match Apple's API exactly
- Fixed TypeScript type exports
- Fixed iOS build errors for
appTransactionID
andpreorderDate
mapping - Made
originalPlatform
optional as it's only available in iOS 18.4+
Upgrading
To upgrade to version 2.6.3:
npm install expo-iap@2.6.3
# or
yarn add expo-iap@2.6.3
# or
bun add expo-iap@2.6.3
What's Next
We're continuing to improve the iOS integration and will be adding more StoreKit 2 features in upcoming releases. Stay tuned!
Feedback
If you encounter any issues or have suggestions, please open an issue on our GitHub repository.
Happy coding! 🚀