import {
AppActor,
AppActorAsaOptions,
AppActorPlatformKeys,
AppActorOptions,
AppActorLogLevel,
} from 'appactor-react-native';
AppActor.instance.enableSearchAdsTracking(
new AppActorAsaOptions(true, false, true)
);
await AppActor.instance.configure(
new AppActorPlatformKeys(
'pk_YOUR_IOS_PUBLIC_APP_KEY',
'pk_YOUR_ANDROID_PUBLIC_APP_KEY'
),
{
appUserId: 'user_123',
options: new AppActorOptions(AppActorLogLevel.Debug),
}
);
await AppActor.instance.enableInstallReferrer();
const offerings = await AppActor.instance.getOfferings();
const monthly = offerings.current?.monthly;
if (!monthly) {
throw new Error('No monthly package in the current offering');
}
const result = await AppActor.instance.purchasePackage(monthly, {
placement: 'onboarding_paywall',
});
const info = result.customerInfo ?? (await AppActor.instance.getCustomerInfo());
const isPremium = info.hasActiveEntitlement('premium');