Skip to main content

Overview

Manages authentication and creates payout elements. The PayoutsSession handles token management, element creation, and provides convenience methods for showing elements in modals.

Examples

Basic usage

Creating elements

Using modal methods

Options

Events

Events emitted by the PayoutsSession. Listen to these events using the on() method.

optionsUpdated

Emitted when the session options are updated via updateOptions(). Callback signature: (options: ExpandedPayoutsSessionOptions) => 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: PayoutsSessionElements[T][1]

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.

showWithdrawModal(options, force)

Show the withdraw element in a modal overlay. By default, the modal auto-closes on completion (onWithdraw) or dismiss (onClose). Call ev.preventDefault() in a callback to prevent auto-close. Returns: Force extends true ? ModalContainer : ModalContainer | undefined

showAddPayoutMethodModal(options, force)

Show the add payout method element in a modal overlay. By default, the modal auto-closes on completion (onComplete) or dismiss (onClose). Call ev.preventDefault() in a callback to prevent auto-close. Returns: Force extends true ? ModalContainer : ModalContainer | undefined

showAutomaticWithdrawModal(options, force)

Show the automatic withdraw settings element in a modal overlay. By default, the modal auto-closes on completion (onComplete) or dismiss (onClose). Call ev.preventDefault() in a callback to prevent auto-close. Returns: Force extends true ? ModalContainer : ModalContainer | undefined

showVerifyModal(options, force)

Show the identity verification element in a modal overlay. By default, the modal auto-closes on completion (onVerificationSubmitted) or dismiss (onClose). Call ev.preventDefault() in a callback to prevent auto-close. Returns: Force extends true ? ModalContainer : ModalContainer | undefined

showWithdrawalBreakdownModal(options, force)

Show the withdrawal breakdown element in a modal overlay. By default, the modal auto-closes on dismiss (onClose). Call ev.preventDefault() in a callback to prevent auto-close. Returns: Force extends true ? ModalContainer : ModalContainer | undefined

showChangeAccountCountryModal(options, force)

Show the change account country element in a modal overlay. By default, the modal auto-closes on completion (onCountryChanged) or dismiss (onClose). Call ev.preventDefault() in a callback to prevent auto-close. Returns: Force extends true ? ModalContainer : ModalContainer | undefined

showResetAccountModal(options, force)

Show the reset account element in a modal overlay. By default, the modal auto-closes on completion (onReset) or dismiss (onClose). Call ev.preventDefault() in a callback to prevent auto-close. Returns: Force extends true ? ModalContainer : ModalContainer | undefined

showAvailableCashBreakdownModal(options, force)

Show the available cash breakdown element in a modal overlay. By default, the modal auto-closes on dismiss (onClose). Call ev.preventDefault() in a callback to prevent auto-close. Returns: Force extends true ? ModalContainer : ModalContainer | undefined

showGenerateWithdrawalReceiptModal(options, force)

Show the generate withdrawal receipt element in a modal overlay. By default, the modal auto-closes on completion (onReceiptRequested) or dismiss (onClose). Call ev.preventDefault() in a callback to prevent auto-close. Returns: Force extends true ? ModalContainer : ModalContainer | undefined

showPendingBreakdownModal(options, force)

Show the pending breakdown element in a modal overlay. By default, the modal auto-closes on dismiss (onClose). Call ev.preventDefault() in a callback to prevent auto-close. Returns: Force extends true ? ModalContainer : ModalContainer | undefined

showReserveBreakdownModal(options, force)

Show the reserve breakdown element in a modal overlay. By default, the modal auto-closes on dismiss (onClose). Call ev.preventDefault() in a callback to prevent auto-close. Returns: Force extends true ? ModalContainer : ModalContainer | undefined

showTreasuryBreakdownModal(options, force)

Show the treasury breakdown element in a modal overlay. By default, the modal auto-closes on dismiss (onClose). Call ev.preventDefault() in a callback to prevent auto-close. Returns: Force extends true ? ModalContainer : ModalContainer | undefined