SponsorkitCoreOptions

Options shared by every Sponsorkit flavour.

On this page

Options shared by every Sponsorkit flavour.

import type { SponsorkitCoreOptions } from "@sponsorkit/sdk";

interface SponsorkitCoreOptions { … }

Interface, exported from @sponsorkit/sdk, @sponsorkit/sdk/node.

Properties#

github#

github?: string

GitHub user or organization login that receives sponsorships.

openCollective#

openCollective?: string

Open Collective collective slug that receives contributions.

cacheTtl#

cacheTtl?: number

Seconds a cached result is served without calling the API. Default 3600, minimum 60.

mock#

mock?: MockOption

Mock mode: a preset name or { contributions }. Overrides SPONSORKIT_MOCK.

Type: MockOption

storage#

storage?: SponsorkitStorage | WebStorageLike

Where the session token, cache and nag state live. Accepts a SponsorkitStorage or a Web Storage object.

Type: SponsorkitStorage, WebStorageLike

apiBaseUrl#

apiBaseUrl?: string

API origin used for every API call (/api/v1/…), for self-hosting and tests. Default https://api.sponsorkit.io. An empty string counts as unset.

siteBaseUrl#

siteBaseUrl?: string

Site base URL (origin plus optional base path) used for every page: /connect/, /checkout/, checkoutUrl() and the loopback checkout redirect. Default https://ffmathy.github.io/sponsorkit, or apiBaseUrl when that is set and this isn't (single-origin self-hosting, tests). An empty string counts as unset; trailing slashes are trimmed.

env#

env?: Env

Environment used for SPONSORKIT_DISABLE, SPONSORKIT_MOCK, SPONSORKIT_NO_NAG, SPONSORKIT_DEV_CHECKS and CI. When given, it replaces the process environment for these variables (it is not merged). Default: the process environment.

Type: Env

devChecks#

devChecks?: boolean

Forces the dev-time target existence check on or off. Default: on when SPONSORKIT_DEV_CHECKS is set (in env) or process.env.NODE_ENV is development (bundlers inline it), off otherwise.

signInTimeout#

signInTimeout?: number

Seconds to wait for a sign-in (popup, loopback or paste-back) before rejecting with timeout. Default 300.

checkoutPollInterval#

checkoutPollInterval?: number

Seconds between checkout polls. Default 60.

clock#

clock?: () => number

Clock in epoch milliseconds, used for cache TTL, Retry-After and nag timing. Default Date.now.

fetch#

fetch?: FetchLike

Custom fetch implementation. Default: the global fetch.

Type: FetchLike

requestTimeout#

requestTimeout?: number

Seconds before an API request is abandoned. getFinancialContribution() then serves the stale cache; the sign-in code exchange rejects with network_error. Default 30; 0 disables the limit.

interactive#

interactive?: boolean

Whether the app runs interactively, for nag().due(). Overrides platform detection (TTY on native).