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

Entry points

Import pathExports
payluk-escrow-inline-checkoutinitEscrowCheckout, pay, EscrowCheckoutError, and all core types.
payluk-escrow-inline-checkout/reactuseEscrowCheckout, EscrowCheckoutButton, EscrowCheckoutButtonProps.
Both CommonJS and ESM builds are published, with bundled type definitions. The package is side-effect free (tree-shakeable).

Functions

function initEscrowCheckout(config: InitConfig): void;
function pay(input: PayInput): Promise<void>;

Types

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

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

class EscrowCheckoutError extends Error {
  code: EscrowCheckoutErrorCode;
  status?: number;
  details?: unknown;
  constructor(
    message: string,
    code: EscrowCheckoutErrorCode,
    options?: { status?: number; details?: unknown },
  );
}
See Error handling for what each code means.

Defaults

SettingDefault value
Widget script URLhttps://checkout.payluk.ng/escrow-checkout.min.js
Global nameEscrowCheckout
crossOriginanonymous
Live API basehttps://live.payluk.ng
Staging API basehttps://staging.live.payluk.ng
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 for advanced/self-hosted setups.