Skip to main content
The App Kit SDK exposes two ways to mount the Onramp widget:
  • kit.onramp.mountIframe embeds the widget as an inline <iframe> inside a container element you own. Use this when you have room in your layout for a 720+ pixel-tall surface.
  • kit.onramp.openWindow launches the widget as a separate popup window. Use this when inline embedding does not fit your UX, when iOS Safari’s storage restrictions block the iframe flow, or when you want the widget to feel separate from your app.
Both are synchronous functions. Both return a widget controller you can subscribe to. They differ in where the widget renders and in what can go wrong.

When to pick each mode

iOS Safari’s Intelligent Tracking Prevention can restrict storage inside a cross-origin iframe, which sometimes breaks the embedded app’s session handling. If you see issues isolated to iOS Safari, use openWindow on that platform.

Iframe mode

mountIframe does not require a user gesture. You can call it on page load, from your framework’s mounted lifecycle, or after any await. The container element must already be attached to the document and must have an explicit, non-zero height:
TypeScript
See the quickstart for an end-to-end example. openWindow must be called synchronously from a user gesture (a click handler, for example). If you await before calling, the browser blocks the popup because the user-gesture context has expired. Mint the session ahead of time, then call openWindow directly from the click handler:
TypeScript
openWindow returns a discriminated result rather than throwing, so a blocked popup is a normal flow you handle in code, not an exception.

Handle a blocked popup

When openWindow cannot open a usable popup, it returns { status: 'blocked', reason }. The reason field tells you why, and what to do about it: Example with all three fallbacks:
TypeScript
On mobile browsers, window.open opens a new tab rather than a sized popup. The width and height features are ignored. Design your UX for both outcomes. If the user closes the popup before submitting a deposit, the App Kit SDK detects it and synthesizes a DEPOSIT_NOT_COMPLETED event with code CANCELED_BY_CUSTOMER. Your onDepositNotCompleted handler runs without any extra polling on your side.

Close the widget

Both mountIframe and openWindow return a controller with a close() method. Call it when the user leaves the view, closes the modal, or starts over:
TypeScript
For iframe mode, the kit auto-disposes the widget if the container is removed from the DOM without a close() call. Call widget.close() when you know the widget is no longer needed.