Present a Paywall
Install the SDK
Install the SDK using your preferred package manager:Initialize Helium
Initialize Helium by callinginitialize() early in your app’s lifecycle, typically in your root component:
Show Your First Paywall 🎉
CallpresentUpsell wherever you want to show a full-screen paywall:
Looking for alternative presentation methods? Check out the guide on Ways to Show a Paywall.
Recommended Setup
Here are some common additional steps that you may want to consider.Identifying Users
Identifying users is optional but can help with targeting and when forwarding events to external analytics platforms. If you are not sure, you probably do not need to identify your users.Helium Events
Helium dispatches various events during paywall presentation and purchase flow. You can optionally handle these events in your mobile app. You can also configure Helium to forward them to your existing analytics provider.PaywallEventHandlers
When displaying a paywall you can pass in event handlers to listen for select events:Global Event Listener
You can also listen for all Helium events globally by passingonHeliumPaywallEvent to initialize:
Fallback Paywalls
It is highly recommended that you set up “fallbacks” to handle the rare case when a paywall fails to display. Please follow this guide to do so.Checking Subscription Status & Entitlements
Helium checks entitlements directly through the underlying app store (StoreKit on iOS, Google Play Billing on Android) and provides helper methods to make this easier. Consider checking entitlements to gate premium features.If you have a backend server that manages user entitlements, you may have no use for these helpers.
All Entitlement Helper Methods
All Entitlement Helper Methods
For paywalls that are user-initiated (e.g. “Upgrade to Premium”) and onboarding paywalls, checking entitled status is not recommended. Apps usually want to consistently show a paywall for these locations, and users can still “Restore Purchases” as needed.
Advanced
RevenueCat
By default, Helium will handle purchases for you! This section is typically for users who already use RevenueCat in their app.
Configure Helium to use RevenueCat by passing
createRevenueCatPurchaseConfig to initialize:
RevenueCat appUserID
If you ever change the appUserID of a user, keep Helium in sync with:Custom Purchase Handling
By default, Helium will handle purchases for you! This section is for those who want to implement custom purchase logic.
initialize:
Additional Features
For the full public API and detailed parameter documentation, see the inline docstrings in the SDK source. Import Helium in your project and use your IDE’s autocomplete or jump-to-definition to explore all available methods and types.
Hiding Paywalls Programmatically
Hiding Paywalls Programmatically
You can programmatically hide paywalls using:
Reset Helium
Reset Helium
Reset Helium entirely so you can call initialize again, for example after changing user traits that can affect the paywalls a user might see via targeting.