Overview
Most of the time you’ll want to usepresentUpsell() 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.
iOS
SwiftUI ViewModifier
Attach a paywall to any SwiftUI view using the.triggerUpsell view modifier:
Example with PaywallEventHandlers
Example with PaywallEventHandlers
Explicitly Embedded View
Get the paywall view directly and embed it in your own SwiftUI view hierarchy usingHelium.shared.upsellViewForTrigger:
Example with PaywallEventHandlers
Example with PaywallEventHandlers
Android
Launch from Intent
Create anIntent 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 AndroidContextrequired to create the intent. Usethisin an Activity orLocalContext.currentin a Composable.trigger: The specific paywall trigger you want to display. This is a required parameter.fullscreen: ABooleanto 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 tofalse.disableSystemBackNavigation: ABooleanto control the system back button behavior. Iftrue, the back button will not close the paywall. This is optional and defaults totrue.
- Jetpack Compose
- 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:NavController Integration
If you are using Jetpack Compose withNavController, you can add the paywall to your navigation graph using buildHelium():
Embedded Fragment
You can useHeliumPaywallFragment 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 usingHeliumFlutter.getUpsellWidget: