Miniwall Docs
Web SDK

Web component

Put a screen on a page with the uikit-paywall tag, set it up with attributes and properties, and listen for its events.

<uikit-paywall> draws a screen inline from plain HTML. The script build registers it for you. With a bundler, call definePaywallElement() once.

<uikit-paywall placement="pricing" api-key="pk_..."></uikit-paywall>
<script>
  const el = document.querySelector('uikit-paywall');
  el.products = { annual: { price: 59.99, currency: 'USD', period: 'year' } };
  el.onPurchase = async ({ packageId }) => startCheckout(packageId);
  el.addEventListener('uikit-purchased', (event) => unlockPro(event.detail.packageId));
</script>
function definePaywallElement(tagName = 'uikit-paywall'): void;

It is safe to call twice and during server rendering. Pass another name to use your own tag.

Attributes

AttributeWhat it does
placementPlacement key.
paywall-idA published screen's ID.
srcA URL that returns the screen JSON.
api-keyPublic key. Calls configure for the page.
api-urlOverride the delivery API.
localeLanguage, such as vi_VN.
color-modelight, dark or system.
max-content-widthFor example 480px.

The source is the first that is set: the paywall property, then placement, paywall-id, src. Changing an attribute re-renders.

Properties

PropertyType
paywallPaywallSource. Any source, including JSON.
productsAn object of package ID to ProductInfo.
customVariablesValues for custom.NAME text.
visitorAttributesAttributes for audiences.
onPurchase, onRestore, onAction, onAnswer, onOpenUrlThe callbacks of Callbacks.

Setting data properties re-renders (several changes in one tick render once). Callbacks are read when a button is tapped. Setting onRestore for the first time (or clearing it) re-renders because the restore button depends on it. onClose, onSkip and onError are events, not properties. screens and variablesPerPackage are not available on the element.

The element is display: block unless you set a display. It draws inline like mountPaywall: purchases do not remove it.

Events

All events bubble and cross the shadow boundary (composed).

EventdetailWhen
uikit-readynoneThe screen was drawn (not sent when skipped).
uikit-purchased{ packageId, answers }onPurchase finished without returning false.
uikit-restorednoneonRestore finished without returning false.
uikit-close{ answers }The close button was pressed.
uikit-action{ actionId, answers }A "Run your code" button was pressed and onAction did not return false.
uikit-answer{ fieldId, value, answers }An answer changed.
uikit-skipped{ reason }Targeting chose to show nothing.
uikit-error{ error }A load or renderer error.

A purchase without an onPurchase property reports UIKit: set element.onPurchase to handle purchase buttons in uikit-error.

On this page