Superwall

SuperwallOptions

Options for configuring the Superwall SDK.

Deprecated SDK

We strongly recommend migrating to the new Superwall Expo SDK, see our migration guide for details.

Purpose

Options for configuring the Superwall SDK. Use this to customize the appearance and behavior of paywalls, logging, and other SDK features.

Signature

export class SuperwallOptions {
  paywalls: PaywallOptions = new PaywallOptions()
  networkEnvironment: NetworkEnvironment = NetworkEnvironment.Release
  isExternalDataCollectionEnabled = true
  localeIdentifier?: string
  isGameControllerEnabled = false
  logging: LoggingOptions = new LoggingOptions()
  collectAdServicesAttribution = false
  passIdentifiersToPlayStore = false
  storeKitVersion?: "STOREKIT1" | "STOREKIT2"
  enableExperimentalDeviceVariables = false
}

Properties

PropertyTypeDescription
paywallsPaywallOptionsOptions for configuring paywall appearance and behavior. See PaywallOptions for details.
networkEnvironmentNetworkEnvironmentThe network environment to use. Options: Release, ReleaseCandidate, Developer. Defaults to Release.
isExternalDataCollectionEnabledbooleanWhether external data collection is enabled. Defaults to true.
localeIdentifierstring?The locale identifier to use. If not set, the system locale is used.
isGameControllerEnabledbooleanWhether game controller support is enabled. Defaults to false.
loggingLoggingOptionsOptions for configuring logging behavior. Must be an instance of LoggingOptions so toJson() is available.
collectAdServicesAttributionbooleanWhether to collect AdServices attribution data. Defaults to false.
passIdentifiersToPlayStorebooleanWhether to pass identifiers to Play Store. Defaults to false.
storeKitVersion"STOREKIT1" | "STOREKIT2"?The StoreKit version to use (iOS only). Defaults to undefined (auto-detect).
enableExperimentalDeviceVariablesbooleanWhether to enable experimental device variables. Defaults to false.

Usage

Create options when configuring the SDK:

import { SuperwallOptions, PaywallOptions, LoggingOptions, NetworkEnvironment, LogLevel, LogScope } from "@superwall/react-native-superwall"

// Build logging options (must be an instance so toJson exists)
const logging = new LoggingOptions()
logging.level = LogLevel.Debug
logging.scopes = [LogScope.All]

// Build paywall options (set properties after construction)
const paywalls = new PaywallOptions()
paywalls.shouldShowPurchaseFailureAlert = false
paywalls.isHapticFeedbackEnabled = true

const options = new SuperwallOptions({
  networkEnvironment: NetworkEnvironment.Developer,
  isExternalDataCollectionEnabled: true,
  localeIdentifier: "en_US",
  logging,
  paywalls
})

await Superwall.configure({
  apiKey: "pk_your_api_key",
  options: options
})

Network Environment

Use different network environments for different build configurations:

// Development builds
const devOptions = new SuperwallOptions({
  networkEnvironment: NetworkEnvironment.Developer
})

// Release candidate builds
const rcOptions = new SuperwallOptions({
  networkEnvironment: NetworkEnvironment.ReleaseCandidate
})

// Production builds
const prodOptions = new SuperwallOptions({
  networkEnvironment: NetworkEnvironment.Release
})

How is this guide?

Edit on GitHub