Create a wallet session
Overview
Manages authentication and creates wallet elements.
The WalletSession handles token management, element creation, and provides convenience methods for showing wallet elements in modals.
For v1, mint the token via the existing whop.accessTokens.create({ company_id }) flow —
the same backend mutation that powers PayoutsSession. No new mutation is required.
Examples
Basic usage
Options
Events
Events emitted by the WalletSession.
Listen to these events using the on() method.
optionsUpdated
Emitted when the session options are updated via updateOptions().
Callback signature: (options: ExpandedWalletSessionOptions) => void
tokenRefreshed
Emitted when the authentication token is refreshed.
Callback signature: (token: string) => void
tokenRefreshError
Emitted when token refresh fails.
Callback signature: (error: unknown) => void
error
Emitted when an error occurs during session operation.
Callback signature: (error: unknown) => void
ready
Emitted when the session is ready and authenticated.
Callback signature: (void) => void
Methods
createElement(type, options)
Create a new element instance.
Returns: WalletSessionElements[T] extends [unknown, infer E] ? E : never
updateOptions(options)
Update the session options after initialization.
Changes will be propagated to all active elements.
destroy()
Destroy the session and clean up all mounted elements.
Call this when you no longer need the session to free up resources.

