client.connect() for headless and
Customer API integrations. It handles authentication only, with no
payment-method setup or KYC steps. When the customer finishes, the SDK
decrypts the returned credentials and primes the client so that subsequent SDK
calls are authenticated automatically.
Call
client.getConnection()
first. The connection check primes the client with the token the Auth frame
needs. If you call setupAuth() without a prior connection check that
resolved with status: "connectionRequired", it returns a
configurationError.Setup auth
The promise returned by
client.setupAuth() resolves after the customer
completes the auth flow (or an error ends it). Track flow progress — including
the moment the UI is ready to show — through onEvent, not by awaiting the
promise.Parameters
AuthEvent
onEvent receives events as the auth flow progresses. Use event.kind to
decide how to handle each event.
AuthEventError
The error event payload comes from the underlying auth frame. It is
discriminated by code.
Result
client.setupAuth() returns a Result<AuthFrame, SetupAuthError>.
Result envelope
Result<AuthFrame, SetupAuthError>
AuthFrame
SetupAuthError
TS Definitions
TS Definitions
types.ts