Skip to main content

10 posts tagged with "Android"

Android platform specific features

View All Tags

14.7.4 - Android Input Type Field Naming Simplification

· 2 min read
Hyo
React Native IAP Maintainer

This release simplifies field naming in Android input types (RequestPurchaseAndroidProps and RequestSubscriptionAndroidProps). Since these types are already Android-specific, their fields no longer need the Android suffix.

Breaking Changes

Simplified Field Names in Android Input Types

Fields inside platform-specific input types no longer require the platform suffix. The parent type name already indicates the platform context.

Why this change?

When you write google: { offerToken: "..." }, the google key already tells you this is Android-specific. Adding Android suffix to fields inside is redundant:

// Redundant - we know it's Android from the parent
google: { offerTokenAndroid: "..." }

// Cleaner - parent context is sufficient
google: { offerToken: "..." }

Migration Guide

Old Name (v14.7.3)New Name (v14.7.4)
obfuscatedAccountIdAndroidobfuscatedAccountId
obfuscatedProfileIdAndroidobfuscatedProfileId
purchaseTokenAndroidpurchaseToken
replacementModeAndroidreplacementMode

Before (v14.7.3):

await requestPurchase({
request: {
google: {
skus: ['subscription_id'],
subscriptionOffers: [{sku: 'subscription_id', offerToken: 'token'}],
purchaseTokenAndroid: currentPurchaseToken,
replacementModeAndroid: 1,
obfuscatedAccountIdAndroid: 'user_123',
},
},
type: 'subs',
});

After (v14.7.4):

await requestPurchase({
request: {
google: {
skus: ['subscription_id'],
subscriptionOffers: [{sku: 'subscription_id', offerToken: 'token'}],
purchaseToken: currentPurchaseToken,
replacementMode: 1,
obfuscatedAccountId: 'user_123',
},
},
type: 'subs',
});

Important: Response Types Keep Suffixes

The suffix removal only applies to input types (request parameters). Response types still use suffixes because they're cross-platform:

// Response fields KEEP the Android suffix
const purchase = purchases[0] as PurchaseAndroid;

// These response fields still have Android suffix
console.log(purchase.purchaseTokenAndroid); // Keep suffix
console.log(purchase.obfuscatedAccountIdAndroid); // Keep suffix

// But input fields don't need it anymore
await requestPurchase({
request: {
google: {
skus: [product.id],
obfuscatedAccountId: 'user_123', // Input: no suffix
},
},
type: 'in-app',
});

New Features

One-Time Purchase Discount Offers (Android 7.0+)

This release adds support for discount offers on one-time (in-app) purchases:

import {fetchProducts, requestPurchase} from 'react-native-iap';
import type {ProductAndroid} from 'react-native-iap';

// 1. Fetch products with discount offers
const products = await fetchProducts({
skus: ['premium_upgrade'],
type: 'in-app',
});

const product = products[0] as ProductAndroid;

// 2. Get the discount offer
const discountOffer = product.discountOffers?.[0];

// 3. Purchase with the discount
if (discountOffer?.offerTokenAndroid) {
await requestPurchase({
request: {
google: {
skus: [product.id],
offerToken: discountOffer.offerTokenAndroid, // Use simplified input field
},
},
type: 'in-app',
});
}

Naming Convention Summary

Field LocationSuffix Required?Example
Inside RequestPurchaseAndroidPropsNOofferToken
Inside RequestSubscriptionAndroidPropsNOpurchaseToken
Cross-platform response typeYESPurchaseAndroid.purchaseTokenAndroid

OpenIAP Versions

PackageVersion
openiap-gql1.3.15
openiap-google1.3.26
openiap-apple1.3.13

For detailed changes, see the OpenIAP Release Notes.

14.6.0 - Billing Programs API & Android Discounts

· 6 min read
Hyo
React Native IAP Maintainer

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+.

14.4.33 - Horizon OS Support

· 2 min read
Hyo
React Native IAP Maintainer

Horizon OS Support

React Native IAP 14.4.33 introduces Horizon OS support for Meta Quest devices, enabling developers to implement in-app purchases in VR applications using the same familiar API.

This release integrates Meta's Platform SDK for in-app purchases on Horizon OS, while maintaining the unified OpenIAP interface across iOS, Android, and now Horizon OS.

👉 View the 14.4.33 release