Skip to main content

Background

Get set up with the Helium SDK for iOS. Reach out over your Helium slack channel or email founders@tryhelium.com for any questions.

Installation

Version 4.x.x of the iOS SDK just released on 1/27/26. To migrate from v3, view the migration guide. You can also view the v3 guide here.
Helium requires a minimum deployment target of iOS 15 and Xcode 14+. (Latest Xcode is recommended.)
We recommend using Swift Package Manager (SPM), but if your project primarily uses Cocoapods it might make sense to install the Helium Cocoapod instead.
  1. In Xcode, navigate to your project’s Package Dependencies: Spm Add Pn
  2. Click the + button and search for the Helium package URL:
    For Dependency Rule we recommend the default Up to Next Major Version to make sure you get non-breaking bug fixes. View the list of releases here.
  3. Click Add Package.
  4. In the dialog that appears, make sure to add the Helium product to your app’s main target: Spm Target Pn
  5. Select Add Package in the dialog and Helium should now be ready for import.
  6. (Optional) If you are using RevenueCat to manage purchases, you’ll need to add the HeliumRevenueCat package separately. This is a separate package from the core Helium SDK:
    • Click the + button again and add:
    • Add the HeliumRevenueCat product to your app’s main target.
    • This enables the RevenueCatDelegate referenced in the Purchase Handling section of this guide.
The HeliumRevenueCat package includes purchases-ios-spm as a dependency, not purchases-ios and you may encounter build issues if you are using purchases-ios with SPM. (We recommend just switching to purchases-ios-spm).

Initialize Helium

Find your API key here
Initialize the Helium SDK as early as possible in your app’s lifecycle.
Choose the appropriate location based on your app’s architecture:
And add necessary imports:
Helium’s initialization is ran on a background thread, so you don’t have to worry about it affecting your app’s launch time.

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 right before you call Helium.shared.initialize!
Set a custom user ID
Set RevenueCat app user ID (if using RevenueCat)
If you use a custom appAccountToken
Set custom user traits for targeting and analytics visibility

Presenting Paywalls

You must have a trigger and workflow configured in the dashboard in order to show a paywall.
Call presentPaywall when you want to show a full-screen paywall. For example:
Helium.shared.presentPaywall
method
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.

PaywallEventHandlers

When displaying a paywall you can pass in event handlers to listen for relevant Helium Events. You can chain a subset of handlers with builder syntax:

Purchase Handling

By default, Helium will handle purchases for you! This section is for those who want to delegate purchases to RevenueCat or implement custom purchase logic.
Use one of our pre-built HeliumPurchaseDelegate implementations or create a custom delegate. Pass the delegate in to your Helium.shared.initialize call.
The StoreKitDelegate (default delegate) handles purchases using native StoreKit 2:
Want to add some custom behavior but still use the built-in purchase logic? Just subclass StoreKitDelegate or RevenueCatDelegate! (Be sure to make a super call for any overridden methods.)

Listen for Helium Events

Helium Events are emitted by Helium for various paywall actions, purchase completions, and more. Options to listen for these events include:

1. Add a HeliumEventListener

Listeners are held weakly to prevent memory leaks. If you don’t maintain a strong reference to your listener, it will be deallocated immediately and no events will fire.

2. Use PaywallEventHandlers for paywall-specific events

See the section titled PaywallEventHandlers on this page.

Checking Subscription Status & Entitlements

If you use an external payment processor like Stripe, Helium’s entitlement helpers may not be reliable. We recommend implementing your own entitlement checking in that case. If you use Stripe with RevenueCat, we recommend using RevenueCat’s entitlement APIs instead.
The Helium SDK provides several ways to check user entitlements and subscription status.
hasAny() Checks if the user has purchased any subscription or non-consumable product.hasAnyActiveSubscription() Checks if the user has any active subscription.hasEntitlementForPaywall(trigger: String, considerAssociatedSubscriptions: Bool = false) Checks if the user has entitlements for any product in a specific paywall. Returns nil if paywall configuration hasn’t been downloaded yet.hasActiveEntitlementFor(productId: String) Checks if the user has entitlement to a specific product.hasActiveSubscriptionFor(productId: String) Checks if the user has an active subscription for a specific product.hasActiveSubscriptionFor(subscriptionGroupID: String) Checks if the user has an active subscription in a specific subscription group.purchasedProductIds() Retrieves a list of all product IDs the user currently has access to.activeSubscriptions() Returns detailed information about all active auto-renewing subscriptions.subscriptionStatusFor(productId: String) Gets detailed subscription status for a specific product, including state information like subscribed, expired, or in grace period.subscriptionStatusFor(subscriptionGroupID: String) Gets detailed subscription status for a specific subscription group.

Example Usage

Check entitlements before showing paywalls to avoid showing a paywall to a user who should not see it.

Fallbacks

It is highly recommended that you set up a fallbacks in the uncommon case where a paywall fails to display. Please follow the linked guide to do so. Note that if you attempt to display a paywall while it is still being downloaded, a loading state will show. By default, Helium will show this loading state as needed (a shimmer view for up to 7 seconds). You can configure this loading state during presentation or set global values.
If the budget expires before the paywall is ready, a fallback paywall will show if available otherwise the loading state will hide and a PaywallOpenFailed event will be dispatched.
See the Fallbacks Guide for more details on downloading and configuring fallbacks.

Advanced

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 check the status of the paywall configuration download using the Helium.shared.getDownloadStatus() method. This method returns a value of type HeliumFetchedConfigStatus, which is defined as follows:
You can also simply check if paywalls have been successfully downloaded with Helium.shared.paywallsLoaded().
Retrieve basic information about the paywall for a specific trigger with Helium.shared.getPaywallInfo(trigger: String) which returns:
This method can be used if you want to be certain that a paywall is ready for display before displaying.
You can programmatically hide paywalls using:
Reset Helium entirely so you can call initialize again. Only for advanced use cases.