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
| Name | Type | Meaning |
|---|---|---|
target | HTMLElement | string | Element or CSS selector to mount into. |
slug | string | Published offer slug. |
opts? | MountOptions | Inline mount options passed through to the class. The browser wrapper declares this argument as any and passes it to the typed class method. |
Example
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.
| Field | Type | Meaning |
|---|---|---|
continuity? | ContinuityScope | Declared 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? | string | Promo 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 | null | Declared in the type; the current mount() implementation does not forward it. |
user? | string | Per-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:
| Field | Type | Meaning |
|---|---|---|
harness | HarnessDefinition | The flow's step and block definition. |
id | string | ID for this flow instance. |
state | FlowState | Current status, step, and context. |
template | FlowTemplate | Offer template used by the flow. |
The flow.state object contains:
| Field | Type | Meaning |
|---|---|---|
context | FlowContext | Customer, cart, and payment context. |
currentStep | string | null | Current step ID, or null. |
error? | Error | Current error, if any. |
status | FlowStatus | Current flow lifecycle status. |
stepData | Record<string, unknown> | Data stored by step ID. |
The flow also provides methods such as close() and on().
Returns
Behaviour
The handle resolves when the flow has mounted, rather than when a purchase completes.