Release 14.6.0 - Billing Programs API & Android Discounts
React Native IAP 14.6.0 brings the new Billing Programs API from Google Play Billing Library 8.2.0+, allowing developers to use External Content Links and External Offers. This release also includes full support for one-time product discounts from Billing Library 7.0+ and new purchase status fields from Billing Library 8.1.0+.
oneTimePurchaseOfferDetailsAndroid is now an array instead of a single object. Please update your code accordingly if you access this field directly.
What's New
Billing Programs API (Android 8.2.0+)
Google Play Billing Library 8.2.0 introduces the new Billing Programs API that replaces the deprecated alternative billing APIs. This API supports:
- External Content Links - For eligible apps to link to external content
- External Offers - For eligible apps to offer purchases outside Google Play
New Methods
// Enable a billing program BEFORE calling initConnection
enableBillingProgramAndroid('external-offer');
await initConnection();
// Check if the program is available for this user
const result = await isBillingProgramAvailableAndroid('external-offer');
if (result.isAvailable) {
// Program is available
}
// Get reporting details for external transactions
const details = await createBillingProgramReportingDetailsAndroid('external-offer');
// Use details.externalTransactionToken to report transactions
// Launch external link
const success = await launchExternalLinkAndroid({
billingProgram: 'external-offer',
launchMode: 'launch-in-external-browser-or-app',
linkType: 'link-to-digital-content-offer',
linkUri: 'https://your-website.com/purchase',
});
One-Time Product Discount Support
Google Play Billing Library 7.0+ introduced the ability to offer discounts on one-time (non-subscription) products. This release fully supports these discount features through the new oneTimePurchaseOfferDetailsAndroid array.
Each offer in the array can contain:
- Discount Display Info - Percentage discount or absolute discount amount
- Limited Quantity Info - Maximum and remaining quantity for limited offers
- Valid Time Window - Start and end times for time-limited offers
- Pre-order Details - Release time for pre-order products
- Rental Details - Rental period and expiration for rental products
Subscription Replacement Improvements (Android 8.1.0+)
New per-product subscription replacement configuration with SubscriptionProductReplacementParamsAndroid:
interface SubscriptionProductReplacementParamsAndroid {
oldProductId: string;
replacementMode: SubscriptionReplacementModeAndroid;
}
Also adds the new KeepExisting replacement mode from Billing Library 8.1.0+, which keeps the existing payment schedule unchanged during subscription upgrades/downgrades.
New isSuspendedAndroid Field
For subscriptions, we've added the isSuspendedAndroid field from Billing Library 8.1.0+. This indicates whether a subscription is currently suspended (e.g., due to payment issues during a grace period).
Breaking Change
oneTimePurchaseOfferDetailsAndroid is now an Array
Before (14.5.0):
const offer = product.oneTimePurchaseOfferDetailsAndroid;
// offer is a single object or null
After (14.6.0):
const offers = product.oneTimePurchaseOfferDetailsAndroid;
// offers is an array or null
const firstOffer = offers?.[0];
If you were accessing the price directly, update your code:
// Before
const price = product.oneTimePurchaseOfferDetailsAndroid?.formattedPrice;
// After
const price = product.oneTimePurchaseOfferDetailsAndroid?.[0]?.formattedPrice;
New Types
Billing Programs Types
type BillingProgramAndroid =
| 'unspecified'
| 'external-content-link'
| 'external-offer';
type ExternalLinkLaunchModeAndroid =
| 'unspecified'
| 'launch-in-external-browser-or-app'
| 'caller-will-launch-link';
type ExternalLinkTypeAndroid =
| 'unspecified'
| 'link-to-digital-content-offer'
| 'link-to-app-download';
interface LaunchExternalLinkParamsAndroid {
billingProgram: BillingProgramAndroid;
launchMode: ExternalLinkLaunchModeAndroid;
linkType: ExternalLinkTypeAndroid;
linkUri: string;
}
interface BillingProgramAvailabilityResultAndroid {
billingProgram: BillingProgramAndroid;
isAvailable: boolean;
}
interface BillingProgramReportingDetailsAndroid {
billingProgram: BillingProgramAndroid;
externalTransactionToken: string;
}
ProductAndroidOneTimePurchaseOfferDetail
interface ProductAndroidOneTimePurchaseOfferDetail {
formattedPrice: string;
priceAmountMicros: string;
priceCurrencyCode: string;
offerId?: string | null;
offerToken: string;
offerTags: string[];
// Discount fields (Billing Library 7.0+)
fullPriceMicros?: string | null;
discountDisplayInfo?: DiscountDisplayInfoAndroid | null;
limitedQuantityInfo?: LimitedQuantityInfoAndroid | null;
validTimeWindow?: ValidTimeWindowAndroid | null;
preorderDetailsAndroid?: PreorderDetailsAndroid | null;
rentalDetailsAndroid?: RentalDetailsAndroid | null;
}
OpenIAP Updates
- openiap-google: 1.3.10 → 1.3.12
- openiap-gql: 1.3.0 → 1.3.2
Early Access Installation
Version 14.6 is currently available as a preview release. Install with the @next tag:
npm install react-native-iap@next react-native-nitro-modules
# or
yarn add react-native-iap@next react-native-nitro-modules
# or
bun add react-native-iap@next react-native-nitro-modules
Check out the 14.6 (Next) documentation for details on all upcoming features.
References
- Google Play Billing Library 8.2.0 Release Notes
- Google Play Billing Programs
- Google Play One-Time Product Discounts
- Types Documentation
Questions or feedback? Reach out via GitHub issues.
