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;
void Function(PaywallInfo?)? onBackPressed;
}
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
Prop
Type
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
..onBackPressed = (paywallInfo) {
// Android-only callback
Superwall.shared.dismiss();
};
final options = SuperwallOptions(
paywalls: paywallOptions,
);
await Superwall.configure(
'pk_your_api_key',
options: options,
);Related
How is this guide?
Edit on GitHub