You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(android): update to Google Play Billing Library v8.0.0 (#108)
- Update billing-ktx dependency from 7.0.0 to 8.0.0
- Fix Kotlin compatibility by setting JVM target to 17
- Update queryProductDetailsAsync to use QueryProductDetailsResult
- Add PendingPurchasesParams for enablePendingPurchases
- Add deprecation warning for getPurchaseHistories on Android
- Update getPurchaseHistories to return empty array on Android
- Add blog post documenting v8 changes and migration guide
BREAKING CHANGE: getPurchaseHistories no longer returns purchase history
on Android. Use getAvailablePurchases instead for active purchases.
We've updated expo-iap to support Google Play Billing Library v8.0.0, which includes several important changes and improvements for Android in-app purchases.
11
+
12
+
## Key Changes
13
+
14
+
### 1. Updated Dependencies
15
+
16
+
The Android module now uses the latest Google Play Billing Library:
**getPurchaseHistory is no longer available on Android**
25
+
26
+
Google Play Billing Library v8 has removed the `queryPurchaseHistoryAsync()` method. The `getPurchaseHistories()` function will now return an empty array on Android with a console warning:
27
+
28
+
```typescript
29
+
// Before v8
30
+
const history =awaitgetPurchaseHistories(); // Returns purchase history
31
+
32
+
// After v8
33
+
const history =awaitgetPurchaseHistories(); // Returns [] on Android with warning
34
+
// Use getAvailablePurchases() instead for active purchases
35
+
```
36
+
37
+
### 3. Updated API Signatures
38
+
39
+
The `queryProductDetailsAsync` method now uses `ProductDetailsResult`:
val productDetailsList = productDetailsResult.productDetailsList ?: emptyList()
44
+
// Handle products
45
+
}
46
+
```
47
+
48
+
### 4. New PendingPurchasesParams
49
+
50
+
The `enablePendingPurchases()` method now requires a `PendingPurchasesParams` parameter:
51
+
52
+
```kotlin
53
+
.enablePendingPurchases(
54
+
PendingPurchasesParams.newBuilder()
55
+
.enableOneTimeProducts()
56
+
.build()
57
+
)
58
+
```
59
+
60
+
### 5. Automatic Service Reconnection
61
+
62
+
The library now includes automatic service reconnection support with `enableAutoServiceReconnection()`, improving reliability when the billing service disconnects unexpectedly:
63
+
64
+
```kotlin
65
+
.enableAutoServiceReconnection()
66
+
```
67
+
68
+
### 6. Sub-Response Codes
69
+
70
+
The library now provides more detailed error information through sub-response codes. For example, when a payment fails due to insufficient funds:
All other APIs remain compatible. The library handles the v8 changes internally, so most apps won't need any code changes beyond the purchase history migration.
108
+
109
+
## Benefits
110
+
111
+
-**Future-Proof**: Compliance with Google Play's latest billing requirements (deadline: August 31, 2025)
112
+
-**Improved Reliability**: Automatic service reconnection reduces connection-related errors
113
+
-**Better API**: More structured response objects with QueryProductDetailsResult
114
+
-**Enhanced Features**: Support for new features and improvements
115
+
116
+
## Upgrading
117
+
118
+
To upgrade to version 2.7.0:
119
+
120
+
```bash
121
+
npm install expo-iap@2.7.0
122
+
# or
123
+
yarn add expo-iap@2.7.0
124
+
# or
125
+
bun add expo-iap@2.7.0
126
+
```
127
+
128
+
## Requirements
129
+
130
+
- Android Gradle Plugin 4.0 or higher
131
+
- Kotlin 1.6 or higher
132
+
- JVM target 17 (automatically configured)
133
+
134
+
## What's New in Google Play Billing Library v8.0.0
135
+
136
+
### New Features
137
+
-**Multiple purchase options for one-time products** - More flexibility in product offerings
0 commit comments