KYC
Verify the user's identity. Pollar renders the entire provider-selection and verification flow inside a modal.
@pollar/react — hook & values used
All of these come from the usePollar() hook — the react layer built on top of getClient().
usePollar()hookparams: No arguments. Call it at the top level of a component — it reads React context, so it must run during render.
returns: PollarContextValue — the whole SDK surface: reactive state values, modal openers, and getClient() to drop down to core.
openKycModal(options?)syncparams: options?: { country?: string; level?: 'basic' | 'intermediate' | 'enhanced'; onApproved?: () => void } — wraps getKycProviders / startKyc / pollKycStatus.
returns: void — opens the prebuilt modal; there is nothing to await.
<KycStatus status={…} />componentparams: status: 'none' | 'pending' | 'approved' | 'rejected' — the badge to render.
returns: A ready-made status badge component, exported from @pollar/react.
@pollar/core — functions used
All of these are methods on the client returned by getClient() — the underlying PollarClient instance.
getKycProviders(country)asyncparams: country: string — an ISO 3166-1 alpha-2 code (e.g. 'MX').
returns: Promise<{ providers }> — the KYC providers available in that country.
startKyc(body)asyncparams: body: KycStartBody — { providerId: string; level: 'basic' | 'intermediate' | 'enhanced' }.
returns: Promise<KycStartResponse> — the verification session to hand off to the provider.
pollKycStatus(providerId, opts?)asyncparams: providerId: string; opts?: { intervalMs?, timeoutMs? } polling controls.
returns: Promise — resolves once the status settles to 'approved' | 'rejected' (from 'none' | 'pending').
getKycStatus(providerId?)asyncparams: providerId?: string — omit to read the user's overall status.
returns: Promise<{ status, level?, providerId }> — a one-shot read.
import { PollarClient } from '@pollar/core'; const client = new PollarClient({ apiKey, baseUrl }); await client.ready(); // 1. list providers for a country const { providers } = await client.getKycProviders('MX'); // 2. start verification with a provider const session = await client.startKyc({ providerId: providers[0].id, level: 'basic', }); // 3. poll until resolved const status = await client.pollKycStatus(providers[0].id); // status: 'none' | 'pending' | 'approved' | 'rejected'
import { usePollar, KycStatus } from '@pollar/react'; const { openKycModal } = usePollar(); // openKycModal wraps getKycProviders / startKyc / pollKycStatus. openKycModal({ country: 'MX', level: 'basic', onApproved: () => { // unlock features for verified users }, }); // elsewhere — render the badge: <KycStatus status={kycStatus} />