Superwall
Components

SuperwallProvider

<SuperwallProvider /> is the root component for the Superwall SDK. It is used to initialize the SDK with your API key.

Props

Prop

Type

apiKeys

Prop

Type

<SuperwallProvider
  apiKeys={{ ios: "YOUR_SUPERWALL_API_KEY" }}
  onConfigurationError={(error) => {
    console.error("Superwall configuration failed:", error);
    // Handle error, show UI, or retry
  }}
>
  {/* Your app content */}
</SuperwallProvider>

Example

import { SuperwallProvider } from "expo-superwall";

// Replace with your actual Superwall API key
export default function App() {
  return (
    <SuperwallProvider apiKeys={{ ios: "YOUR_SUPERWALL_API_KEY" /* android: API_KEY */ }}>
      {/* Your app content goes here */}
    </SuperwallProvider>
  );
}

Consume rerouted Android back buttons

If the Reroute back button toggle is enabled on a paywall (/dashboard/dashboard-creating-paywalls/paywall-editor-settings#reroute-back-button), Superwall can hand control back to your app. Provide options.paywalls.onBackPressed to intercept the event and return true to consume it.

<SuperwallProvider
  apiKeys={{ ios: "ios_key", android: "android_key" }}
  options={{
    paywalls: {
      onBackPressed: (paywallInfo) => {
        if (paywallInfo.identifier === "survey") {
          showExitConfirmation();
          return true; // Prevent Superwall from dismissing automatically
        }
        return false; // Keep the default dismissal behavior
      },
    },
  }}
/>

This callback only fires on Android and only when rerouting is enabled in the paywall editor. Use it to show confirmation modals, capture analytics, or resume gameplay before closing the paywall.

How is this guide?

Edit on GitHub