Overview
SuperwallProvider is the main provider component for the Superwall SDK. It initializes the SDK with your API key and configuration options, and should wrap the root of your application or the part of your app that requires Superwall functionality.
The provider sets up necessary event listeners, handles deep linking, and manages the SDK configuration lifecycle.
Props
Your Superwall API keys for each platform
Optional configuration options passed to the native SDK. See SuperwallOptions for full details.Common options include:
paywalls: Paywall appearance and behavior settingslogging: SDK logging configurationnetworkEnvironment: “release” | “releaseCandidate” | “developer”manualPurchaseManagement: Enable custom purchase handling
Optional callback invoked when SDK configuration fails. Use this to:
- Track errors in your analytics service
- Show custom error UI to users
- Implement retry logic
- Log failures for debugging
Your app content that will have access to Superwall features
Basic Usage
With Loading States
Combine withSuperwallLoading and SuperwallLoaded components to manage initialization states:
With Error Handling
Handle configuration errors using theonConfigurationError callback and SuperwallError component:
With Custom Options
Configure SDK behavior with custom options:Key Features
Automatic Deep Link Handling
The provider automatically sets up deep link listeners for Superwall functionality. It filters out Expo-specific deep links and platform URLs to avoid conflicts.Configuration Lifecycle
The provider manages the SDK configuration lifecycle:- Checks if already configured to avoid re-initialization
- Validates API key for current platform
- Configures SDK with provided options
- Handles configuration errors gracefully
- Notifies error callback if configuration fails
Event Listener Setup
Automatically initializes native event listeners for:- Paywall presentation and dismissal
- Subscription status changes
- Custom paywall actions
- Deep link handling
The provider must wrap all components that use Superwall hooks like
useUser, usePlacement, or useSuperwall.See Also
- SuperwallLoading - Display loading UI during initialization
- SuperwallLoaded - Render content when SDK is ready
- SuperwallError - Handle configuration errors
- SuperwallOptions - Configuration options reference