Quickstart
Show a screen from a placement, pass it prices, and run your own checkout when someone buys.
This page takes you from a published screen to a working screen. It uses a placement, so you can change the screen later without a deploy or release.
You need a published screen with a placement (Placements), a public key from Install SDK or API keys, and the package IDs on the screen (set in the editor, see Packages and pricing; Install SDK lists them).
Show the screen
Install the SDK and call configure once with your key. Then present the placement from a button. Pass a price for every package ID and run your checkout in onPurchase.
<button id="upgrade">Upgrade</button>
<script>
document.querySelector('#upgrade').addEventListener('click', async () => {
const result = await UIKit.presentPaywall({
paywall: { placement: 'upgrade_button' },
products: {
monthly: { price: 9.99, currency: 'USD', period: 'month' },
annual: { price: 59.99, currency: 'USD', period: 'year' },
},
onPurchase: async ({ packageId }) => {
// Your checkout (Stripe, Paddle, your backend...).
// Return true when paid, false when cancelled. Throw on failure.
return startCheckout(packageId);
},
});
if (result.outcome === 'purchased') unlockPro(result.packageId);
if (result.outcome === 'skipped') console.log('Not shown:', result.reason);
});
</script>That is a complete integration. The screen opens in the format you chose on the placement, shows your prices, calls onPurchase when the user taps buy, and closes.
Results you can get
| Result | When | Extra fields |
|---|---|---|
purchased | onPurchase finished without returning false. | packageId, answers |
restored | onRestore finished without returning false. | answers |
closed | The user closed the screen (close button, Esc or backdrop click on web, swipe down or system back on mobile, or a toast timing out). | answers |
action | A "Run your code" button was pressed and onAction did not return false. | actionId, answers |
skipped | The placement's targeting chose to show nothing. Nothing opened. | reason: frequency_cap, audience or holdout |
answers is present when the user answered a question. Web, React Native and Flutter read it as result.outcome; iOS and Android use enum cases (see Present a screen).
Next
- Show it by itself. If the placement has a trigger (for example "After 10 seconds" or "When the app opens"), call
startAutoPlacementsonce instead ofpresent. See Auto placements. - Show it inline. Put a screen in your own layout (pricing section, onboarding step). See Embed a screen.
- React.
usePaywalland<Paywall>from@miniwall/react. See React.
If something does not show
- No price for a package ID: the web SDK logs
[UIKit] No price for package(s) .... Placement not found: the key does not match a placement.Published paywall not found: the screen was never published.- Mobile:
Miniwall: call Miniwall.configure(...) before loading a placementmeansconfigurewas not called. - Web:
origin_not_allowed(403) means your site is not in Allowed sources. Mobile:app_not_allowedmeans the app is not in Allowed sources either. - See Errors for every message.