Superwall

PaywallOptions

Options for configuring the appearance and behavior of paywalls.

Deprecated SDK

We strongly recommend migrating to the new Superwall Expo SDK, see our migration guide 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

export class PaywallOptions {
  isHapticFeedbackEnabled = true
  restoreFailed: RestoreFailed = new RestoreFailed()
  shouldShowPurchaseFailureAlert = true
  shouldPreload = false
  automaticallyDismiss = true
  transactionBackgroundView: TransactionBackgroundView = TransactionBackgroundView.spinner
}

Properties

PropertyTypeDescription
isHapticFeedbackEnabledbooleanWhether haptic feedback is enabled when interacting with paywalls. Defaults to true.
restoreFailedRestoreFailedConfiguration for the alert shown when restore purchases fails.
shouldShowPurchaseFailureAlertbooleanWhether to show an alert when a purchase fails. Defaults to true.
shouldPreloadbooleanWhether paywalls should be preloaded. If false, you can manually preload using preloadAllPaywalls() or preloadPaywalls(). Defaults to false.
automaticallyDismissbooleanWhether paywalls should automatically dismiss after a successful purchase. Defaults to true.
transactionBackgroundViewTransactionBackgroundViewThe view to show behind Apple's payment sheet during a transaction. Options: spinner, none. Defaults to spinner.

Usage

Create paywall options:

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:

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:

// Show a spinner (default)
const options1 = new PaywallOptions({
  transactionBackgroundView: TransactionBackgroundView.spinner
})

// Show nothing
const options2 = new PaywallOptions({
  transactionBackgroundView: TransactionBackgroundView.none
})

How is this guide?

Edit on GitHub