Observer Mode
Report purchases made outside Superwall in your Expo app with observer mode and shouldObservePurchases, and see what Android needs from native code.
If you wish to make purchases outside of Superwall's SDK and paywalls, you can use observer mode to report purchases that will appear in the Superwall dashboard, such as transactions:
This is useful if you are using Superwall solely for revenue tracking, and you're making purchases using frameworks like StoreKit or Google Play Billing Library directly. Observer mode will also properly link user identifiers to transactions. To enable observer mode, set it using SuperwallOptions when configuring the SDK:
import { SuperwallProvider } from "expo-superwall";
export default function App() {
return (
<SuperwallProvider
apiKeys={{ ios: "YOUR_IOS_API_KEY", android: "YOUR_ANDROID_API_KEY" }}
options={{ shouldObservePurchases: true }}
>
{/* your app */}
</SuperwallProvider>
);
}If you use the compat API, pass the same option to configure:
import Superwall from "expo-superwall/compat";
await Superwall.configure({
apiKey: "YOUR_API_KEY",
options: { shouldObservePurchases: true },
});On iOS, Superwall picks up StoreKit transactions by itself once the option is on. On Android, the native SDK only sees a Google Play purchase when billing code reports it with launchBillingFlowWithSuperwall, or with observePurchaseStart, observePurchaseResult and observePurchaseError. The Expo SDK doesn't expose these methods to JavaScript, so Google Play purchases you make from JavaScript aren't reported as transactions. To report them, call the methods from native Android code in your app. See Observer Mode on Android.
There are a few things to keep in mind when using observer mode:
- On iOS, if you're using StoreKit 2, then Superwall solely reports transaction completions. If you're using StoreKit 1, then Superwall will report transaction starts, abandons, and completions.
- When using observer mode, you can't make purchases using our SDK — such as
Superwall.shared.purchase(aProduct).
For more on setting up revenue tracking, check out this doc.
How is this guide?
Custom Paywall Actions
Run your own Expo app code when a paywall button is tapped: add a custom action in the paywall editor and handle it with handleCustomPaywallAction.
Game Controller Support
Let users navigate Superwall paywalls with a game controller in your Expo app. Set isGameControllerEnabled to true and Superwall forwards gamepad input.