> ## Documentation Index
> Fetch the complete documentation index at: https://docs.payluk.ng/llms.txt
> Use this file to discover all available pages before exploring further.

# SDK reference

> Every export, type and default in payluk-escrow-inline-checkout.

Package: **`payluk-escrow-inline-checkout`** · License: MIT · Peer dependency:
`react >= 17` (only for the React entry point).

## Entry points

| Import path                           | Exports                                                                   |
| ------------------------------------- | ------------------------------------------------------------------------- |
| `payluk-escrow-inline-checkout`       | `initEscrowCheckout`, `pay`, `EscrowCheckoutError`, and all core types.   |
| `payluk-escrow-inline-checkout/react` | `useEscrowCheckout`, `EscrowCheckoutButton`, `EscrowCheckoutButtonProps`. |

Both CommonJS and ESM builds are published, with bundled type definitions. The
package is side-effect free (tree-shakeable).

## Functions

```ts theme={null}
function initEscrowCheckout(config: InitConfig): void;
function pay(input: PayInput): Promise<void>;
```

## Types

```ts theme={null}
interface InitConfig {
  publicKey: string;
  scriptUrlOverride?: string;
  globalName?: string;
  crossOrigin?: '' | 'anonymous' | 'use-credentials';
}

interface PayInput {
  paymentToken: string | string[];
  reference: string;
  redirectUrl: string;
  logoUrl?: string;
  brand?: string;
  customerId?: string;
  extra?: Record<string, unknown>;
  callback?: (result: any) => void;
  onClose?: () => void;
}

interface SessionResponse {
  session: unknown;
}

type EscrowWidget = (options: Record<string, unknown>) => void;

type EscrowCheckoutErrorCode =
  | 'NOT_INITIALIZED'
  | 'BROWSER_ONLY'
  | 'INVALID_INPUT'
  | 'WIDGET_LOAD'
  | 'NETWORK'
  | 'SESSION_CREATE'
  | 'SESSION_RESPONSE';
```

## React types

```ts theme={null}
interface UseEscrowCheckoutResult {
  ready: boolean;
  loading: boolean;
  error: Error | null;
  pay: typeof pay;
}

function useEscrowCheckout(): UseEscrowCheckoutResult;

interface EscrowCheckoutButtonProps {
  paymentToken: string | string[];
  reference: string;
  redirectUrl: string;
  children?: React.ReactNode;
  disabled?: boolean;
  className?: string;
  title?: string;
  brand?: string;
  customerId?: string;
  logoUrl?: string;
  callback?: (result: any) => void;
  onClose?: () => void;
  extra?: Record<string, unknown>;
}
```

## Error class

```ts theme={null}
class EscrowCheckoutError extends Error {
  code: EscrowCheckoutErrorCode;
  status?: number;
  details?: unknown;
  constructor(
    message: string,
    code: EscrowCheckoutErrorCode,
    options?: { status?: number; details?: unknown },
  );
}
```

See [Error handling](/sdk/errors) for what each code means.

## Defaults

| Setting           | Default value                                       |
| ----------------- | --------------------------------------------------- |
| Widget script URL | `https://checkout.payluk.ng/escrow-checkout.min.js` |
| Global name       | `EscrowCheckout`                                    |
| `crossOrigin`     | `anonymous`                                         |
| Live API base     | `https://live.payluk.ng`                            |
| Staging API base  | `https://staging.live.payluk.ng`                    |

<Note>
  The SDK selects the live or staging base automatically based on your
  publishable key. The widget script URL and global name can be overridden via
  `scriptUrlOverride` and `globalName` in [`InitConfig`](/sdk/javascript#1-initialize)
  for advanced/self-hosted setups.
</Note>
