Flutter SDK Web Support: Web Billing Setup Walkthrough
Flutter compiles one codebase to iOS, Android, macOS, Windows, Linux, embedded targets and the browser. The purchases_flutter SDK now covers the browser target too, so a Flutter web build can hand checkout to a Web Billing flow rather than a native store sheet. This walkthrough covers the dashboard steps, the pubspec bump, the platform branch in your configuration code, and the calls you must fence off on web.
What web support changes for a Flutter app
Before web support, a Flutter team shipping a browser build had to read entitlements and subscription state by hand and wire a separate checkout. With web support in the SDK, the same entitlement model and offering structure used on iOS, Android and macOS extends to the web target.
Two configuration surfaces matter. In the dashboard you add the Web Billing payment provider and create web products there rather than through a store. In the app you supply a distinct web API key when the build is running in a browser, so the SDK routes the purchase to the web checkout.
Step 1–2: Dashboard setup and web products
Open your project in the dashboard and attach the Web Billing payment provider. You then connect a Stripe account, choose the default currency, and enter the app and brand details that the hosted checkout will display.
Web products are created inside the dashboard, which differs from the store-driven flow on mobile. Build the products, place them in offerings, and attach them to the entitlements your app checks. The links in the source registry cover the app configuration, product configuration, offerings and entitlements pages if you need the detailed screens.
Step 3: Upgrade purchases_flutter
Set the dependency to the version that carries web support, then resolve packages. The exact pubspec line and fetch command are supplied as protected modules and should be used verbatim.
Step 4: Make the project build for web
Confirm the app can target the browser and that every dependency in pubspec.yaml also supports web. The scaffold command is supplied as a protected module; run it in the project root.
Step 5: Branch the SDK configuration by platform
Retrieve the Web API key from the dashboard and pass it to PurchasesConfiguration only when the app is running on web. The configuration module shows the kIsWeb branch alongside the Android and iOS branches, each with its own key placeholder.
A quick control map for that branch:
- kIsWeb true → web billing key, hosted web checkout.
- Platform.isAndroid → Google key, native store flow.
- Platform.isIOS → Apple key, native store flow.
- Any other target → decide explicitly which key your desktop build should use.
Keep the key selection in one place so a new platform cannot silently inherit the wrong store.
Step 6: Test the purchase flow
Your paywall keeps calling purchasePackage. On web, the SDK opens a browser checkout handled by the billing provider rather than a native in-app purchase sheet. Run through a purchase in a web build and confirm the entitlement lands where your app expects it.
Step 7: Guard the calls that are not available on web
Two areas are not yet supported when the platform is web: product operations (getting and purchasing products), and restoring purchases through the SDK — restoration on web relies on Web Billing's own mechanisms. If your mobile code calls these methods, add a web check and handle the branch deliberately, either returning early or raising an error. The guard module shows the shape of that check.
Separately, Paywalls, Customer Center and other features from the purchases_ui_flutter package are not yet available on web. If your paywall UI depends on that package, plan a web-specific path rather than assuming it renders.
A short pre-launch checklist:
- Web Billing provider attached and Stripe connected.
- Web products created, in offerings, attached to entitlements.
- purchases_flutter at the required version and resolved.
- Web platform enabled and all dependencies web-compatible.
- kIsWeb branch supplies the web key.
- purchasePackage tested in a browser build.
- Product operations and restore calls guarded on web.
- purchases_ui_flutter features given a web fallback.
Frequently asked questions
Which purchases_flutter version adds web support?
The walkthrough pins purchases_flutter to 9.11.0 in pubspec.yaml. Check the package's release history before upgrading in case later versions change the requirement.
Can I reuse my mobile API key on web?
No. The configuration branches on kIsWeb and supplies a separate Web Billing API key from the dashboard, while Android and iOS keep their own keys.
How do users restore purchases on web?
SDK restore is not supported on web; restoration relies on Web Billing's built-in mechanisms. Guard any restore call in shared code so it does not run in the browser.
Do Paywalls work on Flutter web?
Not yet. Paywalls, Customer Center and other purchases_ui_flutter features are unavailable on web, so plan a web-specific UI path.