|
| 1 | +--- |
| 2 | +slug: v2-8-6-release |
| 3 | +title: Expo IAP v2.8.6 - Platform-Specific Naming Convention |
| 4 | +authors: [hyochan] |
| 5 | +tags: [release, breaking-change, ios, android, refactoring] |
| 6 | +--- |
| 7 | + |
| 8 | +# Expo IAP v2.8.6 Release Notes |
| 9 | + |
| 10 | +We're excited to announce the release of Expo IAP v2.8.6, which introduces important naming convention changes to improve code clarity and platform-specific function identification. |
| 11 | + |
| 12 | +## 🚨 Breaking Changes |
| 13 | + |
| 14 | +### Platform-Specific Function Suffixes |
| 15 | + |
| 16 | +To enhance code readability and prevent confusion between platform-specific and cross-platform functions, we've standardized our naming conventions: |
| 17 | + |
| 18 | +#### iOS Functions |
| 19 | +All iOS-specific functions now use the `IOS` suffix: |
| 20 | +- `getPromotedProductIOS()` |
| 21 | +- `clearTransactionIOS()` |
| 22 | +- `getPendingTransactionsIOS()` (new) |
| 23 | +- `requestPurchaseOnPromotedProductIOS()` (replaces `buyPromotedProductIOS`) |
| 24 | + |
| 25 | +#### Android Functions |
| 26 | +All Android-specific functions now use the `Android` suffix: |
| 27 | +- `acknowledgePurchaseAndroid()` |
| 28 | +- `consumeProductAndroid()` |
| 29 | +- `getPackageNameAndroid()` |
| 30 | + |
| 31 | +#### Cross-Platform Functions |
| 32 | +Common functions that work across both platforms remain without suffix: |
| 33 | +- `requestProducts()` |
| 34 | +- `requestPurchase()` |
| 35 | +- `requestSubscription()` |
| 36 | +- `getAvailablePurchases()` |
| 37 | +- `finishTransaction()` |
| 38 | + |
| 39 | +## ✨ New Features |
| 40 | + |
| 41 | +### iOS Transaction Management |
| 42 | +- **`getPendingTransactionsIOS()`**: New function to retrieve pending transactions |
| 43 | +- **`clearTransactionIOS()`**: New function to explicitly clear specific transactions |
| 44 | + |
| 45 | +## 🔄 Function Renaming |
| 46 | + |
| 47 | +- `buyPromotedProductIOS` → `requestPurchaseOnPromotedProductIOS` |
| 48 | + - Updated to use `request` prefix following OpenIAP naming conventions |
| 49 | + |
| 50 | +## ⚠️ Deprecations |
| 51 | + |
| 52 | +The following functions will be removed in v2.9.0: |
| 53 | + |
| 54 | +- **`getPurchaseHistories()`**: Use `getAvailablePurchases()` instead |
| 55 | +- **`buyPromotedProductIOS()`**: Use `requestPurchaseOnPromotedProductIOS()` instead |
| 56 | +- **`disable()`**: No longer needed (observer management is now automatic) |
| 57 | + |
| 58 | +## 🐛 Bug Fixes (v2.8.4-2.8.5) |
| 59 | + |
| 60 | +### Android |
| 61 | +- Fixed `finishTransaction` null error by adding fallback to `purchaseTokenAndroid` (#180) |
| 62 | +- Improved automatic service reconnection using Android Billing Client v8 features (#178) |
| 63 | + |
| 64 | +### iOS |
| 65 | +- Fixed iOS 18.4 properties build failure on Xcode 16.3 and below (added Swift 6.1 compiler guard) |
| 66 | + |
| 67 | +## 📋 Migration Guide |
| 68 | + |
| 69 | +### Before (v2.8.5 and earlier) |
| 70 | +```typescript |
| 71 | +import { |
| 72 | + buyPromotedProductIOS, |
| 73 | + acknowledgePurchase, |
| 74 | + consumeProduct, |
| 75 | + getPurchaseHistories |
| 76 | +} from 'expo-iap'; |
| 77 | + |
| 78 | +// iOS promoted product purchase |
| 79 | +await buyPromotedProductIOS(); |
| 80 | + |
| 81 | +// Android-specific operations (ambiguous naming) |
| 82 | +await acknowledgePurchase(purchaseToken); |
| 83 | +await consumeProduct(purchaseToken); |
| 84 | + |
| 85 | +// Deprecated function |
| 86 | +const histories = await getPurchaseHistories(); |
| 87 | +``` |
| 88 | + |
| 89 | +### After (v2.8.6+) |
| 90 | +```typescript |
| 91 | +import { |
| 92 | + requestPurchaseOnPromotedProductIOS, |
| 93 | + acknowledgePurchaseAndroid, |
| 94 | + consumeProductAndroid, |
| 95 | + getAvailablePurchases, |
| 96 | + getPendingTransactionsIOS, |
| 97 | + clearTransactionIOS |
| 98 | +} from 'expo-iap'; |
| 99 | + |
| 100 | +// iOS promoted product purchase (renamed) |
| 101 | +await requestPurchaseOnPromotedProductIOS(); |
| 102 | + |
| 103 | +// Android-specific operations (clear naming) |
| 104 | +await acknowledgePurchaseAndroid(purchaseToken); |
| 105 | +await consumeProductAndroid(purchaseToken); |
| 106 | + |
| 107 | +// Use recommended function |
| 108 | +const purchases = await getAvailablePurchases(); |
| 109 | + |
| 110 | +// New iOS transaction management |
| 111 | +const pendingTransactions = await getPendingTransactionsIOS(); |
| 112 | +await clearTransactionIOS(transactionId); |
| 113 | +``` |
| 114 | + |
| 115 | +## 🎯 Why These Changes? |
| 116 | + |
| 117 | +1. **Clarity**: Platform-specific functions are immediately identifiable |
| 118 | +2. **Consistency**: Naming conventions align with OpenIAP specification |
| 119 | +3. **Maintainability**: Easier code review and debugging |
| 120 | +4. **Type Safety**: Improved TypeScript auto-completion |
| 121 | + |
| 122 | +## 📚 Documentation |
| 123 | + |
| 124 | +For detailed migration instructions, see the [Migration Guide](/docs/guides/migration-2.8.6). |
| 125 | + |
| 126 | +## 🙏 Acknowledgments |
| 127 | + |
| 128 | +Thank you to all contributors who made this release possible. Special thanks to those who helped resolve platform-specific type mismatches and modernize the Android billing implementation. |
| 129 | + |
| 130 | +## 📝 Next Steps |
| 131 | + |
| 132 | +v2.9.0 will remove deprecated functions and include additional OpenIAP specification compliance improvements. Please update your use of deprecated functions early for a smooth migration. |
| 133 | + |
| 134 | +Questions and feedback are welcome at [GitHub Issues](https://github.com/hyochan/expo-iap/issues)! |
0 commit comments