Skip to Content
SdkReactHooksuseCredits

useCredits

useCredits(options: object): UseCreditsResult

Defined in: src/react/useCredits.ts:85 

React hook for managing credits: checking balance, claiming daily credits, browsing packs, and purchasing credits.

Parameters

ParameterTypeDescription

options

object

options.autoFetch?

boolean

Whether to fetch credit balance automatically on mount (default: true)

options.baseUrl?

string

Optional base URL for the API requests.

options.getToken?

() => Promise<string | null>

Custom function to get auth token for API calls

options.onError?

(error: Error) => void

Optional callback for error handling

Returns

UseCreditsResult

Last updated on