Docs
SDK

Installation

Add the Miniwall SDK to a website, iOS, Android, React Native or Flutter app and set it up with configure.

The SDK draws the screens you build in the dashboard. It only renders: prices come from your code and the purchase stays in your code.

Before you start

You need a public key (it starts with pk_) and, usually, a placement key.

  1. In the dashboard open Install SDK. If the project has no public key, select Create a public key. You can also manage keys on API keys. See API keys.
  2. Publish a screen and point a placement at it. See Placements.

A public key can only read published screens and send events, so it is safe to put in a page or ship in an app.

The Install SDK page: platform tabs, the On button click and Automatic choice, a Paywall selector and the script tag snippet with the public key filled in.The Install SDK page: platform tabs, the On button click and Automatic choice, a Paywall selector and the script tag snippet with the public key filled in.
  1. Paywall picks the screen the snippet opens.
  2. Copy copies the snippet.

Install

Script tag. The Install SDK page shows this snippet with your key filled in.

<script src="https://sdk.miniwall.app/ui-kit.iife.js"></script>
<script>
  UIKit.configure({ apiKey: 'pk_...' });
</script>

Or npm (@miniwall/web):

npm install @miniwall/web
import { configure, presentPaywall } from '@miniwall/web';

configure({ apiKey: 'pk_...' });
  • No framework is needed. Svelte and the renderer are compiled in. TypeScript types are included.
  • Screens draw inside a shadow root: your CSS does not leak in and the screen's CSS does not leak out.
  • The script defines window.UIKit (every SDK function) and the <uikit-paywall> element. See Web component.
  • The npm package is ESM only (require is not supported) and has sideEffects: false. The script build is also exported as @miniwall/web/iife. For React, add @miniwall/react (React).
  • Load the script before the code that uses UIKit.
  • Importing on the server (Next.js, Remix) is safe: nothing touches the DOM until you call a function. Do not call presentPaywall, mountPaywall or startAutoPlacements while rendering on the server.
  • Browsers: the last two versions of Chrome, Edge, Firefox and Safari, iOS Safari 16+, Android Chrome.

The hosted script is the build of the latest @miniwall/web release, so it moves when a new release ships. To pin a version, install from npm.

On mobile there is no web view and there are no third-party dependencies. Screens and images are cached on the device, so a published screen keeps working offline. Nothing is shown until you call present or start auto placements.

Configure

Call configure once at startup, before you load a placement. It sets defaults for every call. Options passed to a single call win.

configure({
  apiKey: 'pk_...',
  locale: 'vi_VN',
  colorMode: 'system',
  attributes: { plan: 'free' },
});
OptionTypeDefaultWhat it does
API key (apiKey)stringnoneYour public key. Needed for placements, paywall IDs and auto placements. Not needed for a JSON or URL source.
apiUrl (apiURL on iOS)stringhttps://api.miniwall.appThe delivery API. Override it only to self-host.
localestringWeb: the screen's default language. Mobile: the device's languageLanguage to render, such as vi_VN. A call's own locale wins.
colorModelight, dark or systemWeb: light. Mobile: systemsystem follows prefers-color-scheme (web) or the device's appearance.
analyticsbooleantrueSend views, closes and purchase events to the dashboard (only for screens loaded by placement or paywall ID).
attributesmapnoneWhat you know about the user, for audiences. Kept on the device, never sent. See Targeting attributes.
timeoutMsnumber8000How long to wait for the delivery API. After that the last saved copy is used, or the call fails. On iOS the option is timeout, in seconds (default 8).
maxFontScalenumber1.6Mobile only. Largest text-size multiplier taken from the system text size; 1 turns it off.

On the web, calling configure again changes only the options you pass; on mobile it replaces the options with the ones you pass. setAttributes adds to the saved attributes later (for example after sign-in), and null removes one.

Differences

Web: a cookie banner may need to come first. The SDK writes items to browser storage under keys that start with uikit:, so call configure after consent. See Events and privacy. Add your domains to Allowed sources (Pro plan and above) to stop other sites using your key. See Allowed domains and Security and CSP.

Mobile: every request carries your app ID in the X-Miniwall-App header: ios:com.acme.app (bundle ID) or android:com.acme.app (application ID). If your project has app entries in Allowed sources, add every app ID you ship, including debug builds with a different ID. Others get 403 app_not_allowed (see Errors). An empty list accepts every app.

Check that it works

Show a screen from a placement, then open Install SDK in the dashboard. Its status block reads Waiting for your site. until a view arrives, then Live with the number of views in the last 7 days. If nothing arrives, see Errors.

The Checklist in Setup details on the Install SDK page, with four green checks: paywall published, placement, public key and package IDs.The Checklist in Setup details on the Install SDK page, with four green checks: paywall published, placement, public key and package IDs.
Open Setup details on the Install SDK page. Check again, at the top, reads the status now.

On this page