Skip to content

Commit 3ae957a

Browse files
authored
feat(google): update android billing client to 8.2.0 (#52)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Android Billing Programs API (8.2.0+) for external content/offers, link launching, availability checks and reporting * Per-product subscription replacement params (8.1.0+) with new replacement modes including KEEP_EXISTING * Example apps/UI updated to enable/select billing programs and launch external links * **Deprecations** * Legacy alternative-billing APIs marked deprecated; migrate to Billing Programs API * **Documentation** * Expanded migration guides, flows and multi-language examples (TS/Kotlin/Dart/Swift) <sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub> <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent b4f1ba6 commit 3ae957a

20 files changed

Lines changed: 3375 additions & 166 deletions

File tree

CHANGELOG.md

Lines changed: 195 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,201 @@ All notable changes to the OpenIAP monorepo will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [openiap-gql 1.3.2] - 2025-12-11
9+
10+
### Added
11+
12+
#### Google Play Billing Library 8.1.0 Support
13+
14+
- **`SubscriptionProductReplacementParamsAndroid`**: New type for per-product subscription replacement configuration
15+
- `oldProductId`: The product ID being replaced
16+
- `replacementMode`: The replacement mode enum value
17+
- **`SubscriptionReplacementModeAndroid.KeepExisting`**: New replacement mode (8.1.0+) to keep the existing payment schedule unchanged
18+
19+
#### Google Play Billing Library 8.2.0 Support (Billing Programs API)
20+
21+
- **`BillingProgramAndroid`**: Enum for billing program types
22+
- `ExternalContentLink`: For apps linking to external content (reader apps, music streaming)
23+
- `ExternalOffer`: For apps offering alternative payment options
24+
- `Unspecified`: Default/unspecified value
25+
- **`BillingProgramAvailabilityResultAndroid`**: Result type for billing program availability checks
26+
- `billingProgram`: The program that was checked
27+
- `isAvailable`: Whether the program is available
28+
- **`BillingProgramReportingDetailsAndroid`**: Reporting details for external transactions
29+
- `billingProgram`: The billing program used
30+
- `externalTransactionToken`: Token for reporting to Google Play
31+
- **`LaunchExternalLinkParamsAndroid`**: Parameters for launching external links
32+
- `billingProgram`: Which billing program to use
33+
- `launchMode`: How to launch the link
34+
- `linkType`: Type of external link
35+
- `linkUri`: The URI to launch
36+
- **`ExternalLinkLaunchModeAndroid`**: Enum for external link launch modes
37+
- `LaunchInExternalBrowserOrApp`: Launch in external browser or app
38+
- `CallerWillLaunchLink`: Caller handles the link launch
39+
- `Unspecified`: Default value
40+
- **`ExternalLinkTypeAndroid`**: Enum for external link types
41+
- `LinkToDigitalContentOffer`: Link to digital content offer
42+
- `LinkToAppDownload`: Link to app download
43+
- `Unspecified`: Default value
44+
45+
### Changed
46+
47+
- Updated `RequestSubscriptionAndroidProps` to include optional `subscriptionProductReplacementParams` field
48+
49+
---
50+
51+
## [openiap-google 1.3.12] - 2025-12-11
52+
53+
### Added
54+
55+
#### Google Play Billing Library 8.1.0 APIs
56+
57+
- **`applySubscriptionProductReplacementParams()`**: Apply per-product replacement params to subscription upgrades/downgrades
58+
- Enables `KeepExisting` replacement mode (only available via this API)
59+
- More granular control over subscription replacements at the product level
60+
61+
#### Google Play Billing Library 8.2.0 APIs (Billing Programs)
62+
63+
- **`enableBillingProgram(program: BillingProgramAndroid)`**: Enable a billing program before `initConnection()`
64+
- Must be called before connecting to configure the BillingClient
65+
- Available via both `OpenIapModule` and `OpenIapStore`
66+
- **`isBillingProgramAvailable(program: BillingProgramAndroid)`**: Check if a billing program is available
67+
- Replaces deprecated `checkAlternativeBillingAvailability()` for external offers
68+
- Returns `BillingProgramAvailabilityResultAndroid` with availability status
69+
- **`createBillingProgramReportingDetails(program: BillingProgramAndroid)`**: Create reporting details for external transactions
70+
- Replaces deprecated `createAlternativeBillingReportingToken()`
71+
- Returns `BillingProgramReportingDetailsAndroid` with `externalTransactionToken`
72+
- **`launchExternalLink(activity: Activity, params: LaunchExternalLinkParamsAndroid)`**: Launch external link for external offers
73+
- Replaces deprecated `showAlternativeBillingInformationDialog()`
74+
- Supports configurable launch modes and link types
75+
76+
### Deprecated
77+
78+
The following APIs are deprecated in favor of the new Billing Programs API (8.2.0+):
79+
80+
- `checkAlternativeBillingAvailability()` → Use `isBillingProgramAvailable(BillingProgramAndroid.ExternalOffer)`
81+
- `showAlternativeBillingInformationDialog()` → Use `launchExternalLink(activity, params)`
82+
- `createAlternativeBillingReportingToken()` → Use `createBillingProgramReportingDetails(BillingProgramAndroid.ExternalOffer)`
83+
84+
### Changed
85+
86+
- **Example App (`AlternativeBillingScreen`)**: Updated to demonstrate all three billing modes:
87+
- Billing Programs (8.2.0+) - Recommended
88+
- Alternative Billing Only (Legacy 6.2+)
89+
- User Choice Billing (Legacy 7.0+)
90+
- **Error Handling**: Improved exception propagation in Proxy handlers using `resumeWithException()`
91+
- **Null Safety**: Added null-safe activity handling to prevent potential NPE
92+
93+
### Fixed
94+
95+
- Empty catch blocks now properly log errors and display status messages to users
96+
- Exception handling in coroutine Proxy handlers now correctly propagates exceptions
97+
98+
### Documentation
99+
100+
- Updated `external-purchase.tsx` with Billing Programs API (8.2.0+) documentation
101+
- Added API Migration Guide table for legacy to new API mapping
102+
- Updated Implementation Flow section with new step-by-step guide
103+
- Added code examples for TypeScript, Kotlin, and Dart
104+
105+
---
106+
107+
## [openiap-gql 1.3.1 / openiap-google 1.3.11] - 2025-12-10
108+
109+
### Added
110+
111+
#### One-Time Purchase Discount Offers (Google Play Billing 7.0+)
112+
113+
- **`oneTimePurchaseOfferDetailsAndroid`**: Changed from single object to array to support multiple discount offers
114+
- **`DiscountDisplayInfoAndroid`**: Discount display information
115+
- `discountPercent`: Percentage off
116+
- `discountAmount`: Discount amount details
117+
- **`DiscountAmountAndroid`**: Discount amount with currency
118+
- **`ValidTimeWindowAndroid`**: Start and end time for limited-time offers
119+
- **`LimitedQuantityInfoAndroid`**: Limited quantity information
120+
- **`RentalDetailsAndroid`**: Rental product metadata
121+
122+
#### Google Play Billing 8.1.0 Support
123+
124+
- **`PreorderDetailsAndroid`**: Pre-order product details
125+
- `preorderPresaleEndTimeMillis`: Presale end time
126+
- `preorderReleaseTimeMillis`: Release time
127+
- **`isSuspendedAndroid`**: Detect suspended subscriptions due to payment failures
128+
129+
### Changed
130+
131+
- **Upgraded Google Play Billing Library**: 8.0.0 → 8.1.0
132+
- **Increased minSdk**: 21 → 23 (Android 6.0)
133+
- **Upgraded Kotlin**: 2.0.21 → 2.2.0
134+
135+
### Breaking Changes
136+
137+
- **`oneTimePurchaseOfferDetailsAndroid`** type changed from single object to array
138+
- Before: `product.oneTimePurchaseOfferDetailsAndroid?.formattedPrice`
139+
- After: `product.oneTimePurchaseOfferDetailsAndroid?.firstOrNull()?.formattedPrice`
140+
141+
### Documentation
142+
143+
- Added comprehensive "Discounts (Android)" documentation
144+
- Updated types page with new Android fields
145+
146+
---
147+
148+
## [openiap-gql 1.3.0 / openiap-google 1.3.0 / openiap-apple 1.3.0] - 2025-12-08
149+
150+
### Added
151+
152+
- **`IapStore` enum**: Unified store identification
153+
- `Unknown`: Unknown store
154+
- `Apple`: Apple App Store
155+
- `Google`: Google Play Store
156+
- `Horizon`: Meta Horizon Store
157+
- **`store` field**: Added to `PurchaseCommon` interface for consistent store identification
158+
- **`verifyPurchaseWithProvider()`**: Server-side purchase verification API
159+
160+
### Changed
161+
162+
- **Renamed request props**: `ios`/`android``apple`/`google` in request payloads
163+
- `RequestPurchasePropsByPlatforms`: `ios``apple`, `android``google`
164+
- `RequestSubscriptionPropsByPlatforms`: `ios``apple`, `android``google`
165+
166+
### Deprecated
167+
168+
- **`platform` field**: Use `store` field instead
169+
- **`ios`/`android` props**: Use `apple`/`google` props in request payloads
170+
171+
### Migration Guide
172+
173+
**Request props migration:**
174+
```typescript
175+
// Before (deprecated)
176+
requestPurchase({
177+
request: {
178+
ios: { sku: 'product_id' },
179+
android: { skus: ['product_id'] }
180+
}
181+
});
182+
183+
// After (recommended)
184+
requestPurchase({
185+
request: {
186+
apple: { sku: 'product_id' },
187+
google: { skus: ['product_id'] }
188+
}
189+
});
190+
```
191+
192+
**Platform field migration:**
193+
```typescript
194+
// Before (deprecated)
195+
if (purchase.platform === 'ios') { ... }
196+
197+
// After (recommended)
198+
if (purchase.store === 'Apple') { ... }
199+
```
200+
201+
---
202+
8203
## [1.2.2] - 2025-10-16
9204

10205
### Added

0 commit comments

Comments
 (0)