Embedded Onboarding

Custom element (<frame-onboarding>) that hosts Frame's merchant onboarding flow, inline or as a modal.

The flow walks merchants through the steps Frame requires to enable payouts (identity, business info, payout method, terms of service).

Two layouts, chosen with the layout attribute:

  • inline (default) — renders in place, filling its parent container.
  • modal — renders a centered dialog over a backdrop, closable via the close button, the Escape key, or a backdrop click.

Place a <frame-onboarding> tag where the flow should render, then get the instance via Frame.createOnboarding(apiKey) — the helper reuses the existing tag, or appends one to document.body if none exists. Render the flow by calling open({ clientSecret }) with a session client secret minted by your backend.

Subscribe to lifecycle either via property callbacks (onSuccess, onStepComplete, onError, onClose) or via DOM events (frame:complete, frame:step-complete, frame:error, frame:close, frame:expired) bubbling off the element.

EXAMPLE
import Frame from '@framepayments/frame-js';

const onboarding = await Frame.createOnboarding('pk_sandbox_...');

onboarding.onSuccess = (account) => {
  // merchant has completed onboarding
};

onboarding.onError = ({ step, error }) => {
  reportToTelemetry(step, error);
};

const { client_secret } = await createOnboardingSessionOnBackend();
await onboarding.open({ clientSecret: client_secret });

Properties

onCloseobject | null

Fires when the flow closes — via the completion screen's Done button or programmatic close(), plus the close button, Escape key, and backdrop click in the modal layout.

onErrorobject | null

Fires when a step fails. Includes the step key and the error.

Check error.name to tell two cases apart. UnsupportedStepError means the account needs a step the element can't collect yet (business owners and business documents), so finish that step in Frame's hosted onboarding. SessionExpiredError means the session secret expired, so mint a new client secret on your backend. The frame:expired event also fires in that case.

onStepCompleteobject | null

Fires after each individual step completes.

onSuccessobject | null

Fires once the merchant has finished every required step.

Methods

Frame Assistant

Ask anything about Frame's APIs and products