# Superwall
Source: https://superwall.com/docs/react-native/sdk-reference/Superwall
The shared instance of Superwall that provides access to all SDK features.
**Deprecated SDK**
We strongly recommend migrating to the new [Superwall Expo SDK](/expo), see our [migration guide](/expo/guides/migrating-react-native) for details.
You must call [`configure()`](/react-native/sdk-reference/configure) before accessing `Superwall.shared`, otherwise your app may crash or behave unexpectedly.
## Purpose
Provides access to the configured Superwall instance after calling [`configure()`](/react-native/sdk-reference/configure).
## Signature
```typescript
static get shared(): Superwall
```
## Parameters
This is a static property with no parameters.
## Returns / State
Returns the shared `Superwall` instance that was configured via [`configure()`](/react-native/sdk-reference/configure).
## Usage
Configure first (typically in your app's entry point):
```typescript
import Superwall from "@superwall/react-native-superwall"
await Superwall.configure({
apiKey: "pk_your_api_key"
})
```
Then access throughout your app:
```typescript
Superwall.shared.register({
placement: "feature_access",
feature: () => {
// Feature code here
}
})
```
Set user identity and attributes:
```typescript
await Superwall.shared.identify({
userId: "user123"
})
await Superwall.shared.setUserAttributes({
plan: "premium",
signUpDate: new Date()
})
```
Reset the user:
```typescript
await Superwall.shared.reset()
```
Avoid calling `Superwall.shared.reset()` repeatedly. Resetting rotates the anonymous user ID, clears local paywall assignments, and requires the SDK to re-download configuration state. Only trigger a reset when a user explicitly logs out or you intentionally need to forget their identity.
Set delegate:
```typescript
import { SuperwallDelegate } from "@superwall/react-native-superwall"
class MyDelegate extends SuperwallDelegate {
subscriptionStatusDidChange(from, to) {
console.log(`Subscription status changed from ${from} to ${to}`)
}
}
await Superwall.shared.setDelegate(new MyDelegate())
```
## Main Methods
* [`register()`](/react-native/sdk-reference/register) - Register a placement to trigger paywalls
* [`identify()`](/react-native/sdk-reference/identify) - Identify a user
* [`getUserAttributes()`](/react-native/sdk-reference/getUserAttributes) - Get user attributes
* [`setUserAttributes()`](/react-native/sdk-reference/setUserAttributes) - Set user attributes
* [`handleDeepLink()`](/react-native/sdk-reference/handleDeepLink) - Handle deep links
* [`getSubscriptionStatus()`](/react-native/sdk-reference/subscriptionStatus) - Get subscription status
* [`setSubscriptionStatus()`](/react-native/sdk-reference/subscriptionStatus) - Set subscription status
---
# PurchaseController
Source: https://superwall.com/docs/react-native/sdk-reference/PurchaseController
An abstract class that defines the contract for a purchase controller.
**Deprecated SDK**
We strongly recommend migrating to the new [Superwall Expo SDK](/expo), see our [migration guide](/expo/guides/migrating-react-native) for details.
## Purpose
Abstract class that defines the contract for a purchase controller. This is used for custom purchase handling when you want to manage all subscription-related logic yourself.
## Signature
```typescript
export abstract class PurchaseController {
abstract purchaseFromAppStore(productId: string): Promise
abstract purchaseFromGooglePlay(
productId: string,
basePlanId?: string,
offerId?: string
): Promise
abstract restorePurchases(): Promise
}
```
## Methods
| Name | Type | Description | Required |
| ---------------------- | -------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | -------- |
| purchaseFromAppStore | productId: string | Purchase a product from the App Store. Returns a Promise that resolves with the result of the purchase logic. | yes |
| purchaseFromGooglePlay | productId: string, basePlanId?: string, offerId?: string | Purchase a product from Google Play. Returns a Promise that resolves with the result of the purchase logic. | yes |
| restorePurchases | None | Restore purchases. Returns a Promise that resolves with the restoration result. | yes |
## Usage
Implement the `PurchaseController` class:
```typescript
import { PurchaseController, PurchaseResult, RestorationResult, PurchaseResultCancelled, PurchaseResultFailed, PurchaseResultPurchased } from "@superwall/react-native-superwall"
class MyPurchaseController extends PurchaseController {
async purchaseFromAppStore(productId: string): Promise {
try {
// Your iOS purchase logic here
// For example, using RevenueCat:
const purchase = await Purchases.purchaseProduct(productId)
if (purchase.customerInfo.entitlements.active["pro"]) {
return new PurchaseResultPurchased()
} else {
return new PurchaseResultFailed("Purchase completed but entitlement not active")
}
} catch (error) {
if (error.userCancelled) {
return new PurchaseResultCancelled()
}
return new PurchaseResultFailed(error.message)
}
}
async purchaseFromGooglePlay(
productId: string,
basePlanId?: string,
offerId?: string
): Promise {
try {
// Your Android purchase logic here
// For example, using RevenueCat:
const purchase = await Purchases.purchaseProduct(productId)
if (purchase.customerInfo.entitlements.active["pro"]) {
return new PurchaseResultPurchased()
} else {
return new PurchaseResultFailed("Purchase completed but entitlement not active")
}
} catch (error) {
if (error.userCancelled) {
return new PurchaseResultCancelled()
}
return new PurchaseResultFailed(error.message)
}
}
async restorePurchases(): Promise {
try {
// Your restore logic here
// For example, using RevenueCat:
const customerInfo = await Purchases.restorePurchases()
if (customerInfo.entitlements.active["pro"]) {
return RestorationResult.restored()
} else {
return RestorationResult.failed("No active subscription found")
}
} catch (error) {
return RestorationResult.failed(error.message)
}
}
}
```
Configure Superwall with your purchase controller:
```typescript
await Superwall.configure({
apiKey: "pk_your_api_key",
purchaseController: new MyPurchaseController()
})
```
## Important Notes
* When using a `PurchaseController`, you must call [`setSubscriptionStatus()`](/react-native/sdk-reference/subscriptionStatus) whenever the user's entitlements change.
* The purchase controller is responsible for handling all purchase and restore logic.
* You can use third-party services like RevenueCat, Stripe, or your own backend to handle purchases.
## Related
* [`setSubscriptionStatus()`](/react-native/sdk-reference/subscriptionStatus) - Update subscription status after purchases
* [`SuperwallDelegate.subscriptionStatusDidChange`](/react-native/sdk-reference/SuperwallDelegate) - Receive subscription status change notifications
---
# PaywallOptions
Source: https://superwall.com/docs/react-native/sdk-reference/PaywallOptions
Options for configuring the appearance and behavior of paywalls.
**Deprecated SDK**
We strongly recommend migrating to the new [Superwall Expo SDK](/expo), see our [migration guide](/expo/guides/migrating-react-native) for details.
## Purpose
Options for configuring the appearance and behavior of paywalls. Use this to customize how paywalls are presented and how purchase failures are handled.
`PaywallOptions` (and its `RestoreFailed` helper) do not take constructor arguments. Create an instance, then set properties directly.
## Signature
```typescript
export class PaywallOptions {
isHapticFeedbackEnabled = true
restoreFailed: RestoreFailed = new RestoreFailed()
shouldShowPurchaseFailureAlert = true
shouldPreload = false
automaticallyDismiss = true
transactionBackgroundView: TransactionBackgroundView = TransactionBackgroundView.spinner
}
```
## Properties
| Name | Type | Description | Default | Required |
| ------------------------------ | ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | ------- | -------- |
| isHapticFeedbackEnabled | boolean | Whether haptic feedback is enabled when interacting with paywalls. | true | no |
| restoreFailed | RestoreFailed | Configuration for the alert shown when restore purchases fails. | | yes |
| shouldShowPurchaseFailureAlert | boolean | Whether to show an alert when a purchase fails. | true | no |
| shouldPreload | boolean | Whether paywalls should be preloaded. If \`false\`, you can manually preload using \`preloadAllPaywalls()\` or \`preloadPaywalls()\`. | false | no |
| automaticallyDismiss | boolean | Whether paywalls should automatically dismiss after a successful purchase. | true | no |
| transactionBackgroundView | TransactionBackgroundView | The view to show behind Apple's payment sheet during a transaction. Options: \`spinner\`, \`none\`. | spinner | no |
## Usage
Create paywall options:
```typescript
import { PaywallOptions, TransactionBackgroundView, RestoreFailed } from "@superwall/react-native-superwall"
const paywallOptions = new PaywallOptions()
paywallOptions.isHapticFeedbackEnabled = true
paywallOptions.shouldShowPurchaseFailureAlert = false
paywallOptions.shouldPreload = true
paywallOptions.automaticallyDismiss = true
paywallOptions.transactionBackgroundView = TransactionBackgroundView.spinner
const restoreFailed = new RestoreFailed()
restoreFailed.title = "No Subscription Found"
restoreFailed.message = "We couldn't find an active subscription for your account."
restoreFailed.closeButtonTitle = "Okay"
paywallOptions.restoreFailed = restoreFailed
const superwallOptions = new SuperwallOptions({
paywalls: paywallOptions
})
await Superwall.configure({
apiKey: "pk_your_api_key",
options: superwallOptions
})
```
## RestoreFailed
Customize the alert shown when restore purchases fails:
```typescript
const restoreFailed = new RestoreFailed()
restoreFailed.title = "No Subscription Found"
restoreFailed.message = "We couldn't find an active subscription for your account."
restoreFailed.closeButtonTitle = "Okay"
const paywallOptions = new PaywallOptions()
paywallOptions.restoreFailed = restoreFailed
```
## Transaction Background View
Control what appears behind Apple's payment sheet:
```typescript
// Show a spinner (default)
const options1 = new PaywallOptions({
transactionBackgroundView: TransactionBackgroundView.spinner
})
// Show nothing
const options2 = new PaywallOptions({
transactionBackgroundView: TransactionBackgroundView.none
})
```
## Related
* [`SuperwallOptions`](/react-native/sdk-reference/SuperwallOptions) - Main SDK configuration options
* [`preloadAllPaywalls()`](/react-native/sdk-reference/Superwall) - Manually preload all paywalls
* [`preloadPaywalls()`](/react-native/sdk-reference/Superwall) - Manually preload specific paywalls
---
# register()
Source: https://superwall.com/docs/react-native/sdk-reference/register
A function that registers a placement that can be remotely configured to show a paywall and gate feature access.
**Deprecated SDK**
We strongly recommend migrating to the new [Superwall Expo SDK](/expo), see our [migration guide](/expo/guides/migrating-react-native) for details.
## Purpose
Registers a placement so that when it's added to a campaign on the Superwall Dashboard, it can trigger a paywall and optionally gate access to a feature.
## Signature
```typescript
async register(params: {
placement: string
params?: Map | Record
handler?: PaywallPresentationHandler
feature?: () => void
}): Promise
```
## Parameters
| Name | Type | Description | Default | Required |
| --------- | ------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------- | -------- |
| placement | string | The name of the placement you wish to register. | | yes |
| params | Map\ \| Record\? | Optional parameters to pass with your placement. These can be referenced within audience filters in your campaign. Keys beginning with \`$\` are reserved for Superwall and will be dropped. Arrays and dictionaries as values are not supported and will be omitted. | undefined | no |
| handler | PaywallPresentationHandler? | A handler whose functions provide status updates for the paywall lifecycle. | undefined | no |
| feature | (() => void)? | An optional completion callback representing the gated feature. It is executed based on the paywall's gating mode: called immediately for \*\*Non-Gated\*\*, called after the user subscribes or if already subscribed for \*\*Gated\*\*. If not provided, you can chain a \`.then()\` block to the returned promise. | | no |
## Returns / State
Returns a Promise that resolves when registration completes. If you supply a `feature` callback, it will be executed according to the paywall's gating configuration, as described above.
## Usage
With feature callback:
```typescript
Superwall.shared.register({
placement: "premium_feature",
params: {
source: "onboarding"
},
feature: () => {
// Code that unlocks the premium feature
openPremiumScreen()
}
})
```
Using promise chaining:
```typescript
await Superwall.shared.register({
placement: "premium_feature",
params: {
source: "onboarding"
}
}).then(() => {
// Code that unlocks the premium feature
openPremiumScreen()
})
```
With presentation handler:
```typescript
import { PaywallPresentationHandler } from "@superwall/react-native-superwall"
const handler = new PaywallPresentationHandler()
handler.onPresent((info) => {
console.log("Paywall presented:", info.name)
})
handler.onDismiss((info, result) => {
console.log("Paywall dismissed:", result)
})
Superwall.shared.register({
placement: "onboarding_complete",
params: {
source: "onboarding"
},
handler: handler
})
```
## Behavior
This behavior is remotely configurable via the Superwall Dashboard:
* For **Non-Gated** paywalls, the feature callback is executed when the paywall is dismissed or if the user is already paying.
* For **Gated** paywalls, the feature callback is executed only if the user is already paying or if they begin paying.
* If no paywall is configured, the feature callback is executed immediately.
* If no feature callback is provided, the returned promise resolves when registration completes.
* If a feature callback is provided, the returned promise always resolves after the feature callback is executed.
Note: The feature callback will not be executed if an error occurs during registration. Such errors can be detected via the `handler`.
---
# Subscription Status
Source: https://superwall.com/docs/react-native/sdk-reference/subscriptionStatus
Methods for getting and setting the user's subscription status.
**Deprecated SDK**
We strongly recommend migrating to the new [Superwall Expo SDK](/expo), see our [migration guide](/expo/guides/migrating-react-native) for details.
## Purpose
Methods for managing the user's subscription status. When using a `PurchaseController`, you must call `setSubscriptionStatus()` to update the user's subscription status whenever entitlements change.
## Methods
### getSubscriptionStatus()
Retrieves the current subscription status of the user.
**Signature:**
```typescript
async getSubscriptionStatus(): Promise
```
**Returns:** A Promise that resolves to the current `SubscriptionStatus`.
**Usage:**
```typescript
const status = await Superwall.shared.getSubscriptionStatus()
console.log("Subscription status:", status)
```
### setSubscriptionStatus()
Sets the subscription status of the user. When using a `PurchaseController`, you must call this method to update the user's subscription status. Alternatively, you can implement the [`SuperwallDelegate.subscriptionStatusDidChange`](/react-native/sdk-reference/SuperwallDelegate) delegate callback to receive notifications whenever the subscription status changes.
**Signature:**
```typescript
async setSubscriptionStatus(status: SubscriptionStatus): Promise
```
**Parameters:**
| Name | Type | Description | Required |
| ------ | ------------------ | ---------------------------- | -------- |
| status | SubscriptionStatus | The new subscription status. | yes |
**Returns:** A Promise that resolves once the subscription status has been updated.
**Usage:**
```typescript
import { SubscriptionStatus } from "@superwall/react-native-superwall"
// Set active subscription with entitlements
const activeStatus = SubscriptionStatus.Active(["pro"])
await Superwall.shared.setSubscriptionStatus(activeStatus)
// Set inactive subscription
const inactiveStatus = SubscriptionStatus.Inactive()
await Superwall.shared.setSubscriptionStatus(inactiveStatus)
```
## SubscriptionStatus Type
The `SubscriptionStatus` type represents the user's subscription state:
* `SubscriptionStatus.Active(entitlements: string[] \| Entitlement[])` - User has an active subscription with the specified entitlements
* `SubscriptionStatus.Inactive()` - User does not have an active subscription
* `SubscriptionStatus.Unknown()` - Subscription status is unknown
## When to Update
* After a successful purchase
* After a purchase restoration
* When a subscription expires
* When a subscription is cancelled
* On app launch (to sync with your backend)
## Related
* [`PurchaseController`](/react-native/sdk-reference/PurchaseController) - Handle purchases and update subscription status
* [`SuperwallDelegate`](/react-native/sdk-reference/SuperwallDelegate) - Receive subscription status change notifications
---
# identify()
Source: https://superwall.com/docs/react-native/sdk-reference/identify
Creates an account with Superwall by linking the provided userId to Superwall's automatically generated alias.
**Deprecated SDK**
We strongly recommend migrating to the new [Superwall Expo SDK](/expo), see our [migration guide](/expo/guides/migrating-react-native) for details.
## Purpose
Creates an account with Superwall by linking the provided `userId` to Superwall's automatically generated alias. Call this function as soon as you have a valid `userId`.
## Signature
```typescript
async identify({
userId,
options,
}: {
userId: string
options?: IdentityOptions
}): Promise
```
## Parameters
| Name | Type | Description | Default | Required |
| ------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------- | -------- |
| userId | string | Your user's unique identifier as defined by your backend system. | | yes |
| options | IdentityOptions? | An optional \`IdentityOptions\` object. You can set the \`restorePaywallAssignments\` property to \`true\` to instruct the SDK to wait to restore paywall assignments from the server before presenting any paywalls. This option should be used only in advanced cases (e.g., when users frequently switch accounts or reinstall the app). | undefined | no |
## Returns / State
Returns a Promise that resolves once the identification process is complete.
## Usage
Basic identification:
```typescript
await Superwall.shared.identify({
userId: "user123"
})
```
With options to restore paywall assignments:
```typescript
import { IdentityOptions } from "@superwall/react-native-superwall"
const options = new IdentityOptions()
options.restorePaywallAssignments = true
await Superwall.shared.identify({
userId: "user123",
options: options
})
```
## When to Call
Call `identify()` as soon as you have a valid `userId` in your app. This is typically:
* After user login
* After user registration
* When restoring a previous session
* On app launch if the user is already logged in
## Related
* [`reset()`](/react-native/sdk-reference/Superwall) - Reset the user identity
* [`setUserAttributes()`](/react-native/sdk-reference/setUserAttributes) - Set user attributes after identification
---
# configure()
Source: https://superwall.com/docs/react-native/sdk-reference/configure
A static function that configures a shared instance of Superwall for use throughout your app.
**Deprecated SDK**
We strongly recommend migrating to the new [Superwall Expo SDK](/expo), see our [migration guide](/expo/guides/migrating-react-native) for details.
This is a static method called on the `Superwall` class itself, not on the shared instance.
## Purpose
Configures the shared instance of Superwall with your API key and optional configurations, making it ready for use throughout your app.
## Signature
```typescript
static async configure({
apiKey,
options,
purchaseController,
completion,
}: {
apiKey: string
options?: SuperwallOptions
purchaseController?: PurchaseController
completion?: () => void
}): Promise
```
## Parameters
| Name | Type | Description | Default | Required |
| ------------------ | -------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | --------- | -------- |
| apiKey | string | Your Public API Key from the Superwall dashboard settings. | | yes |
| options | SuperwallOptions? (see /react-native/sdk-reference/SuperwallOptions) | Optional configuration object for customizing paywall appearance and behavior. | undefined | no |
| purchaseController | PurchaseController? | Optional object for handling all subscription-related logic yourself. If omitted, Superwall handles subscription logic. | undefined | no |
| completion | (() => void)? | Optional completion handler called when Superwall finishes configuring. | undefined | no |
## Returns / State
Returns a Promise that resolves to the configured `Superwall` instance. The instance is also accessible via [`Superwall.shared`](/react-native/sdk-reference/Superwall).
## Usage
Basic configuration:
```typescript
import Superwall from "@superwall/react-native-superwall"
await Superwall.configure({
apiKey: "pk_your_api_key"
})
```
With custom options:
```typescript
import Superwall, { SuperwallOptions } from "@superwall/react-native-superwall"
const options = new SuperwallOptions({
paywalls: {
shouldShowPurchaseFailureAlert: false
}
})
await Superwall.configure({
apiKey: "pk_your_api_key",
options: options,
completion: () => {
console.log("Superwall configured successfully")
}
})
```
With custom purchase controller:
```typescript
import Superwall, { PurchaseController } from "@superwall/react-native-superwall"
class MyPurchaseController extends PurchaseController {
async purchaseFromAppStore(productId: string): Promise {
// Your purchase logic
}
async purchaseFromGooglePlay(productId: string, basePlanId?: string, offerId?: string): Promise {
// Your purchase logic
}
async restorePurchases(): Promise {
// Your restore logic
}
}
await Superwall.configure({
apiKey: "pk_your_api_key",
purchaseController: new MyPurchaseController()
})
```
---
# PaywallPresentationHandler
Source: https://superwall.com/docs/react-native/sdk-reference/PaywallPresentationHandler
Handles events related to paywall presentation.
**Deprecated SDK**
We strongly recommend migrating to the new [Superwall Expo SDK](/expo), see our [migration guide](/expo/guides/migrating-react-native) for details.
## Purpose
Handles events related to paywall presentation. Use this to receive callbacks about the paywall lifecycle when registering a placement.
## Signature
```typescript
export class PaywallPresentationHandler {
onPresentHandler?: (info: PaywallInfo) => void
onDismissHandler?: (info: PaywallInfo, result: PaywallResult) => void
onErrorHandler?: (error: string) => void
onSkipHandler?: (reason: PaywallSkippedReason) => void
onPresent(handler: (info: PaywallInfo) => void): void
onDismiss(handler: (info: PaywallInfo, result: PaywallResult) => void): void
onError(handler: (error: string) => void): void
onSkip(handler: (reason: PaywallSkippedReason) => void): void
}
```
## Methods
| Name | Type | Description | Required |
| --------- | ----------------------------------------------------------- | ------------------------------------------------------------------------------- | -------- |
| onPresent | handler: (info: PaywallInfo) => void | Sets a handler that is called when a paywall is presented. | yes |
| onDismiss | handler: (info: PaywallInfo, result: PaywallResult) => void | Sets a handler that is called when a paywall is dismissed. | yes |
| onError | handler: (error: string) => void | Sets a handler that is called when an error occurs during paywall presentation. | yes |
| onSkip | handler: (reason: PaywallSkippedReason) => void | Sets a handler that is called when a paywall is skipped (not shown). | yes |
## Usage
Create a handler and use it when registering a placement:
```typescript
import { PaywallPresentationHandler, PaywallResult, PaywallSkippedReason } from "@superwall/react-native-superwall"
const handler = new PaywallPresentationHandler()
handler.onPresent((info) => {
console.log("Paywall presented:", info.name)
// Pause video, hide UI, etc.
pauseBackgroundTasks()
})
handler.onDismiss((info, result: PaywallResult) => {
console.log("Paywall dismissed with result:", result.type)
// Resume video, show UI, etc.
resumeBackgroundTasks()
if (result.type === "purchased") {
console.log("User purchased!")
} else if (result.type === "declined") {
console.log("User dismissed without purchasing")
} else if (result.type === "restored") {
console.log("User restored a purchase")
}
})
handler.onError((error) => {
console.error("Paywall error:", error)
// Handle error
})
handler.onSkip((reason) => {
console.log("Paywall skipped:", reason)
// Handle skip reason
})
// Use the handler when registering
Superwall.shared.register({
placement: "premium_feature",
handler: handler,
feature: () => {
// Feature code
}
})
```
## Handler Callbacks
* **onPresent**: Called when a paywall is successfully presented to the user.
* **onDismiss**: Called when a paywall is dismissed. The `result` parameter has a `type` of `purchased`, `declined`, or `restored`.
* **onError**: Called when an error occurs during paywall presentation or loading.
* **onSkip**: Called when a paywall is skipped (not shown) for various reasons (user already subscribed, no audience match, etc.).
## Related
* [`register()`](/react-native/sdk-reference/register) - Register a placement with a handler
* [`PaywallResult`](/react-native/sdk-reference/types) - Result types for paywall dismissal
* [`PaywallSkippedReason`](/react-native/sdk-reference/types) - Reasons why a paywall might be skipped
---
# handleDeepLink()
Source: https://superwall.com/docs/react-native/sdk-reference/handleDeepLink
Handles a deep link.
**Deprecated SDK**
We strongly recommend migrating to the new [Superwall Expo SDK](/expo), see our [migration guide](/expo/guides/migrating-react-native) for details.
## Purpose
Handles a deep link that may be related to Superwall functionality (e.g., promotional links, paywall deep links).
## Signature
```typescript
async handleDeepLink(url: string): Promise
```
## Parameters
| Name | Type | Description | Required |
| ---- | ------ | ---------------------------- | -------- |
| url | string | The deep link URL to handle. | yes |
## Returns / State
Returns a Promise that resolves to a boolean indicating whether the deep link was handled by Superwall. Returns `true` if Superwall handled the link, `false` otherwise.
## Usage
```typescript
// In your deep link handler
const url = "https://your-app.com/paywall?placement=onboarding"
const wasHandled = await Superwall.shared.handleDeepLink(url)
if (!wasHandled) {
// Handle other deep links in your app
handleOtherDeepLink(url)
}
```
## Integration
Typically, you'll call this method from your app's deep link handler:
```typescript
import { Linking } from "react-native"
// Handle initial URL (if app was opened via deep link)
Linking.getInitialURL().then((url) => {
if (url) {
Superwall.shared.handleDeepLink(url)
}
})
// Handle deep links while app is running
Linking.addEventListener("url", (event) => {
Superwall.shared.handleDeepLink(event.url)
})
```
## Related
* [`SuperwallDelegate.paywallWillOpenDeepLink`](/react-native/sdk-reference/SuperwallDelegate) - Delegate method called before opening a deep link
---
# Types and Enums
Source: https://superwall.com/docs/react-native/sdk-reference/types
Reference for types, enums, and result objects used in the React Native SDK.
**Deprecated SDK**
We strongly recommend migrating to the new [Superwall Expo SDK](/expo), see our [migration guide](/expo/guides/migrating-react-native) for details.
## Overview
This page provides reference documentation for types, enums, and result objects used throughout the React Native SDK.
## SubscriptionStatus
Represents the subscription status of a user.
```typescript
type SubscriptionStatus =
| SubscriptionStatus.Active
| SubscriptionStatus.Inactive
| SubscriptionStatus.Unknown
// Create instances
const active = SubscriptionStatus.Active(["pro", "premium"])
const inactive = SubscriptionStatus.Inactive()
const unknown = SubscriptionStatus.Unknown()
```
* **Active**: `status: "ACTIVE"` and an `entitlements` array (string IDs or `Entitlement` objects)
* **Inactive**: `status: "INACTIVE"`
* **Unknown**: `status: "UNKNOWN"`
## PaywallResult
Result of a paywall presentation.
```typescript
type PaywallResult =
| { type: "purchased"; productId: string }
| { type: "declined" }
| { type: "restored" }
```
* **purchased**: User successfully purchased (includes `productId`)
* **declined**: User dismissed/declined the paywall
* **restored**: User restored a previous purchase
## PresentationResult
Result of checking whether a placement will present a paywall.
```typescript
type PresentationResult =
| PresentationResultPaywall // contains an Experiment
| PresentationResultHoldout // contains an Experiment
| PresentationResultNoAudienceMatch
| PresentationResultPlacementNotFound
| PresentationResultUserIsSubscribed
| PresentationResultPaywallNotAvailable
```
* Use `PresentationResult.fromJson(...)` to materialize instances returned from the native bridge.
* Holdout/Paywall results include the associated `Experiment`.
## TriggerResult
Result of registering a placement.
```typescript
enum TriggerResultType {
placementNotFound,
noAudienceMatch,
paywall,
holdout,
error,
}
class TriggerResult {
type: TriggerResultType
experiment?: Experiment
error?: string
}
```
* Use `TriggerResult.fromJson(...)` to parse responses.
## ConfigurationStatus
Status of SDK configuration.
```typescript
enum ConfigurationStatus {
PENDING = "PENDING",
CONFIGURED = "CONFIGURED",
FAILED = "FAILED"
}
```
* **PENDING**: Configuration is in progress
* **CONFIGURED**: Configuration completed successfully
* **FAILED**: Configuration failed
## EntitlementsInfo
Information about user entitlements.
```typescript
interface EntitlementsInfo {
status: SubscriptionStatus
active: Entitlement[]
all: Entitlement[]
inactive: Entitlement[]
}
```
## PaywallInfo
Information about a paywall.
```typescript
interface PaywallInfo {
identifier: string
name: string
url: string
experiment?: Experiment
products: Product[]
productIds: string[]
// ...additional timing and metadata fields
}
```
## PaywallSkippedReason
Reason why a paywall was skipped.
```typescript
type PaywallSkippedReason =
| PaywallSkippedReasonHoldout // includes Experiment
| PaywallSkippedReasonNoAudienceMatch
| PaywallSkippedReasonPlacementNotFound
| PaywallSkippedReasonUserIsSubscribed
```
* Holdout and paywall decisions include the associated `Experiment` instance.
## PurchaseResult
Result of a purchase attempt.
```typescript
class PurchaseResult { type: string; error?: string }
class PurchaseResultPurchased extends PurchaseResult {}
class PurchaseResultCancelled extends PurchaseResult {}
class PurchaseResultFailed extends PurchaseResult { error: string }
class PurchaseResultPending extends PurchaseResult {}
```
## RestorationResult
Result of a restore purchases attempt.
```typescript
abstract class RestorationResult {
static restored(): RestorationResult
static failed(error?: Error): RestorationResult
}
```
* `RestorationResult.restored()` when purchases are restored
* `RestorationResult.failed(error?)` when restoration fails
## RedemptionResults
Result of redeeming a promotional link.
```typescript
type RedemptionResult =
| { status: "SUCCESS"; code: string; redemptionInfo: RedemptionInfo }
| { status: "ERROR"; code: string; error: { message: string } }
| { status: "CODE_EXPIRED"; code: string; expired: { resent: boolean; obfuscatedEmail?: string } }
| { status: "INVALID_CODE"; code: string }
| { status: "EXPIRED_SUBSCRIPTION"; code: string; redemptionInfo: RedemptionInfo }
```
## LogLevel
Logging level.
```typescript
enum LogLevel {
Debug = "debug",
Info = "info",
Warn = "warn",
Error = "error",
None = "none"
}
```
## LogScope
Logging scope.
```typescript
enum LogScope {
LocalizationManager = "localizationManager",
BounceButton = "bounceButton",
CoreData = "coreData",
ConfigManager = "configManager",
IdentityManager = "identityManager",
DebugManager = "debugManager",
DebugViewController = "debugViewController",
LocalizationViewController = "localizationViewController",
GameControllerManager = "gameControllerManager",
Device = "device",
Network = "network",
PaywallEvents = "paywallEvents",
ProductsManager = "productsManager",
StoreKitManager = "storeKitManager",
Placements = "placements",
Receipts = "receipts",
SuperwallCore = "superwallCore",
PaywallPresentation = "paywallPresentation",
PaywallTransactions = "paywallTransactions",
PaywallViewController = "paywallViewController",
Cache = "cache",
All = "all",
}
```
## InterfaceStyle
Interface style preference.
```typescript
enum InterfaceStyle {
LIGHT = "LIGHT",
DARK = "DARK"
}
```
## NetworkEnvironment
Network environment.
```typescript
enum NetworkEnvironment {
Release = "release",
ReleaseCandidate = "releaseCandidate",
Developer = "developer"
}
```
## TransactionBackgroundView
View to show behind Apple's payment sheet.
```typescript
enum TransactionBackgroundView {
spinner = "spinner",
none = "none"
}
```
## Related
* [`SubscriptionStatus` methods](/react-native/sdk-reference/subscriptionStatus) - Getting and setting subscription status
* [`PaywallResult` usage](/react-native/sdk-reference/PaywallPresentationHandler) - Handling paywall results
---
# SuperwallDelegate
Source: https://superwall.com/docs/react-native/sdk-reference/SuperwallDelegate
A class that handles Superwall lifecycle events and analytics.
**Deprecated SDK**
We strongly recommend migrating to the new [Superwall Expo SDK](/expo), see our [migration guide](/expo/guides/migrating-react-native) for details.
Set the delegate using `Superwall.shared.setDelegate(delegate)` to receive these callbacks.
Use `handleSuperwallEvent(eventInfo)` to track Superwall analytics events in your own analytics platform for a complete view of user behavior.
`SuperwallDelegate` is an abstract class—all methods are required. Provide no-op implementations for callbacks you do not use.
## Purpose
Provides callbacks for Superwall lifecycle events, analytics tracking, and custom paywall interactions.
## Signature
```typescript
export abstract class SuperwallDelegate {
abstract subscriptionStatusDidChange(from: SubscriptionStatus, to: SubscriptionStatus): void
abstract willRedeemLink(): void
abstract didRedeemLink(result: RedemptionResult): void
abstract handleSuperwallEvent(eventInfo: SuperwallEventInfo): void
abstract handleCustomPaywallAction(name: string): void
abstract willDismissPaywall(paywallInfo: PaywallInfo): void
abstract willPresentPaywall(paywallInfo: PaywallInfo): void
abstract didDismissPaywall(paywallInfo: PaywallInfo): void
abstract didPresentPaywall(paywallInfo: PaywallInfo): void
abstract paywallWillOpenURL(url: URL): void
abstract paywallWillOpenDeepLink(url: URL): void
abstract handleLog(
level: string,
scope: string,
message?: string,
info?: Map,
error?: string
): void
}
```
## Methods
All methods must be implemented (you can provide empty bodies). Key methods include:
| Name | Type | Description | Required |
| --------------------------- | ---------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | -------- |
| subscriptionStatusDidChange | from: SubscriptionStatus, to: SubscriptionStatus | Called when subscription status changes. | yes |
| handleSuperwallEvent | eventInfo: SuperwallEventInfo | Called for all internal analytics events. Use for tracking in your own analytics. | yes |
| handleCustomPaywallAction | name: string | Called when user taps elements with \`data-pw-custom\` tags. | yes |
| willPresentPaywall | paywallInfo: PaywallInfo | Called before paywall presentation. | yes |
| didPresentPaywall | paywallInfo: PaywallInfo | Called after paywall presentation. | yes |
| willDismissPaywall | paywallInfo: PaywallInfo | Called before paywall dismissal. | yes |
| didDismissPaywall | paywallInfo: PaywallInfo | Called after paywall dismissal. | yes |
| paywallWillOpenURL | url: URL | Called when paywall attempts to open a URL. | yes |
| paywallWillOpenDeepLink | url: URL | Called when paywall attempts to open a deep link. | yes |
| handleLog | level: string, scope: string, message?: string, info?: Map\, error?: string | Called for logging messages from the SDK. | yes |
| willRedeemLink | None | Called before the SDK attempts to redeem a promotional link. | yes |
| didRedeemLink | result: RedemptionResult | Called after the SDK has attempted to redeem a promotional link. | yes |
## Usage
Basic delegate setup:
```typescript
import { SuperwallDelegate, PaywallInfo, SubscriptionStatus } from "@superwall/react-native-superwall"
class MyDelegate extends SuperwallDelegate {
subscriptionStatusDidChange(from: SubscriptionStatus, to: SubscriptionStatus) {
console.log(`Subscription changed from ${from.status} to ${to.status}`)
// update UI here
}
handleSuperwallEvent(eventInfo: SuperwallEventInfo) {
// Track in your analytics
Analytics.track("superwall_event", {
event: eventInfo.event.type,
paywall_id: eventInfo.paywallInfo?.id
})
}
handleCustomPaywallAction(name: string) {
switch (name) {
case "help":
this.presentHelpScreen()
break
case "contact":
this.presentContactForm()
break
}
}
willPresentPaywall(paywallInfo: PaywallInfo) {
// Pause video, hide UI, etc.
this.pauseBackgroundTasks()
}
didDismissPaywall(paywallInfo: PaywallInfo) {
// Resume video, show UI, etc.
this.resumeBackgroundTasks()
}
// Required methods you might not use
willRedeemLink() {}
didRedeemLink() {}
handleCustomPaywallAction() {}
willPresentPaywall() {}
didPresentPaywall() {}
paywallWillOpenURL() {}
paywallWillOpenDeepLink() {}
handleLog() {}
}
// Set the delegate
await Superwall.shared.setDelegate(new MyDelegate())
```
Track subscription status changes:
```typescript
subscriptionStatusDidChange(from: SubscriptionStatus, to: SubscriptionStatus) {
console.log("Subscription changed from", from, "to", to)
this.updateUI(for: to)
}
```
Forward analytics events:
```typescript
handleSuperwallEvent(eventInfo: SuperwallEventInfo) {
switch (eventInfo.event.type) {
case EventType.paywallOpen:
Analytics.track("paywall_opened", {
paywall_id: eventInfo.paywallInfo?.id,
placement: eventInfo.placement
})
break
case EventType.transactionComplete:
Analytics.track("subscription_purchased", {
product_id: eventInfo.product?.id,
paywall_id: eventInfo.paywallInfo?.id
})
break
}
}
```
---
# getUserAttributes()
Source: https://superwall.com/docs/react-native/sdk-reference/getUserAttributes
Retrieves the user attributes, set using setUserAttributes.
**Deprecated SDK**
We strongly recommend migrating to the new [Superwall Expo SDK](/expo), see our [migration guide](/expo/guides/migrating-react-native) for details.
## Purpose
Retrieves the user attributes that were previously set using [`setUserAttributes()`](/react-native/sdk-reference/setUserAttributes).
## Signature
```typescript
async getUserAttributes(): Promise
```
## Parameters
This method takes no parameters.
## Returns / State
Returns a Promise that resolves with an object representing the user's attributes. The object has string keys and values can be any JSON-encodable value, URLs, or Dates.
## Usage
```typescript
const attributes = await Superwall.shared.getUserAttributes()
console.log("User attributes:", attributes)
// Example output: { name: "John", email: "john@example.com", plan: "premium" }
```
## Related
* [`setUserAttributes()`](/react-native/sdk-reference/setUserAttributes) - Set user attributes
* [`identify()`](/react-native/sdk-reference/identify) - Identify a user
---
# setUserAttributes()
Source: https://superwall.com/docs/react-native/sdk-reference/setUserAttributes
Sets user attributes for use in paywalls and on the Superwall dashboard.
**Deprecated SDK**
We strongly recommend migrating to the new [Superwall Expo SDK](/expo), see our [migration guide](/expo/guides/migrating-react-native) for details.
## Purpose
Sets user attributes for use in paywalls and on the Superwall dashboard. If an attribute already exists, its value will be overwritten while other attributes remain unchanged. This is useful for analytics and campaign audience filters you may define in the Superwall Dashboard.
**Note:** These attributes should not be used as a source of truth for sensitive information.
## Signature
```typescript
async setUserAttributes(userAttributes: UserAttributes): Promise
```
## Parameters
| Name | Type | Description |
| -------------- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| userAttributes | UserAttributes | An object containing custom attributes to store for the user. Values can be any JSON-encodable value, URLs, or Dates. Keys beginning with \`$\` are reserved for Superwall and will be dropped. Arrays and dictionaries as values are not supported and will be omitted. |
## Returns / State
Returns a Promise that resolves once the user attributes have been updated.
## Usage
```typescript
await Superwall.shared.setUserAttributes({
name: user.name,
email: user.email,
username: user.username,
profilePic: user.profilePicUrl,
plan: "premium",
signUpDate: new Date()
})
```
## Best Practices
* Set user attributes after calling [`identify()`](/react-native/sdk-reference/identify)
* Update attributes whenever relevant user information changes
* Use attributes in campaign audience filters on the Superwall Dashboard
* Don't store sensitive information (passwords, tokens, etc.) as user attributes
## Related
* [`getUserAttributes()`](/react-native/sdk-reference/getUserAttributes) - Get user attributes
* [`identify()`](/react-native/sdk-reference/identify) - Identify a user
---
# SuperwallOptions
Source: https://superwall.com/docs/react-native/sdk-reference/SuperwallOptions
Options for configuring the Superwall SDK.
**Deprecated SDK**
We strongly recommend migrating to the new [Superwall Expo SDK](/expo), see our [migration guide](/expo/guides/migrating-react-native) 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
```typescript
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
| Name | Type | Description | Default | Required |
| --------------------------------- | --------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | --------------------------- | -------- |
| paywalls | PaywallOptions (see /react-native/sdk-reference/PaywallOptions) | Options for configuring paywall appearance and behavior. | | yes |
| networkEnvironment | NetworkEnvironment | The network environment to use. Options: \`Release\`, \`ReleaseCandidate\`, \`Developer\`. | Release | no |
| isExternalDataCollectionEnabled | boolean | Whether external data collection is enabled. | true | no |
| localeIdentifier | string? | The locale identifier to use. If not set, the system locale is used. | | no |
| isGameControllerEnabled | boolean | Whether game controller support is enabled. | false | no |
| logging | LoggingOptions | Options for configuring logging behavior. \*\*Must be an instance of \`LoggingOptions\` so \`toJson()\` is available.\*\* | | yes |
| collectAdServicesAttribution | boolean | Whether to collect AdServices attribution data. | false | no |
| passIdentifiersToPlayStore | boolean | Whether to pass identifiers to Play Store. | false | no |
| storeKitVersion | "STOREKIT1" \| "STOREKIT2"? | The StoreKit version to use (iOS only). | \`undefined\` (auto-detect) | no |
| enableExperimentalDeviceVariables | boolean | Whether to enable experimental device variables. | false | no |
## Usage
Create options when configuring the SDK:
```typescript
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:
```typescript
// 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
})
```
## Related
* [`PaywallOptions`](/react-native/sdk-reference/PaywallOptions) - Paywall-specific options
* [`configure()`](/react-native/sdk-reference/configure) - Configure the SDK with options
---
# Overview
Source: https://superwall.com/docs/react-native/sdk-reference
Reference documentation for the Superwall React Native SDK.
**Deprecated SDK**
We strongly recommend migrating to the new [Superwall Expo SDK](/expo), see our [migration guide](/expo/guides/migrating-react-native) for details.
## Welcome to the Superwall React Native SDK Reference
This reference documentation covers the legacy React Native SDK (`react-native-superwall`).
You can find the source code for the SDK [on GitHub](https://github.com/superwall/react-native-superwall).
## Feedback
We are always improving our SDKs and documentation!
If you have feedback on any of our docs, please leave a rating and message at the bottom of the page.
---
# Changelog
Source: https://superwall.com/docs/react-native/changelog
Release notes for the Superwall React Native SDK
**Deprecated SDK**
We strongly recommend migrating to the new [Superwall Expo SDK](/expo), see our [migration guide](/expo/guides/migrating-react-native) for details.
## 2.1.7
### Fixes
* Fixes issue with `enableExperimentalDeviceVariables`.
## 2.1.6
### Enhancements
* Upgrades iOS SDK to 4.5.0 [View iOS SDK release notes](https://github.com/superwall/Superwall-iOS/releases/tag/4.5.0).
### Fixes
* Fixes issue with `enableExperimentalDeviceVariables`.
## 2.1.5
### Enhancements
* Exposes the `enableExperimentalDeviceVariables` `SuperwallOption`.
## 2.1.4
### Enhancements
* Upgrades iOS SDK to 4.4.1 [View iOS SDK release notes](https://github.com/superwall/Superwall-iOS/releases/tag/4.4.1).
* Upgrades Android SDK to 2.1.2 [View Android SDK release notes](https://github.com/superwall/Superwall-Android/releases/tag/2.1.2).
## 2.1.3
### Fixes
* Fixes issue when building for iOS.
## 2.1.2
### Fixes
* Upgrades iOS SDK to 4.4.0 [View iOS SDK release notes](https://github.com/superwall/Superwall-iOS/releases/tag/4.4.0).
## 2.1.1
### Enhancements
* Upgrades Android SDK to 2.1.0 [View Android SDK release notes](https://github.com/superwall/Superwall-Android/releases/tag/2.1.0).
## 2.1.0
### Fixes
* Upgrades iOS SDK to 4.3.9 [View iOS SDK release notes](https://github.com/superwall/Superwall-iOS/releases/tag/4.3.9).
### Enhancements
* Adds support for `storeKitVersion` in `SuperwallOptions`.
* Fixes an issue preventing `SuperwallDelegate.didRedeemLink` from getting
called when a Web Checkout link was redeemed.
* Adds `didRedeem` and `willRedeem` to support web checkout
## 2.1.0 (Beta 3)
### Fixes
* Adds support for `storeKitVersion` in `SuperwallOptions`.
## 2.1.0 (Beta 2)
### Fixes
* Fixes an issue preventing `SuperwallDelegate.didRedeemLink` from getting called when a Web Checkout link was redeemed.
## 2.1.0 (Beta 1)
### Enhancements
* Adds `didRedeem` and `willRedeem` to support web checkout
* Upgrades iOS SDK to 4.3.7 [View iOS SDK release notes](https://github.com/superwall/Superwall-iOS/releases/tag/4.3.7).
## 2.0.14
### Enhancements
* Upgrades iOS SDK to 4.3.5 [View iOS SDK release notes](https://github.com/superwall/Superwall-iOS/releases/tag/4.3.5).
## 2.0.13
### Enhancements
* Adds `getAssignments`.
* Upgrades iOS SDK to 4.3.0 [View iOS SDK release notes](https://github.com/superwall/Superwall-iOS/releases/tag/4.3.0).
## 2.0.12
### Enhancements
* Adds `setLogLevel`.
* Upgrades Android SDK to 2.0.6 [View Android SDK release notes](https://github.com/superwall/Superwall-Android/releases/tag/2.0.6).
### Fixes
* Bug fixes for running the example app on Xcode 16.4.
## 2.0.11
### Enhancements
* Upgrades iOS SDK to 4.2.0 [View iOS SDK release notes](https://github.com/superwall/Superwall-iOS/releases/tag/4.2.0).
### Fixes
* Fixes an issue preventing `RestorationResult.failed` from deserializing, which caused failed Restore Purchases attempts to get stuck with the loading indicator shown.
## 2.0.10
### Enhancements
* Upgrades iOS SDK to 4.0.6 [View iOS SDK release notes](https://github.com/superwall/Superwall-iOS/releases/tag/4.0.6).
### Fixes
* Fixes `productId` not being available in the `PurchaseResult` on iOS.
* Fixes issues for Kotlin 2.0 users on Android
## 2.0.9
### Fixes
* Fixes issue with `getSubscriptionStatus` on iOS.
## 2.0.8
### Enhancements
* Upgrades Android SDK to 2.0.5 [View Android SDK release notes](https://github.com/superwall/Superwall-Android/releases/tag/2.0.5).
* Upgrades iOS SDK to 4.0.5 [View iOS SDK release notes](https://github.com/superwall/Superwall-iOS/releases/tag/4.0.5).
* Adds back `getSubscriptonStatus`
## 2.0.7
## Fixes
* Fixes issue when hanling deep links
## 2.0.6
### Enhancements
* Upgrades Android SDK to 2.0.3 [View Android SDK release notes](https://github.com/superwall/Superwall-Android/releases/tag/2.0.3).
* Upgrades Android SDK to 4.0.3 [View iOS SDK release notes](https://github.com/superwall/Superwall-iOS/releases/tag/4.0.3).
* Updates `SuperwallPlacement` naming to `SuperwallEvent`
## 2.0.5
### Enhancements
* Upgrades Android SDK to 2.0.2 [View Android SDK release notes](https://github.com/superwall/Superwall-Android/releases/tag/2.0.2).
## 2.0.4
### Enhancements
* Upgrades iOS SDK to 4.0.1 [View iOS SDK release notes](https://github.com/superwall/Superwall-iOS/releases/tag/4.0.1).
## 2.0.3
### Enhancements
* Updates `SubscriptionStatus.Active` to accept either a list of strings or a list of `Entitlement` objects.
* Updates how feature block is passed in and used in `register` call
* Removes the need for params to be a `Map`, the parameter now supports a `Record`
* Upgrades Android SDK to `2.0.1` [View Android SDK release notes](https://github.com/superwall-me/Superwall-Android/releases/tag/2.0.1)
### Fixes
* Example project fixes.
## 2.0.2
### Fixes
* Readds `handleDeepLink(url:)` to `Superwall`.
## 2.0.1
### Fixes
* Fixes the issue `TypeError: SuperwallReactNative.observeSubscriptionStatus is not a function`.
## 2.0.0
### Breaking Changes
* Updated API for `Superwall.shared.configure` to now receive an object
* Updated API for `Superwall.shared.register` to now receive an object
* Updated API for `Superwall.shared.setSubscriptionStatus` to now receive a `SubscriptionStatus` type with an `Entitlements` array in case of `SubscriptionStatus.Active`
* Added a `subscriptionStatusEmitter` you can subscribe to using the `change`listener
* Upgrades iOS SDK to 4.0.0 [View iOS SDK release notes](https://github.com/superwall-me/Superwall-iOS/releases/tag/4.0.0).
* Upgrades Android SDK to 2.0.0 [View Android SDK release notes](https://github.com/superwall-me/Superwall-Android/releases/tag/2.0.0)
* View more changes in our [migration guide](https://superwall.com/docs/migrating-to-v2-react-native)
## 1.4.7
### Enhancements
* Upgrades iOS SDK to 3.12.4 [View iOS SDK release notes](https://github.com/superwall-me/Superwall-iOS/releases/tag/3.12.4).
## 1.4.6
### Enhancements
* Upgrades iOS SDK to 3.12.3 [View iOS SDK release notes](https://github.com/superwall-me/Superwall-iOS/releases/tag/3.12.3).
## 1.4.5
### Fixes
* Removes unnecessary date comparison from PurchaseController example code.
* Adds a StoreKit configuration file to the iOS expo example app.
## 1.4.4
### Enhancements
* Upgrades iOS SDK to 3.12.1 [View iOS SDK release notes](https://github.com/superwall-me/Superwall-iOS/releases/tag/3.12.1)
## 1.4.3
### Enhancements
* Upgrades Android SDK to 1.5.1 [View Android SDK release notes](https://github.com/superwall-me/Superwall-Android/releases/tag/1.5.1)
* Upgrades iOS SDK to 3.12.0 [View iOS SDK release notes](https://github.com/superwall-me/Superwall-iOS/releases/tag/3.12.0)
### Fixes
* Fixes issue where accessing configuration state before configuring would cause a crash.
## 1.4.2
### Fixes
* Fixes an issue where params that were passed with `getPresentationResult(event:params:)` were being dropped.
## 1.4.1
### Enhancements
* Exposes `getPresentationResult(event:params:)`. This returns a `PresentationResult`, which preemptively gets the result of registering an event. This helps you determine whether a particular event will present a paywall in the future.
## 1.4.0
### Enhancements
* Adds `setInterfaceStyle(style:)` to Superwall, which you can use to set the interface style as `LIGHT` or `DARK`.
## 1.3.5
### Fixes
* Fixes issue where the `PurchaseController` functions wouldn't get called on hot restart of the app.
* Fixes issue with configuration status serialization on Android.
* Fixes issue with preloading paywalls on Android.
## 1.3.4
### Enhancements
* Upgrades Android SDK to 1.3.1 [View Android SDK release notes](https://github.com/superwall-me/Superwall-Android/releases/tag/1.3.1)
* Upgrades iOS SDK to 3.11.1 [View iOS SDK release notes](https://github.com/superwall-me/Superwall-iOS/releases/tag/3.11.1)
* Adds `preloadAllPaywalls` and `preloadPaywalls(eventNames: Set)` method to `Superwall` which preloads all paywalls or paywalls for the event names passed in the argument.
### Fixes
* Fixes issue with the `Experiment` inside `PaywallInfo` being `null` in the `handleSuperwallEvent` delegate for iOS.
## 1.3.3
### Enhancements
* Upgrades Android SDK to 1.3.0 [View Android SDK release notes](https://github.com/superwall-me/Superwall-Android/releases/tag/1.3.0)
* Upgrades iOS SDK to 3.10.1 [View iOS SDK release notes](https://github.com/superwall-me/Superwall-iOS/releases/tag/3.10.1)
* Adds `passIdentifiersToPlayStore` to `SuperwallOptions` which allows you to pass user identifiers to the Play Store purchases as account identifiers. This is useful for tracking user purchases in the Play Store console.
* Adds `confirmAllAssignments` method to `Superwall` which confirms assignments for all placements and returns an array of all confirmed experiment assignments. Note that the assignments may be different when a placement is registered due to changes in user, placement, or device parameters used in audience filters.
### Fixes
* Fixes issue with the `Experiment` inside `PaywallInfo` being `null` in the `handleSuperwallEvent` delegate for iOS.
## 1.3.2
### Enhancements
* Upgrades iOS SDK to 3.10.0 [View iOS SDK release notes](https://github.com/superwall-me/Superwall-iOS/releases/tag/3.10.0)
* Upgrades Android SDK to 1.2.9 [View Android SDK release notes](https://github.com/superwall-me/Superwall-Android/releases/tag/1.2.9)
## 1.3.1
### Enhancements
* Upgrades Android SDK to 1.2.8 [View Android SDK release notes](https://github.com/superwall-me/Superwall-Android/releases/tag/1.2.8)
## 1.3.0
### Enhancements
* Upgrades iOS SDK to 3.9.1. [View iOS SDK release notes](https://github.com/superwall-me/Superwall-iOS/releases/tag/3.9.1)
* Upgrades Android SDK to 1.2.7 [View Android SDK release notes](https://github.com/superwall-me/Superwall-Android/releases/tag/1.2.7)
* Exposes the `SuperwallOption` `collectAdServicesAttribution` for iOS. When `true`, this collects the AdServices attribute token, which will be process by our backend. This adds `adServicesTokenRequest_start`, `adServicesTokenRequest_complete`, and `adServicesTokenRequest_fail` events.
* Exposes `getConfigurationStatus()`. This returns either `PENDING`, `CONFIGURED`, or `FAILED`.
## 1.2.7
### Fixes
// TODO: Update iOS to latest version before releasing.
* Fixes issue where the `paywallWillOpenURL` wasn't being called.
## 1.2.6
### Enhancements
* Adds an expo example project.
* Upgrades iOS SDK to 3.7.3. [View iOS SDK release notes](https://github.com/superwall-me/Superwall-iOS/releases/tag/3.7.3)
* Upgrades Android SDK to 1.2.4. [View Android SDK release notes](https://github.com/superwall-me/Superwall-Android/releases/tag/1.2.4)
## 1.2.5
### Fixes
* Fixes `Switch must be exhaustive` error caused by the upgrade of the iOS SDK.
## 1.2.4
### Enhancements
* Upgrades iOS SDK to 3.7.0. [View iOS SDK release notes](https://github.com/superwall-me/Superwall-iOS/releases/tag/3.7.0)
### Fixes
* Fixes an error `Invalid LocalNotificationType value`.
## 1.2.3
### Enhancements
* Adds `Superwall.shared.dismiss()` to be able to dismiss a paywall programmatically.
* Upgrades Android SDK to 1.2.1. [View Android SDK release notes](https://github.com/superwall-me/Superwall-Android/releases/tag/1.2.1)
## 1.2.2
### Enhancements
* Upgrades iOS SDK to 3.6.6. [View iOS SDK release notes](https://github.com/superwall-me/Superwall-iOS/releases/tag/3.6.6)
* Upgrades Android SDK to 1.1.7. [View Android SDK release notes](https://github.com/superwall-me/Superwall-Android/releases/tag/1.1.7)
### Fixes
* Makes sure the iOS SDK is pinned to a specific version, rather than a minimum version.
## 1.2.1
### Enhancements
* Upgrades Android SDK to 1.1.6. [View Android SDK release notes](https://github.com/superwall-me/Superwall-Android/releases/tag/1.1.6)
## 1.2.0
### Enhancements
* Adds `handleDeepLink(url:)`.
* Adds `setUserAttributes(userAttributes:)` and `getUserAttributes()`.
* Upgrades iOS SDK to 3.6.5. [View iOS SDK release notes](https://github.com/superwall-me/Superwall-iOS/releases/tag/3.6.5)
### Fixes
* Transaction error alerts now display the intended error message rather than a generic `PurchaseResultError`.
## 1.1.3
### Enhancements
* Upgrades Android SDK to 1.1.5. [View Android SDK release notes](https://github.com/superwall-me/Superwall-Android/releases/tag/1.1.5)
## 1.1.2
### Enhancements
* Upgrades Android SDK to 1.1.4. [View Android SDK release notes](https://github.com/superwall-me/Superwall-Android/releases/tag/1.1.4)
* Upgrades iOS SDK to 3.6.2. [View iOS SDK release notes](https://github.com/superwall-me/Superwall-iOS/releases/tag/3.6.2)
### Fixes
* Fixes issue where the React Native `SuperwallEvent` hadn't been updated to include `identityAlias`.
## 1.1.1
### Enhancements
* Upgrades Android SDK to 1.1.2. [View Android SDK release notes](https://github.com/superwall-me/Superwall-Android/releases/tag/1.1.2)
* Upgrades iOS SDK to 3.6.1. [View iOS SDK release notes](https://github.com/superwall-me/Superwall-iOS/releases/tag/3.6.1)
## 1.1.0
### Enhancements
* Upgrades Android SDK to 1.1.1. [View Android SDK release notes](https://github.com/superwall-me/Superwall-Android/releases/tag/1.1.1)
* Upgrades iOS SDK to 3.6.0. [View iOS SDK release notes](https://github.com/superwall-me/Superwall-iOS/releases/tag/3.6.0)
### Fixes
* Fixes issue with restoration on iOS.
* Fixes issue with presenting surveys.
## 1.0.5
### Fixes
* Fixes issue where params sent via register were being dropped.
## 1.0.4
### Enhancements
* Upgrades Android SDK to 1.0.2. [View Android SDK release notes](https://github.com/superwall/Superwall-Android/releases/tag/1.0.2)
## 1.0.3
### Fixes
* Providing your own `PurchaseController` now works as expected.
* Publicly exposes `EventType`, `PurchaseResultCancelled`, `PurchaseResultFailed`, `PurchaseResultPending`, `PurchaseResultPurchased`, `PurchaseResultRestored`, `TransactionBackgroundView`.
## 1.0.2
### Enhancements
* Upgrades Android SDK to 1.0.0. [View Android SDK release notes](https://github.com/superwall/Superwall-Android/releases/tag/1.0.0)
* Upgrades iOS SDK to 3.5.0. [View iOS SDK release notes](https://github.com/superwall/Superwall-iOS/releases/tag/3.5.0)
---
# Welcome
Source: https://superwall.com/docs/react-native
Welcome to the Superwall React Native SDK documentation
**Deprecated SDK**
We strongly recommend migrating to the new [Superwall Expo SDK](/expo), see our [migration guide](/expo/guides/migrating-react-native) for details.
## Quick Links
Reference the Superwall React Native SDK
Step-by-step migration guide to the new Expo SDK
Documentation for the recommended Expo SDK
## Feedback
We are always improving our SDKs and documentation!
If you have feedback on any of our docs, please leave a rating and message at the bottom of the page.