Skip to main content

Overview

Most of the time you’ll want to use presentUpsell() to show paywalls. This approach is covered in each platform’s quickstart guide (see navigation menu on the left). But if you need more control over how and where paywalls appear in your app, there are a few other options.
You’ll need to handle loading states, fallback scenarios, and dismissal logic yourself with these methods. We recommend sticking with presentUpsell() unless you have a specific reason to use these alternatives.

iOS

SwiftUI ViewModifier

Attach a paywall to any SwiftUI view using the .triggerUpsell view modifier:

Explicitly Embedded View

Get the paywall view directly and embed it in your own SwiftUI view hierarchy using Helium.shared.upsellViewForTrigger:
You’ll need to handle presentation and dismissal yourself when using this method. You can handle user dismissal with PaywallEventHandlers.

Android

Launch from Intent

Create an Intent using the createPaywallIntent helper function. This function configures and returns an Intent that can be used to launch the HeliumPaywallActivity. Here are the available options for createPaywallIntent:
  • context: The Android Context required to create the intent. Use this in an Activity or LocalContext.current in a Composable.
  • trigger: The specific paywall trigger you want to display. This is a required parameter.
  • fullscreen: A Boolean to determine if the paywall should be displayed in fullscreen immersive mode, where the system bars (status and navigation) are hidden. This is optional and defaults to false.
  • disableSystemBackNavigation: A Boolean to control the system back button behavior. If true, the back button will not close the paywall. This is optional and defaults to true.
Once you have your intent, you can launch it using either Jetpack Compose or the Android View System:
With Compose you can start the HeliumPaywallActivity using rememberLauncherForActivityResult. This approach allows you to receive a result back from the paywall, such as whether a purchase was successful.Here is an example of how to set it up in your Composable function:
If you are using Jetpack Compose with NavController, you can add the paywall to your navigation graph using buildHelium():
To present a paywall, you can then navigate to the Helium route with a specific trigger:

Embedded Fragment

You can use HeliumPaywallFragment to display a paywall within a fragment container. Use the HeliumPaywallFragment.newInstance() method to create an instance of the fragment with your desired trigger. Then, use the FragmentManager to add it to your view hierarchy.
The newInstance function will return null if the paywall is configured not to show for the current user. You should handle this case by not attempting to show the fragment.

Flutter

Widget Integration

Embed a paywall directly in your widget tree using HeliumFlutter.getUpsellWidget:
You will have to handle your own dismissal. You can do so by passing in PaywallEventHandlers and using the onDismissed handler.