Use this file to discover all available pages before exploring further.
Once initialized, the Benji Connect SDK exposes the methods below. User-driven outcomes are delivered through the callbacks you passed in the initialization step.
Callbacks match the @benji-money/connect-sdk contract. Types below are exported as BenjiConnectEventType, BenjiConnectExitTrigger, and related interfaces for TypeScript users.
Fired when the Connect flow completes successfully (transport event FLOW_SUCCESS). This is the signal that the user finished link, transfer, or redeem as configured by the connect token (modes).
Hide onSuccess
Arguments
token (string) — Short-lived exchange token. Use it with Exchange Token to obtain access and refresh tokens for user-scoped APIs. Exchange it promptly (see the Exchange Token page for validity).
metadata — Payload aligned with BenjiConnectOnSuccessMetadata:
context — SDK context (namespace, version).
action (optional) — One of connect, transfer, redeem (BenjiConnectAuthAction).
user_data (optional) — Structured user and status:
Fired for mid-flow and auxiliary transport events. The first argument is type (BenjiConnectEventType).
Hide onEvent
Arguments
type — Values you may see include:
AUTH_SUCCESS — Mid-flow authentication success. Delivered to onEvent only (not onSuccess). Use for progress or analytics; metadata can include action, user, and token-related fields.
EVENT — Generic events with additional fields in metadata.
Other values may be forwarded for forward compatibility.
metadata — Varies by type; always includes context. Additional keys are merged from the payload when present.
Routing (important):
FLOW_SUCCESS invokes onSuccess with the exchange token — not onEvent.
FLOW_EXIT invokes onExit — not onEvent.
ERROR invokes onError.
Practical distinction: Implement onSuccess for “flow completed + exchange token.” Use onEvent when you need mid-flow AUTH_SUCCESS or generic EVENT data before completion.