Superwall

PaywallOptions

Configuration for paywall presentation and behavior in the Superwall Flutter SDK.

PaywallOptions is provided via the paywalls parameter on SuperwallOptions and is passed when calling configure.

Purpose

Customize how paywalls look and behave, including preload behavior, alerts, dismissal, and haptics.

Signature

class PaywallOptions {
  bool isHapticFeedbackEnabled = true;
  RestoreFailed restoreFailed = RestoreFailed();
  bool shouldShowPurchaseFailureAlert = true;
  bool shouldPreload = true;
  bool automaticallyDismiss = true;
  TransactionBackgroundView transactionBackgroundView = TransactionBackgroundView.spinner;
  bool shouldShowWebRestorationAlert = true;
  Map<String, String>? overrideProductsByName;
  bool shouldShowWebPurchaseConfirmationAlert = true;
}

class RestoreFailed {
  String title = 'No Subscription Found';
  String message = "We couldn't find an active subscription for your account.";
  String closeButtonTitle = 'Okay';
}

enum TransactionBackgroundView { spinner, none }

Parameters

PropertyTypeDescription
isHapticFeedbackEnabledboolEnables haptic feedback during key paywall interactions. Defaults to true.
restoreFailedRestoreFailedMessaging for the restore-failed alert.
restoreFailed.titleStringTitle for restore-failed alert. Defaults to "No Subscription Found".
restoreFailed.messageStringMessage for restore-failed alert. Defaults to "We couldn't find an active subscription for your account."
restoreFailed.closeButtonTitleStringClose button title for restore-failed alert. Defaults to "Okay".
shouldShowPurchaseFailureAlertboolShows an alert after a purchase fails. Set to false if you handle failures via a PurchaseController. Defaults to true.
shouldPreloadboolPreloads and caches trigger paywalls and products during SDK initialization. Defaults to true.
automaticallyDismissboolAutomatically dismisses the paywall on successful purchase or restore. Defaults to true.
transactionBackgroundViewTransactionBackgroundViewView shown behind the system payment sheet during a transaction. Defaults to .spinner.
shouldShowWebRestorationAlertboolShows an alert asking the user to try restoring on the web if web checkout is enabled. Defaults to true.
overrideProductsByNameMap<String, String>?Overrides products on all paywalls using name→identifier mapping (e.g., "primary""com.example.premium_monthly").
shouldShowWebPurchaseConfirmationAlertboolShows a localized alert confirming a successful web checkout purchase. Defaults to true.

Usage

final paywallOptions = PaywallOptions()
  ..isHapticFeedbackEnabled = true
  ..shouldShowPurchaseFailureAlert = false
  ..shouldPreload = true
  ..automaticallyDismiss = true
  ..transactionBackgroundView = TransactionBackgroundView.spinner
  ..overrideProductsByName = {
    'primary': 'com.example.premium_monthly',
    'tertiary': 'com.example.premium_annual',
  }
  ..shouldShowWebRestorationAlert = true
  ..shouldShowWebPurchaseConfirmationAlert = true;

final options = SuperwallOptions(
  paywalls: paywallOptions,
);

await Superwall.configure(
  'pk_your_api_key',
  options: options,
);

How is this guide?