The SDK runs in the browser, in the host page. The Clink-hosted iframe handles cards, credentials, and 3DS; the host receives identifiers and events only.
Install
new AgentElements(options)
Creates the SDK instance and resolves the Clink app address for the environment.
Which Clink app address to use. See Environment mapping.
Appearance and locale settings. See Preset options.
Preset options
Preset options are applied when the SDK sendsinit. setLocale updates the language at runtime; the color and radius options cannot change after construction.
Element credentials
Credentials are passed per element when callingcreateElement:
A card-session token issued by your server (scope
card:manage, 1799s). Required and non-empty; held in memory only.A server-issued one-time session id (valid for about 30 minutes). The element exchanges it for a vault token; the host never holds that token.
Methods
Creates the element for
type with its credentials: paymentMethods takes { token }, vault takes { vaultId }. An instance can create one element; a second call throws, and missing or empty credentials throw. The element is not rendered until mount() is called.Updates the locale. Before
mount, it is sent with the next init. After mount, the iframe receives set-locale immediately.Unmounts the element, closes any open 3DS overlay, removes message listeners, and clears event subscriptions. Idempotent. The instance cannot be reused;
createElement and setLocale throw after destroy().Errors
AgentElement
An element is created by createElement and owns its event subscriptions.
paymentMethods only. Updates the element’s card-session token: before mount, it is sent with the next init; after mount, the iframe receives set-token and reloads its card data. An empty value throws. The vault credential is a one-time vaultId and cannot be refreshed.Mounts the iframe.
target is a CSS selector or an HTMLElement. The container must exist. See Mount options.Removes the wrapper and iframe. Event subscriptions are kept, so the element can be mounted again. A remount reloads the iframe.
Mount options
Display switches and primary button styling passed tomount(). They are applied to the next mount only. The option type depends on the element type, so passing a field the element does not support fails at compile time.
paymentMethods
Appearance of the primary action button. See Button options.
vault
Appearance of the primary action button. See Button options.
Button options
The primary action button is the “Add card”, “Unlock card”, or “Continue” button at the bottom of the element.height alone. Values that are not numbers or fall outside the supported range (height 16–200, font size 8–40, radius 0–100) are ignored. List action buttons (set default, delete) and retry buttons are not affected.
Events
Events are scoped to the element. The event name and payload are inferred from the element type.paymentMethods events
vault events
error.source:
Subscriptions survive
unmount() and are cleared only by destroy().
Environment mapping
environment is required: use sandbox (UAT) while integrating and production after go-live.
Module exports
version is injected at build time. When the SDK is used directly from source, it reports 0.0.0-dev.
Types
Package formats
The package has no CommonJS build. The internal iframe bridge is bundled into the output, so the published package has no private runtime dependency.
Script tag
<script> tag, the SDK is exposed on the ClinkAgentElements global. Pin @<version> to a concrete version in production.