Skip to main content
To get a better understanding of how paywalls are served, visit here.

Present a Paywall

Install the SDK

The minimum version of Flutter supported by this SDK is 3.24.0.
To add the Helium package, run:
Or if you prefer, you can add the helium_flutter package to your pubspec.yaml:
then run:
Recommended - Make sure that Swift Package Manager support is enabled:
See this Flutter documentation for more details about Swift Package Manager.
You can still use Cocoapods for your dependencies if preferred. If you need to disable Swift Package Manager dependencies after having enabled it, refer to that same Flutter documentation.

iOS Settings

Helium requires iOS 15+. If your app already has a minimum of iOS 15 or higher, you’re all set. This can be specified in your ios/Podfile with:
If you still see errors related to minimum iOS version, consider updating to 15.0 or higher directly in the Xcode project.

Initialize Helium

Find your API key here. If you do not have a Helium account set up yet, you can still integrate but will not be able to show a real paywall.
In your app’s initialization code (typically in main.dart or your root widget):
initialize
method

Show Your First Paywall 🎉

Set up a trigger and workflow in the dashboard to show your desired paywall. Create unique triggers for each location a paywall can show in your app! This provides more flexibility with paywall variation and experiments, allowing you to take full advantage of Helium.
Call presentUpsell wherever you want to show a full-screen paywall:
Do not call presentUpsell in Widget build() as this can have unpredictable behavior.
You should now be able to see Helium paywalls in your app! Well done! 🎉
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.
Identify users as early as you can to maximize consistency in metrics and targeting. Ideally in your initialize call!

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 implementing HeliumCallbacks and passing it to initialize:
For example:
Then pass it 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.
Do this after you have a paywall created that you want to use in production.

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.
Called on a HeliumFlutter instance:
If you want to check entitlement status before presenting a paywall, here are a couple of ways to do so.
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.
Helium integrates seamlessly with RevenueCat so you can continue to let RevenueCat handle your purchases and entitlements.

Install HeliumRevenueCat

Add the helium_revenuecat package alongside helium_flutter:

Configure Helium to use RevenueCat for Purchases

Use the built-in RevenueCatPurchaseDelegate:
Make sure to configure RevenueCat before initializing Helium.

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.
Implement HeliumPurchaseDelegate and pass it to 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.
In most cases there is no need to check download status. Helium will display a loading indication if a paywall is presented before download has completed.
You can listen to the status of the paywalls download via a stream:
The download status will be one of the following:
  • notDownloadedYet: The download has not been initiated.
  • inProgress: The download is in progress.
  • downloadSuccess: The download was successful.
  • downloadFailure: The download failed.
You can also check if paywalls have been downloaded with await heliumFlutter.paywallsLoaded()
You can programmatically hide paywalls using:
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.