Iaptic React Native SDK
Provides in-app purchase functionality with integrated receipt validation through the Iaptic service.
The API entry point is IapticRN.
import { IapticSubscriptionView } from 'react-native-iaptic';
const app = (props) => {
useEffect(() => {
// Initialize the SDK with your configuration at startup
IapticRN.initialize({
appName: 'com.example.app',
publicKey: 'YOUR_API_KEY',
iosBundleId: 'com.yourcompany.app',
products: [{
id: 'premium_subscription',
type: 'paid subscription',
entitlements: ['basic', 'premium']
}, {
id: 'basic_subscription',
type: 'paid subscription',
entitlements: ['basic']
}],
});
}, []);
return (
<View>
// In your root node, add the modal component
<IapticSubscriptionView entitlementLabels={{
premium: 'Premium Features',
basic: 'Basic Features',
}} />
// Anyway in your app, open the Subscription UI
<TouchableOpacity onPress={() => IapticRN.presentSubscriptionView()}>
<Text>Subscribe</Text>
</TouchableOpacity>
</View>
);
};
// 2. Check access without a backend server
if (IapticRN.checkEntitlement('premium')) {
// Unlock premium features
}
With a backend server, you will get webhook calls from iaptic server and store your user's subscription status (unlocking features server-side, safer).
Reason why a subscription has been canceled
CUSTOMER:
"Customer"
Subscription canceled by the user for an unspecified reason.
CUSTOMER_COST:
"Customer.Cost"
Customer canceled for cost-related reasons.
CUSTOMER_FOUND_BETTER_APP:
"Customer.FoundBetterApp"
Customer claimed to have found a better app.
CUSTOMER_NOT_USEFUL_ENOUGH:
"Customer.NotUsefulEnough"
Customer did not feel he is using this service enough.
CUSTOMER_OTHER_REASON:
"Customer.OtherReason"
Subscription canceled for another reason; for example, if the customer made the purchase accidentally.
CUSTOMER_PRICE_INCREASE:
"Customer.PriceIncrease"
Customer did not agree to a recent price increase. See also priceConsentStatus.
CUSTOMER_TECHNICAL_ISSUES:
"Customer.TechnicalIssues"
Customer canceled their transaction due to an actual or perceived issue within your app.
DEVELOPER:
"Developer"
Subscription canceled by the developer.
NOT_CANCELED:
""
Not canceled
SYSTEM:
"System"
Subscription canceled by the system for an unspecified reason.
SYSTEM_BILLING_ERROR:
"System.BillingError"
Billing error; for example customer's payment information is no longer valid.
SYSTEM_DELETED:
"System.Deleted"
Transaction is gone; It has been deleted.
SYSTEM_PRODUCT_UNAVAILABLE:
"System.ProductUnavailable"
Product not available for purchase at the time of renewal.
SYSTEM_REPLACED:
"System.Replaced"
Subscription upgraded or downgraded to a new subscription.
UNKNOWN:
"Unknown"
Subscription canceled for unknown reasons.
Error codes
BAD_RESPONSE:
6777018
Error: Bad response from the server
CLIENT_INVALID:
6777005
Error: Client is not allowed to issue the request
CLOUD_SERVICE_NETWORK_CONNECTION_FAILED:
6777025
Error: The device could not connect to the network.
CLOUD_SERVICE_PERMISSION_DENIED:
6777024
Error: The user has not allowed access to Cloud service information
CLOUD_SERVICE_REVOKED:
6777026
Error: The user has revoked permission to use this cloud service.
COMMUNICATION:
6777014
Error: Failed to communicate with the server
DOWNLOAD:
6777021
Error: Failed to download the content
FINISH:
6777013
Error: Cannot finalize a transaction or acknowledge a purchase
INVALID_OFFER_IDENTIFIER:
6777029
Error: The offer identifier is invalid.
INVALID_OFFER_PRICE:
6777030
Error: The price you specified in App Store Connect is no longer valid.
INVALID_PRODUCT_ID:
6777012
Error: The product identifier is invalid
INVALID_SIGNATURE:
6777031
Error: The signature in a payment discount is not valid.
LOAD:
6777002
Error: Failed to load in-app products metadata
LOAD_RECEIPTS:
6777004
Error: Failed to load the purchase receipt
MISSING_OFFER_PARAMS:
6777032
Error: Parameters are missing in a payment discount.
MISSING_TOKEN:
6777016
Error: Purchase information is missing token
PAYMENT_CANCELLED:
6777006
Error: Purchase flow has been cancelled by user
PAYMENT_EXPIRED:
6777020
Error: Payment has expired
PAYMENT_INVALID:
6777007
Error: Something is suspicious about a purchase
PAYMENT_NOT_ALLOWED:
6777008
Error: The user is not allowed to make a payment
PRIVACY_ACKNOWLEDGEMENT_REQUIRED:
6777027
Error: The user has not yet acknowledged Apple's privacy policy
PRODUCT_NOT_AVAILABLE:
6777023
Error: The requested product is not available in the store.
PURCHASE:
6777003
Error: Failed to make a purchase
REFRESH:
6777019
Error: Failed to refresh the store
REFRESH_RECEIPTS:
6777011
Error: Failed to refresh the purchase receipt
SETUP:
6777001
Error: Failed to intialize the in-app purchase library
SUBSCRIPTION_UPDATE_NOT_AVAILABLE:
6777022
Error: Failed to update a subscription
SUBSCRIPTIONS_NOT_AVAILABLE:
6777015
Error: Subscriptions are not available
UNAUTHORIZED_REQUEST_DATA:
6777028
Error: The app is attempting to use a property for which it does not have the required entitlement.
UNKNOWN:
6777010
Error: Unknown error
VALIDATOR_SUBSCRIPTION_EXPIRED:
6778003
Server code used when a subscription expired.
Validator should now return the transaction in the collection as expired.
VERIFICATION_FAILED:
6777017
Error: Verification of store data failed
Whether or not the user was notified or agreed to a price change
AGREED:
"Agreed"
NOTIFIED:
"Notified"
Purchase platforms supported by the plugin
APPLE_APPSTORE:
"ios-appstore"
Apple AppStore
BRAINTREE:
"braintree"
Braintree
GOOGLE_PLAY:
"android-playstore"
Google Play
TEST:
"test"
Test platform
WINDOWS_STORE:
"windows-store-transaction"
Windows Store
Error severity
- INFO: The error is not critical and can be ignored, not worth reporting to the user, can be logged to your server or ignored.
- WARNING: The error is important and can be reported to the user as a toast message.
- ERROR: The error is critical and should be reported to the user as a pop-up alert.
ERROR:
2
INFO:
0
WARNING:
1
DEBUG:
3
ERROR:
0
INFO:
2
WARN:
1
Represents an error in the Iaptic purchase flow
try {
await iaptic.order(productOffer);
} catch (error) {
if (error instanceof IapticError) {
trackAnalyticsEvent(error.code);
if (error.severity === IapticErrorSeverity.INFO) {
console.log('Info:', error.localizedMessage);
return;
}
Alert.alert(error.localizedTitle, error.localizedMessage);
} else {
Alert.alert('Unknown error', error.message);
}
}
Error
optional
cause:unknown
Error.cause
readonly
code:IapticErrorCode
readonly
debugMessage:string
readonly
localizedMessage:string
readonly
localizedTitle:string
message:
string
Error.message
name:
string
Error.name
readonly
severity:IapticSeverity
optional
stack:string
Error.stack
readonly
status:undefined
|number
static
optional
prepareStackTrace: (err
,stackTraces
) =>any
Optional override for formatting stack traces
Error
CallSite
[]
any
https://v8.dev/docs/stack-trace-api#customizing-stack-traces
Error.prepareStackTrace
static
stackTraceLimit:number
Error.stackTraceLimit
static
captureStackTrace(targetObject
,constructorOpt
?):void
Create .stack property on a target object
object
Function
void
Error.captureStackTrace
Iaptic React Native SDK.
This is the entry point for the Iaptic SDK, the main methods are:
import React, { useEffect, useState } from 'react';
import { View, Text, TouchableOpacity, Alert } from 'react-native';
import { IapticRN, IapticProduct, IapticVerifiedPurchase } from 'react-native-iaptic';
const App = () => {
const [products, setProducts] = useState<IapticProduct[]>([]);
const [entitlements, setEntitlements] = useState<string[]>([]);
useEffect(async () => {
// Listen for product and entitlement updates
IapticRN.addEventListener('products.updated', setProducts);
IapticRN.addEventListener('purchase.updated', () => {
setEntitlements(IapticRN.listEntitlements());
});
// Initialize IapticRN with your API key and product definitions
await IapticRN.initialize({
appName: 'com.example.app',
publicKey: 'YOUR_API_KEY',
iosBundleId: 'com.example.app',
products: [
{ id: 'pro_monthly', type: 'paid subscription', entitlements: ['pro'] },
{ id: 'premium_lifetime', type: 'non consumable', entitlements: ['premium'] },
],
});
// Load products and entitlements
setEntitlements(IapticRN.listEntitlements());
setProducts(IapticRN.getProducts());
return () => {
IapticRN.destroy();
};
}, []);
// Handle purchase button press
const handlePurchase = async (product: IapticProduct) => {
try {
await IapticRN.order(product.offers[0]);
Alert.alert('Purchase complete!');
} catch (err) {
Alert.alert('Purchase failed', err.message);
}
};
// Restore purchases
const restorePurchases = async () => {
try {
await IapticRN.restorePurchases(() => {});
Alert.alert('Purchases restored');
} catch (err) {
Alert.alert('Restore failed', err.message);
}
};
return (
<View>
{products.map(product => (
<TouchableOpacity
key={product.id}
onPress={() => handlePurchase(product)}
>
<Text>{product.title}</Text>
<Text>{product.offers[0].pricingPhases[0].price}</Text>
</TouchableOpacity>
))}
<Text>Pro entitlement: {entitlements.includes('pro') ? 'Yes' : 'No'}</Text>
<Text>Premium entitlement: {entitlements.includes('premium') ? 'Yes' : 'No'}</Text>
<TouchableOpacity onPress={restorePurchases}>
<Text>Restore Purchases</Text>
</TouchableOpacity>
</View>
);
};
export default App;
new IapticRN():
IapticRN
readonly
static
utils:IapticUtils
Utility functions
static
addEventListener<T
>(eventType
,listener
):object
Add an event listener for iaptic events
To remove a listener, call the returned object's remove()
method.
• T extends IapticEventType
T
Type of event to listen for
Callback function that will be called when the event occurs
object
remove: () =>
void
void
// Listen for subscription updates
IapticRN.addEventListener('subscription.updated', (reason, purchase) => {
console.log(`Subscription ${purchase.id} ${reason}`);
});
// Listen for pending purchase updates
IapticRN.addEventListener('pendingPurchase.updated', (pendingPurchase) => {
console.log(`Purchase ${pendingPurchase.productId} is now ${pendingPurchase.status}`);
});
// Listen for purchase updates
IapticRN.addEventListener('purchase.updated', (purchase) => {
console.log(`Purchase ${purchase.id} ${purchase.status}`);
});
// Listen for non-consumable purchases
IapticRN.addEventListener('nonConsumable.owned', (purchase) => {
console.log(`Non-consumable purchase ${purchase.id} is now owned`);
});
const listener = IapticRN.addEventListener('purchase.updated', (purchase) => {
console.log(`Purchase ${purchase.id} ${purchase.status}`);
});
listener.remove();
IapticEventType for all possible event types
static
addLocale(code
,messages
):void
Add a locale for Iaptic provided components and error messages.
string
The language code
The locale messages
void
IapticRN.addLocale('fr', {...});
static
checkEntitlement(featureId
):boolean
Check if the user has active access to a specific feature or content.
Entitlements represent features/content that users unlock through purchases. They are defined in product definitions and automatically tracked when purchases are validated.
string
The unique identifier for the feature/content (e.g. "premium", "gold_status")
boolean
True if the user has active access to the specified feature
// Check premium access
if (IapticRN.checkEntitlement('premium')) {
showPremiumContent();
} else {
showUpgradePrompt();
}
// Check specific feature access
const hasCoolFeature = IapticRN.checkEntitlement('cool_feature');
static
consume(purchase
):Promise
<void
>
Consume a purchase. Only for consumable products.
The purchase to consume
Promise
<void
>
IapticRN.consume(purchase);
IapticTokensManager for a convenient way to handle your consumable products.
static
destroy():void
Destroy the IapticRN singleton, remove event listeners and cleanup everything.
void
static
getActiveSubscription():undefined
|IapticVerifiedPurchase
Get the active subscription (if any)
For apps that sell multiple subscriptions that can be active at the same time, this returns the first one. To check if there is any active subscription:
- getPurchases to manually parse and find all active subscriptions.
- isOwned with all your product ids to check if there is any active subscription.
undefined
| IapticVerifiedPurchase
The active subscription or undefined if there is no active subscription
IapticVerifiedPurchase for more information on the purchase object
const activeSubscription = IapticRN.getActiveSubscription();
if (activeSubscription) {
console.log(`Active subscription: ${activeSubscription.productId}`);
if (activeSubscription.renewalIntent === 'Renew') {
console.log('Will renew on: ' + new Date(activeSubscription.expiryDate).toLocaleDateString());
}
else {
console.log('Will expire on: ' + new Date(activeSubscription.expiryDate).toLocaleDateString());
}
}
static
getPendingPurchases():IapticPendingPurchase
[]
Get all pending purchases.
List of pending purchases
static
getProduct(productId
):undefined
|IapticProduct
Get a product from the product catalog
string
The product identifier
undefined
| IapticProduct
The product or undefined if not found
const product = IapticRN.getProduct('premium_monthly');
IapticProduct for more information on the product object
static
getProducts():IapticProduct
[]
Get all products from the product catalog
List of products
const products = IapticRN.getProducts();
IapticProduct for more information on the product object
static
getPurchases():IapticVerifiedPurchase
[]
Get all verified purchases.
List of purchases, most recent first
const purchases = IapticRN.getPurchases();
IapticVerifiedPurchase for more information on the purchase object
static
initialize(config
):Promise
<void
>
Initialize the IapticRN singleton
The configuration for the IapticRN singleton
Promise
<void
>
IapticRN.initialize({
appName: 'com.example.app',
publicKey: '1234567890',
iosBundleId: 'com.example.app',
products: [
{ id: 'pro_monthly', type: 'paid subscription', entitlements: ['pro'] },
{ id: 'premium_lifetime', type: 'non consumable', entitlements: ['premium'] },
{ id: 'coins_100', type: 'consumable', tokenType: 'coins', tokenValue: 100 },
],
});
static
isOwned(productId
):boolean
Check if a product is owned.
- For non-consumable products, this checks if the product is owned.
- For paid subscriptions, this checks if there is an active subscription.
- For consumables, this always returns false.
string
The product identifier
boolean
True if the product is owned
if (IapticRN.isOwned('premium_subscription')) {
console.log('User has an active subscription');
}
static
listEntitlements():string
[]
Get all currently active entitlements for the user.
This aggregates entitlements from all non-expired purchases, including:
- Active subscriptions
- Non-consumable purchases
- Non-consumed consumables
Entitlements are defined in product definitions and automatically tracked when purchases are validated.
string
[]
Array of entitlement IDs the user currently has access to
// Get all unlocked features
const unlockedFeatures = IapticRN.listEntitlements();
// ['basic', 'premium', 'dark_theme']
static
loadProducts(definitions
?):Promise
<IapticProduct
[]>
Load products from the Store.
The products to load
Promise
<IapticProduct
[]>
await IapticRN.loadProducts([
{ id: 'basic_subscription', type: 'paid subscription', entitlements: [ 'basic' ] },
{ id: 'premium_subscription', type: 'paid subscription', entitlements: [ 'basic', 'premium' ] },
{ id: 'premium_lifetime', type: 'non consumable', entitlements: [ 'basic', 'premium' ] },
{ id: 'coins_100', type: 'consumable', tokenType: 'coins', tokenValue: 100 },
]);
static
loadPurchases():Promise
<IapticVerifiedPurchase
[]>
Load and validate active purchases details from the Store and Iaptic using their receipts
Notice that this is done when initialize the Store already.
Promise
<IapticVerifiedPurchase
[]>
List of verified purchases.
const purchases = await IapticRN.loadPurchases();
static
manageBilling():Promise
<void
>
Opens the platform-specific billing management page.
Promise
<void
>
static
manageSubscriptions():Promise
<void
>
Opens the platform-specific subscription management page.
Promise
<void
>
static
order(offer
):Promise
<void
>
Order a product with an offer.
The offer to order
Promise
<void
>
const offer = IapticRN.getProduct('premium_monthly')?.offers[0];
if (offer) {
try {
await IapticRN.order(offer);
console.log('Purchase started successfully');
} catch (error) {
console.error('Purchase failed:', error);
}
}
static
presentSubscriptionView():void
Present a subscription comparison view with product cards and feature grid
void
IapticRN.presentSubscriptionView();
This is a singleton component - Render it once at your root component:
// In your App.tsx
export default function App() {
return (
<>
<MainComponent />
<IapticSubscriptionView />
</>
);
}
static
removeAllEventListeners(eventType
?):void
Remove all event listeners for a specific event type If no event type is specified, removes all listeners for all events
Optional event type to remove listeners for
void
static
restorePurchases(progressCallback
):Promise
<number
>
Restore purchases from the Store.
(processed
, total
) => void
Callback function that will be called with the progress of the restore operation - An initial call with -1, 0 when the operation starts. - Subsequent calls are with the current progress (processed, total). - The final call will have processed === total, you know the operation is complete.
Promise
<number
>
The number of purchases restored
// Restore purchases with progress updates
const numRestored = await IapticRN.restorePurchases((processed, total) => {
console.log(`Processed ${processed} of ${total} purchases`);
});
static
setApplicationUsername(username
):Promise
<void
>
Set the application username for the iaptic service.
This is used to track which user is making the purchase and associate it with the user's account.
- On iOS, the application username is also added as an appAccountToken in the form of a UUID formatted MD5 (utils.md5UUID).
- On Android, the application username is added as an obfuscatedAccountIdAndroid in the form of a 64 characters string (utils.md5).
Don't forget to update the username in the app service if the user changes (login/logout).
undefined
| string
Promise
<void
>
IapticRN.setApplicationUsername('user_123');
IapticRN.setApplicationUsername(undefined);
static
setLocale(code
,fallbackCode
):void
Set the current locale for Iaptic provided components and error messages.
It's automatically set to the device's language, but you can override it.
string
The language code
string
= 'en'
void
IapticRN.setLocale('fr');
static
setProductDefinitions(productDefinitions
):void
Add product definitions to the product catalog.
Entitlements define what features/content a product unlocks. They can be shared across multiple products (e.g. a subscription and lifetime purchase both granting "premium" access).
void
IapticRN.setProductDefinitions([
{
id: 'premium_monthly',
type: 'paid subscription',
entitlements: ['premium'] // Unlocks premium features
},
{
id: 'dark_theme',
type: 'non consumable',
entitlements: ['dark_theme'] // Unlocks visual feature
}
]);
IapticRN.setProductDefinitions([
{ id: 'coins_100', type: 'consumable', tokenType: 'coins', tokenValue: 100 },
{ id: 'coins_500', type: 'consumable', tokenType: 'coins', tokenValue: 500 },
]);
// Define a subscription and consumable product
IapticRN.setProductDefinitions([
{
id: 'premium_monthly',
type: 'paid subscription',
entitlements: ['premium'],
},
{
id: 'coins_1000',
type: 'consumable',
tokenType: 'coins',
tokenValue: 1000,
}
]);
##### setVerbosity()
> `static` **setVerbosity**(`verbosity`): `void`
Set the verbosity level for the iaptic service.
###### Parameters
###### verbosity
[`IapticVerbosity`](#iapticverbosity)
###### Returns
`void`
###### Example
```typescript
IapticRN.setVerbosity(IapticLoggerVerbosityLevel.DEBUG);
Simple token balance manager that uses localStorage to store transactions.
To do this, this class the list of all transactions and their corresponding amounts.
When a transaction is added, it is added to the list. When a transaction is removed, it is removed from the list.
The balance is the sum of all the amounts in the list.
- IapticProductDefinition.tokenType
- IapticProductDefinition.tokenValue
const tokensManager = new IapticTokensManager(iaptic);
// ... tokensManager is now tracking consumable purchases that have a tokenType defined.
const balance = tokensManager.getBalance('coin');
new IapticTokensManager(
consumePurchases
):IapticTokensManager
boolean
= true
addTransaction(
transactionId
,type
,amount
):Promise
<void
>
Add a transaction to the map and persist it
string
Unique identifier for the transaction
string
Type of token (e.g., 'gems', 'coins', 'credits')
number
Number of tokens earned (positive) or spent (negative)
Promise
<void
>
getAllBalances():
Map
<string
,number
>
Get all balances as a map of token type to amount
Map
<string
, number
>
getBalance(
tokenType
):number
Get balance for a specific token type
string
number
getTransactions(
tokenType
?):IapticTokenTransaction
[]
Get transaction history for a specific token type
string
hasTransaction(
transactionId
):boolean
Helper method to check if we've already processed a transaction This can be used before processing a purchase to avoid double-counting
string
boolean
removeTransaction(
transactionId
):Promise
<void
>
Remove a transaction and update storage
string
Promise
<void
>
Utility methods for users of the iaptic library.
new IapticUtils():
IapticUtils
cheapestOffer(
product
):IapticOffer
fixedRecurrenceMode(
pricingPhase
):undefined
|IapticRecurrenceMode
FINITE_RECURRING with billingCycles=1 is like NON_RECURRING FINITE_RECURRING with billingCycles=0 is like INFINITE_RECURRING
undefined
| IapticRecurrenceMode
formatBillingCycle(
pricingPhase
):string
Generate a localized version of the billing cycle in a pricing phase.
For supported languages, check IapticSupportedLocales.
Example outputs:
- "3x 1 month": for
FINITE_RECURRING
, 3 cycles, period "P1M" - "for 1 year": for
NON_RECURRING
, period "P1Y" - "every week": for `INFINITE_RECURRING, period "P1W"
string
IapticRN.utils.formatBillingCycle(offer.pricingPhases[0])
formatCurrency(
amountMicros
,currency
):string
Format a currency amount from micros with proper localization
number
Amount in micros (1/1,000,000 of currency unit)
string
ISO 4217 currency code (e.g., 'USD', 'EUR')
string
Formatted currency string
Utils.formatCurrency(1990000, 'USD') // Returns "$1.99"
Utils.formatCurrency(1000000, 'EUR') // Returns "€1"
formatDuration(
iso
,count
,includeCount
?):string
`P${number}D`
| `P${number}W`
| `P${number}M`
| `P${number}Y`
number
boolean
string
md5(
account
):string
Returns the MD5 hash-value of the passed string.
string
string
md5UUID(
account
):string
Generate a UUID v3-like string from an account string.
The username is first hashed with MD5, then formatted as a UUID v3-like string by adding dashes between the different parts of the hash.
This is used to generate a appAccountToken for Apple App Store purchases.
string
The account string
string
The UUID v3-like string
monthlyPriceMicros(
offer
):number
number
Configuration for Iaptic React Native SDK
IapticStoreConfig
optional
applicationUsername:string
appName:
string
IapticStoreConfig.appName
optional
baseUrl:string
The base URL of the iaptic validator
IapticStoreConfig.baseUrl
optional
iosBundleId:string
IapticStoreConfig.iosBundleId
optional
products:IapticProductDefinition
[]
publicKey:
string
IapticStoreConfig.publicKey
optional
showAlerts:boolean
Disable alert by setting this to false.
By default, IapticRN will display relevant alerts to the user when something goes wrong.
Default is true.
IapticStoreConfig.showAlerts
optional
verbosity:IapticVerbosity
Event argument types mapped to their event names
purchased: [
IapticVerifiedPurchase
]
refunded: [
IapticVerifiedPurchase
]
error: [
IapticError
]
owned: [
IapticVerifiedPurchase
]
unowned: [
IapticVerifiedPurchase
]
updated: [
IapticVerifiedPurchase
]
updated: [
IapticPendingPurchase
]
updated: [
IapticProduct
[]]
updated: [
IapticVerifiedPurchase
]
cancelled: [
IapticVerifiedPurchase
]
changed: [
IapticVerifiedPurchase
]
expired: [
IapticVerifiedPurchase
]
renewed: [
IapticVerifiedPurchase
]
updated: [
IapticSubscriptionReason
,IapticVerifiedPurchase
]
List of keys a locale must provide.
const myLocale: IapticLocale = {
ProgrammingError: 'No pa bon',
...
};
IapticRN.addLocale('xx_yy', myLocale);
ActiveSubscription_ManageBilling:
string
Manage Billing
ActiveSubscription_ManageSubscriptions:
string
Manage Subscriptions
ActiveSubscription_Status_Active:
string
Active
ActiveSubscription_Status_Expired:
string
Expired
ActiveSubscription_Tag_Retry:
string
Payment Retry
ActiveSubscription_Tag_Trial:
string
Trial Period
ActiveSubscription_WillCancel:
string
Will be cancelled on {0} at {1}
ActiveSubscription_WillRenew:
string
Auto-renewing on {0} at {1}
BillingCycle_Finite:
string
{cycles}x {duration}
BillingCycle_Infinite:
string
every {duration}
BillingCycle_NonRecurring:
string
for {duration}
DateFormatter_Date:
string
"Date"
DateFormatter_Time:
string
"Time"
Duration_D_plural:
string
days
Duration_D_singular:
string
day
Duration_M_plural:
string
months
Duration_M_singular:
string
month
Duration_W_plural:
string
weeks
Duration_W_singular:
string
week
Duration_Y_plural:
string
years
Duration_Y_singular:
string
year
EntitlementGrid_Checkmark:
string
"✓"
Error:
string
Error
IapticError_6777001:
string
Failed to initialize the in-app purchase library
IapticError_6777002:
string
Failed to load in-app products metadata
IapticError_6777003:
string
Failed to make a purchase
IapticError_6777004:
string
Failed to load the purchase receipt
IapticError_6777005:
string
Client is not allowed to issue the request
IapticError_6777006:
string
Purchase flow has been cancelled by user
IapticError_6777007:
string
Something is suspicious about a purchase
IapticError_6777008:
string
The user is not allowed to make a payment
IapticError_6777010:
string
Unknown error
IapticError_6777011:
string
Failed to refresh the purchase receipt
IapticError_6777012:
string
The product identifier is invalid
IapticError_6777013:
string
Cannot finalize a transaction or acknowledge a purchase
IapticError_6777014:
string
Failed to communicate with the server
IapticError_6777015:
string
Subscriptions are not available
IapticError_6777016:
string
Purchase information is missing token
IapticError_6777017:
string
Verification of store data failed
IapticError_6777018:
string
Bad response from the server
IapticError_6777019:
string
Failed to refresh the store
IapticError_6777020:
string
Payment has expired
IapticError_6777021:
string
Failed to download the content
IapticError_6777022:
string
Failed to update a subscription
IapticError_6777023:
string
The requested product is not available in the store
IapticError_6777024:
string
The user has not allowed access to Cloud service information
IapticError_6777025:
string
The device could not connect to the network
IapticError_6777026:
string
The user has revoked permission to use this cloud service
IapticError_6777027:
string
The user has not yet acknowledged Apple's privacy policy
IapticError_6777028:
string
The app is attempting to use a property without required entitlement
IapticError_6777029:
string
The offer identifier is invalid
IapticError_6777030:
string
The price specified in App Store Connect is no longer valid
IapticError_6777031:
string
The signature in a payment discount is not valid
IapticError_6777032:
string
Parameters are missing in a payment discount
IapticError_6778003:
string
Subscription has expired
IapticError_StoreAlreadyInitialized:
string
IapticRN.store is already initialized, call IapticRN.destroy() first
IapticError_StoreNotInitialized:
string
IapticRN.store is not initialized, call IapticRN.initialize() first
IapticError_UnsupportedPlatform:
string
Unsupported platform
IapticRN_initialized_called:
string
IapticRN.initialize() can only be called once
ProductPrice_StartingAt:
string
"starting at {0} per month" - {0} will be replaced with price component
ProgrammingError:
string
Programming Error
PurchaseError_E_ALREADY_OWNED:
string
This item has already been purchased.
PurchaseError_E_BILLING_RESPONSE_JSON_PARSE_ERROR:
string
Failed to parse the billing response.
PurchaseError_E_DEFERRED_PAYMENT:
string
The payment has been deferred.
PurchaseError_E_DEVELOPER_ERROR:
string
An error occurred in the application.
PurchaseError_E_IAP_NOT_AVAILABLE:
string
In-app purchases are not available.
PurchaseError_E_INTERRUPTED:
string
The operation was interrupted.
PurchaseError_E_ITEM_UNAVAILABLE:
string
The requested product is not available.
PurchaseError_E_NETWORK_ERROR:
string
A network error occurred.
PurchaseError_E_NOT_ENDED:
string
The transaction has not been ended.
PurchaseError_E_NOT_PREPARED:
string
The purchase cannot be completed because it has not been prepared.
PurchaseError_E_RECEIPT_FAILED:
string
Failed to validate receipt.
PurchaseError_E_RECEIPT_FINISHED_FAILED:
string
Failed to finish the transaction.
PurchaseError_E_REMOTE_ERROR:
string
A remote error occurred.
PurchaseError_E_SERVICE_ERROR:
string
The service returned an error.
PurchaseError_E_UNKNOWN:
string
An unknown error occurred.
PurchaseError_E_USER_CANCELLED:
string
The user cancelled the purchase.
PurchaseError_E_USER_ERROR:
string
An error occurred in the application.
PurchaseError_title:
string
Purchase Error #{0}
SubscriptionView_Back:
string
"Back"
SubscriptionView_BillingOptions:
string
"Billing Options"
SubscriptionView_Cancel:
string
Cancel
SubscriptionView_ChangePlan:
string
"Change Plan"
SubscriptionView_Close:
string
"Close"
SubscriptionView_Continue:
string
"Continue"
SubscriptionView_CurrentPlan:
string
"Current Plan"
SubscriptionView_CurrentSubscription:
string
"Your Subscription"
SubscriptionView_Includes:
string
"Includes:"
SubscriptionView_PleaseWait:
string
Please wait...
SubscriptionView_Processing:
string
"Processing..."
SubscriptionView_ProcessingStatus_cancelled:
string
"Cancelled"
SubscriptionView_ProcessingStatus_completed:
string
Completed
SubscriptionView_ProcessingStatus_finishing:
string
Finalizing purchase...
SubscriptionView_ProcessingStatus_processing:
string
Processing...
SubscriptionView_ProcessingStatus_purchasing:
string
Purchasing...
SubscriptionView_ProcessingStatus_validating:
string
Validating receipt...
SubscriptionView_ProcessingTitle:
string
Purchasing...
SubscriptionView_RestoreProgress:
string
"Processed {0} of {1} purchases"
SubscriptionView_RestorePurchase:
string
"Restore Purchases"
SubscriptionView_RestoringTitle:
string
"Restoring..."
SubscriptionView_TermsLink:
string
"Terms and Conditions"
SubscriptionView_TermsPrefix:
string
"By subscribing, you agree to our"
SubscriptionView_Title:
string
"Choose Your Plan"
SubscriptionView_UpdatePlan:
string
"Update Plan"
UnknownError:
string
An unknown error occurred.
UnknownError_title:
string
Unknown Error
ValidationError:
string
Receipt Validation Error
ValidationError_MissingTransactionId:
string
Transaction ID is missing
Pricing offer for an In-App Product
id:
string
Offer identifier
optional
offerToken:string
Offer token (if any)
offerType:
"Default"
|"Introductory"
|"Subscription"
Type of offer
platform:
IapticPurchasePlatform
Platform of the product
pricingPhases:
IapticPricingPhase
[]
Pricing phases for this offer
optional
productGroup:null
|string
Subscription group (if any)
productId:
string
Product identifier
optional
productType:IapticProductType
Type of product (subscription, consumable, etc.)
Keep the state of a potential purchase in progress
optional
offerId:string
Identifier of the offer that is being purchased
productId:
string
Product identifier
status:
IapticPendingPurchaseState
Status of the purchase
Description of a phase for the pricing of a purchase.
optional
billingCycles:number
Number of recurrence cycles (if recurrenceMode is FINITE_RECURRING)
optional
billingPeriod:string
ISO 8601 duration of the period (https://en.wikipedia.org/wiki/ISO_8601#Durations)
optional
currency:string
Currency code
optional
paymentMode:IapticPaymentMode
Payment mode for the pricing phase ("PayAsYouGo", "UpFront", or "FreeTrial")
price:
string
priceMicros:
number
Price in micro-units (divide by 1000000 to get numeric price)
optional
recurrenceMode:IapticRecurrenceMode
Type of recurring payment
Product metadata from the store
optional
countryCode:string
Country code of the product
optional
description:string
Description of the product provided by the store
optional
entitlements:string
[]
Entitlements this product will give to the user, can be used for subscription and non-consumable products.
Use iapticRN.checkEntitlement("my-entitlement") to check if the user owns any product that provides this entitlement.
id:
string
Product identifier on the store (unique per platform)
offers:
IapticOffer
[]
List of offers available for this product
platform:
IapticPurchasePlatform
Platform of the product
optional
title:string
Title of the product provided by the store
optional
tokenType:string
Type of token this product will give to the user for consumable products.
For example: "coin", "gem", "silver", etc.
optional
tokenValue:number
Amount of tokens this product will give to the user for consumable products.
{ id: 'coins_100', type: 'consumable', tokenType: 'coin', tokenValue: 100 },
type:
IapticProductType
Type of product (subscription, consumable, etc.)
Interface defining an in-app purchase product
optional
entitlements:string
[]
Entitlements this product will give to the user, can be used for subscription and non-consumable products.
Use iapticRN.checkEntitlement("my-entitlement") to check if the user owns any product that provides this entitlement.
id:
string
Unique identifier of the product
optional
tokenType:string
Type of token this product will give to the user for consumable products.
For example: "coin", "gem", "silver", etc.
optional
tokenValue:number
Amount of tokens this product will give to the user for consumable products.
{ id: 'coins_100', type: 'consumable', tokenType: 'coin', tokenValue: 100 },
type:
IapticProductType
Type of the product (subscription, consumable, or non-consumable)
Props for IapticSubscriptionView Component
// Basic usage example:
<IapticSubscriptionView
entitlementLabels={{ premium: 'Premium Features' }}
styles={{ productCard: { backgroundColor: '#FFF' }}}
/>
optional
entitlementLabels:Record
<string
, {detail
:string
;label
:string
; }>
Localized descriptions for each entitlement/feature
{}
{
* premium: { label: 'Premium Features', detail: 'Unlimited Downloads' },
* adFree: { label: 'Ad-Free', detail: 'Remove All Ads While Watching Videos' }
* }
- IapticRN.listEntitlements
- IapticProductDefinition.entitlements
optional
onPurchaseComplete: () =>void
Callback when a purchase is complete (show a thank you message or whatever)
void
onPurchaseComplete={() => console.log('Purchase complete')}
optional
showRestorePurchase:boolean
Show restore purchases button when there's no active subscription
true
optional
sortProducts:boolean
Sort products by number of entitlements (most first)
true
sortProducts={false} // Disable automatic sorting
optional
styles:Partial
<IapticSubscriptionViewStyles
>
Custom styles for component elements (merges with defaults)
styles={{
modalContainer: { backgroundColor: 'rgba(0,0,0,0.8)' },
ctaButton: { backgroundColor: '#FF3B30' }
}}
optional
termsUrl:string
URL to Terms & Conditions (optional)
termsUrl="https://example.com/terms"
optional
theme:Partial
<IapticTheme
>
Theme configuration for colors
theme={{ primaryColor: '#FF3B30', backgroundColor: '#F5F5F5' }}
optional
visible:boolean
Controls visibility of the modal
false
Theme configuration for Iaptic components
{
* primaryColor: '#007AFF',
* secondaryColor: '#4CAF50',
* backgroundColor: '#FFFFFF',
* textColor: '#1A1A1A',
* secondaryTextColor: '#666666',
* borderColor: '#EEEEEE',
* successColor: '#4CAF50',
* warningColor: '#FF9800',
* errorColor: '#FF3B30'
* }
backgroundColor:
string
Background color for modals/cards
borderColor:
string
Border and divider colors
optional
errorColor:string
Error states color
primaryColor:
string
Primary brand color for buttons, highlights
secondaryColor:
string
Secondary color for current plan badges, success states
secondaryTextColor:
string
Secondary/subdued text color
optional
successColor:string
Success states color
textColor:
string
Primary text color
optional
warningColor:string
Warning states color
A transaction that has occurred.
amount:
number
Number of tokens earned (positive) or spent (negative) for this transaction
timestamp:
number
When the transaction occurred
transactionId:
string
Unique identifier from the store
type:
string
Type of token (e.g., 'gem', 'coin', 'credit')
Purchase verified by the receipt validator.
optional
cancelationReason:IapticCancelationReason
The reason a subscription or purchase was cancelled.
optional
discountId:string
Identifier of the discount currently applied to a purchase.
Correspond to the product's offerId. When undefined it means there is only one offer for the given product.
optional
expiryDate:number
Date of expiry for a subscription.
id:
string
Product identifier
Use productId
instead
optional
isAcknowledged:boolean
True when a purchase has been acknowledged
optional
isBillingRetryPeriod:boolean
True when a subscription a subscription is in the grace period after a failed attempt to collect payment
optional
isExpired:boolean
True when a subscription is expired.
optional
isIntroPeriod:boolean
True when a subscription is in introductory pricing period
optional
isTrialPeriod:boolean
True when a subscription is in trial period
optional
lastRenewalDate:number
Last time a subscription was renewed.
optional
platform:IapticPurchasePlatform
Platform this purchase was made on
optional
priceConsentStatus:IapticPriceConsentStatus
Whether or not the user agreed or has been notified of a price change.
productId:
string
Product identifier
optional
purchaseDate:number
Date of first purchase (timestamp).
optional
purchaseId:string
Purchase identifier (optional)
optional
renewalIntent:"Renew"
|"Lapse"
Whether or not the user intends to let the subscription auto-renew.
Possible values:
"Renew"
- The user intends to renew the subscription."Lapse"
- The user intends to let the subscription expire without renewing.
optional
renewalIntentChangeDate:number
Date the renewal intent was updated by the user.
optional
transactionId:string
Identifier of the last transaction (optional)
IapticEventListener<
T
>: (...args
) =>void
Type-safe event listener function
• T extends IapticEventType
...IapticEventMap
[T
]
void
IapticEventType:
"products.updated"
|"purchase.updated"
|"subscription.updated"
|"subscription.renewed"
|"subscription.cancelled"
|"subscription.expired"
|"subscription.changed"
|"pendingPurchase.updated"
|"nonConsumable.updated"
|"nonConsumable.owned"
|"nonConsumable.unowned"
|"consumable.purchased"
|"consumable.refunded"
|"error"
All possible event types that can be listened to.
products.updated
- When any product metadata is updated (title, price, description, etc.)purchase.updated
- When any purchase is updated (subscription, consumable, non-consumable)subscription.updated
- When a subscription is updated (renewed, cancelled, expired, changed)subscription.renewed
- When a subscription is renewedsubscription.cancelled
- When a subscription is cancelledsubscription.expired
- When a subscription is expiredsubscription.changed
- When a subscription is changedpendingPurchase.updated
- When a pending purchase status changesnonConsumable.updated
- When a non-consumable status changes (owned, unowned)nonConsumable.owned
- When a non-consumable purchase is ownednonConsumable.unowned
- When a non-consumable purchase is no longer ownedconsumable.purchased
- When a consumable purchase is purchasedconsumable.refunded
- When a consumable purchase is refundederror
- When an error occurs in the background
IapticPaymentMode:
"PayAsYouGo"
|"UpFront"
|"FreeTrial"
Mode of payment
IapticPendingPurchaseState:
"purchasing"
|"processing"
|"validating"
|"finishing"
|"completed"
|"cancelled"
Status of a purchase being processed.
IapticProductType:
"application"
|"paid subscription"
|"non renewing subscription"
|"consumable"
|"non consumable"
Product types supported by the iaptic validator
IapticRecurrenceMode:
"NON_RECURRING"
|"FINITE_RECURRING"
|"INFINITE_RECURRING"
Type of recurring payment
- FINITE_RECURRING: Payment recurs for a fixed number of billing period set in
paymentPhase.cycles
. - INFINITE_RECURRING: Payment recurs for infinite billing periods unless cancelled.
- NON_RECURRING: A one time charge that does not repeat.
IapticSubscriptionReason:
"renewed"
|"cancelled"
|"expired"
|"changed"
Reason why a subscription status changed
IapticSupportedLocales:
"en"
|"en_uk"
|"en_au"
|"es"
|"fr"
|"de"
|"ja"
|"zh"
|"pt"
List of supported languages.
IapticSubscriptionView(
props
):null
|Element
Subscription modal UI component
Propertis
null
| Element
React Component
<IapticSubscriptionView
entitlementLabels={{
premium: { label: 'Premium Features', detail: 'Unlimited Downloads' },
adFree: { label: 'Ad-Free', detail: 'Remove All Ads While Watching Videos' }
}},
termsUrl="https://example.com/terms"
/>