Skip to main content

SolvaPayConfig

SolvaPay SDK


SolvaPay SDK / react/src / SolvaPayConfig

Interface: SolvaPayConfig

Defined in: packages/react/src/types/index.ts:66

SolvaPay Provider Configuration Sensible defaults for minimal code, but fully customizable

Properties

api?

optional api: object

Defined in: packages/react/src/types/index.ts:71

API route configuration Defaults to standard Next.js API routes

checkSubscription?

optional checkSubscription: string

createPayment?

optional createPayment: string

processPayment?

optional processPayment: string


auth?

optional auth: object

Defined in: packages/react/src/types/index.ts:81

Authentication configuration Uses adapter pattern for flexible auth provider support

adapter?

optional adapter: AuthAdapter

Auth adapter instance Default: checks localStorage for 'auth_token' key

Example
import { createSupabaseAuthAdapter } from '@solvapay/react-supabase';

<SolvaPayProvider
config={{
auth: {
adapter: createSupabaseAuthAdapter({
supabaseUrl: process.env.NEXT_PUBLIC_SUPABASE_URL!,
supabaseAnonKey: process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!,
})
}
}}
>

getToken()?

optional getToken: () => Promise<string | null>

Returns

Promise<string | null>

Deprecated

Use adapter instead. Will be removed in a future version. Function to get auth token

getUserId()?

optional getUserId: () => Promise<string | null>

Returns

Promise<string | null>

Deprecated

Use adapter instead. Will be removed in a future version. Function to get user ID (for cache key)


fetch()?

optional fetch: {(input, init?): Promise<Response>; (input, init?): Promise<Response>; }

Defined in: packages/react/src/types/index.ts:121

Custom fetch implementation Default: uses global fetch

Call Signature

(input, init?): Promise<Response>

MDN Reference

Parameters
input

URL | RequestInfo

init?

RequestInit

Returns

Promise<Response>

Call Signature

(input, init?): Promise<Response>

MDN Reference

Parameters
input

string | Request | URL

init?

RequestInit

Returns

Promise<Response>


headers?

optional headers: HeadersInit | () => Promise<HeadersInit>

Defined in: packages/react/src/types/index.ts:127

Request headers to include in all API calls Default: empty


onError()?

optional onError: (error, context) => void

Defined in: packages/react/src/types/index.ts:133

Custom error handler Default: logs to console

Parameters

error

Error

context

string

Returns

void