appactor_flutter 0.0.23
appactor_flutter: ^0.0.23 copied to clipboard
AppActor Flutter SDK — server-authoritative in-app purchase management for iOS and Android.
AppActor
In-App Purchase Infrastructure
for Flutter
AppActor handles in-app purchases, subscriptions, and entitlements so you can focus on building your app. One SDK for both iOS and Android.
Installation #
dependencies:
appactor_flutter: ^0.0.17
Quick Start #
import 'package:appactor_flutter/appactor_flutter.dart';
// Configure once. This returns after the native bootstrap flow completes.
await AppActor.instance.configure(
'pk_YOUR_API_KEY',
// Optional: pass appUserId to start with an explicit identity.
// Omit it to reuse a cached ID or create a new anonymous user.
appUserId: 'user_123',
);
// Fetch offerings
final offerings = await AppActor.instance.getOfferings();
// Make a purchase
final result = await AppActor.instance.purchasePackage(
offerings.current!.monthly!,
placement: 'onboarding_paywall',
);
// Optional quantity must be at least 1. Android supports only quantity 1;
// higher quantities are rejected by the native bridge.
// Optional placement is omitted when null or blank.
// Check entitlements
final info = await AppActor.instance.getCustomerInfo();
final isPremium = info.hasActiveEntitlement('premium');
Customer Attributes #
await AppActor.instance.setAttributes({
'favorite_category': 'watch_faces',
'signup_source': const AppActorAttributeValue.string('spring_campaign'),
'last_seen': AppActorAttributeValue.dateTime(DateTime.now()),
'feature_flags': const AppActorAttributeValue.boolList([true, false]),
});
await AppActor.instance.setEmail('user@example.com');
await AppActor.instance.setDisplayName('Ada Lovelace');
await AppActor.instance.setIntegrationIdentifier(
AppActorIntegrationIdentifier.appsFlyerId,
'af-user-123',
);
await AppActor.instance.setAdjustID('adjust-user-123');
await AppActor.instance.setMediaSource('facebook');
await AppActor.instance.setCampaign('spring_sale');
await AppActor.instance.setCampaign(null); // Clear a helper field.
setAttribute() and setAttributes() are for developer-defined custom
attributes only. Custom keys cannot use $, appactor., or integration.
reserved prefixes. DateTime values are sent as a typed date envelope, boolean
arrays are supported, and null values are rejected; call
unsetAttribute(key) to remove a custom attribute.
Profile helpers such as setEmail(), setDisplayName(), setPhoneNumber(),
and setPushToken() use native reserved profile routes. Native iOS/Android
automatically send privacy-safe SDK/device context during configure(), such
as platform, app version, SDK version, device model, bundle/package ID, locale,
and timezone. collectDeviceIdentifiers() remains opt-in for additional
identifiers.
Integration identifiers and attribution are separate surfaces. Use
setIntegrationIdentifier() / provider helpers for external user or device IDs,
and use updateAttribution() / setMediaSource() / setCampaign() /
setAdGroup() / setAd() / setKeyword() / setCreative() for campaign
context. Passing null to an attribution convenience helper clears that helper
field through the native attribution route.
Purchase Sync #
// Quiet store sync without draining the local receipt queue.
final refreshed = await AppActor.instance.syncPurchases();
// Deprecated alias for syncPurchases().
final quiet = await AppActor.instance.quietSyncPurchases();
// Explicit queue-drain API exposed by the native plugins.
final drained = await AppActor.instance.drainReceiptQueueAndRefreshCustomer();
Platform Notes #
configure()returns after the native SDK finishes bootstrap.- Pass
appUserId:toconfigure()if you want to start with a known user ID. - Call
enableSearchAdsTracking()beforeconfigure()if you use Apple Search Ads attribution on iOS. - Call
enableInstallReferrer()afterconfigure()if you want Google Play Install Referrer support on Android. - iOS-only APIs such as
presentOfferCodeRedeemSheet(),getAsaDiagnostics(), andpurchaseFromIntent()throwUnsupportedErroron non-iOS platforms.
Documentation #
Visit appactor.com/docs for full documentation.
Contributing #
- Open an issue for bug reports or feature requests
- Email us at sdk@appactor.com
License #
MIT License. See LICENSE for details.