import type { BasePaymentSessionReturn, CreateOrderCallback, PayLaterOneTimePaymentSessionOptions, PayPalPresentationModeOptions } from "../types"; export type UsePayLaterOneTimePaymentSessionProps = ((Omit & { createOrder: CreateOrderCallback; orderId?: never; }) | (PayLaterOneTimePaymentSessionOptions & { createOrder?: never; orderId: string; })) & PayPalPresentationModeOptions; /** * Hook for managing Pay Later one-time payment sessions. * * This hook creates and manages a Pay Later payment session. It handles session lifecycle, resume flows * for redirect-based presentation modes (`"redirect"` and `"direct-app-switch"`), and provides methods * to start, cancel, and destroy the session. * * @returns Object with: `error` (any session error), `isPending` (SDK loading), `handleClick` (starts session), `handleCancel` (cancels session), `handleDestroy` (cleanup) * * @example * function PayLaterCheckoutButton() { * const { error, isPending, handleClick, handleCancel } = usePayLaterOneTimePaymentSession({ * presentationMode: 'popup', * createOrder: async () => ({ orderId: 'ORDER-123' }), * onApprove: (data) => console.log('Approved:', data), * onCancel: () => console.log('Cancelled'), * }); * const { eligiblePaymentMethods } = usePayPal(); * const payLaterDetails = eligiblePaymentMethods?.getDetails?.("paylater"); * * if (isPending) return null; * if (error) return
Error: {error.message}
; * * return ( * * ); * } */ export declare function usePayLaterOneTimePaymentSession({ presentationMode, fullPageOverlay, autoRedirect, createOrder, orderId, ...callbacks }: UsePayLaterOneTimePaymentSessionProps): BasePaymentSessionReturn;