Browse SDK

plandalf.mount()

Mount an offer in an element.

Implemented by the browser object; parameter and return types follow the delegated class declaration.

Workspace snapshot: the inspected SDK has local changes. Source links identify its base commit and may differ from this working copy. Verify the SDK build you deploy before relying on unreleased behavior.

Call this after plandalf.ready(). The browser wrapper can return undefined before initialization.

Signature

plandalf.mount(
  target: HTMLElement | string,
  slug: string,
  opts?: MountOptions,
): FlowHandle<Flow>

Arguments

NameTypeMeaning
targetHTMLElement | stringElement or CSS selector to mount into.
slugstringPublished offer slug.
opts?MountOptionsInline mount options passed through to the class. The browser wrapper declares this argument as any and passes it to the typed class method.

Example

mount.js
plandalf.ready(async () => {
  const handle = plandalf.mount('#checkout', 'upgrade', {
    promo: 'early-bird',
    metadata: { source: 'pricing-page' },
  })
  const flow = await handle
  console.log(flow.id, flow.state)
})

Mount options

These fields come from MountOptions. The current mount() implementation forwards user, promo, properties, metadata and price. It normalizes mode into the checkout environment. session and continuity are declared but are not forwarded. Verify the actual processor sandbox before payment.

FieldTypeMeaning
continuity?ContinuityScopeDeclared in the type; the current mount() implementation does not forward it.
metadata?Record<string, string>Per-call Stripe-customer metadata. Eager strings only.
mode?"test" | "live" | "preview"Session mode request. The inspected SDK session endpoint permits test mode when the offer has test mode enabled or the caller is an authenticated member of its organization. It does not use a JWT mode claim or test-domain setting for this decision. Without a Stripe test integration, payment selection falls back to live Stripe even for a test session. Verify the selected payment connection before submitting payment. The SDK session endpoint does not enable preview.
price?string | string[]Plandalf price lookup key(s) to sell, using this offer as the checkout design. Replaces the offer's own items — e.g. a MemberPress membership page passes the price linked to that membership. Declarative: data-plandalf-price="gold-monthly,gold-setup-fee".
promo?stringPromo slug; the SDK resolves the active tier internally and applies its price.
properties?Record<string, unknown>Per-call form-field prefill. Wins over PlandalfConfig.properties on overlap.
session?string | nullDeclared in the type; the current mount() implementation does not forward it.
user?stringPer-call JWT override — overrides the global identify() for this mount.

Existing subscriptions

The inspected workspace SDK does not declare a subscription selector in FlowOpenOptions or MountOptions. A price lookup key selects what to sell. The inspected backend can derive a subscription target from a signed customer JWT and default the checkout intent to upgrade; that is a separate contract from a per-call SDK option. See customer identity. Before documenting an upgrade journey, verify the deployed route, subscription ownership checks, and the resulting provider subscription in an isolated sandbox. This reference does not sign off that journey.

Resolved flow

Awaiting the handle gives a Flow, after the inline checkout mounts. Its top-level fields are:

FieldTypeMeaning
harnessHarnessDefinitionThe flow's step and block definition.
idstringID for this flow instance.
stateFlowStateCurrent status, step, and context.
templateFlowTemplateOffer template used by the flow.

The flow.state object contains:

FieldTypeMeaning
contextFlowContextCustomer, cart, and payment context.
currentStepstring | nullCurrent step ID, or null.
error?ErrorCurrent error, if any.
statusFlowStatusCurrent flow lifecycle status.
stepDataRecord<string, unknown>Data stored by step ID.

The flow also provides methods such as close() and on().

Returns

FlowHandle<Flow>

Behaviour

The handle resolves when the flow has mounted, rather than when a purchase completes.

All plandalf methods

Feature detail