import { PayPalPresentationModeOptions, PayPalOneTimePaymentSessionOptions, BasePaymentSessionReturn } from "../types"; export type UsePayPalOneTimePaymentSessionProps = ((Omit & { createOrder: () => Promise<{ orderId: string; }>; orderId?: never; }) | (PayPalOneTimePaymentSessionOptions & { createOrder?: never; orderId: string; })) & PayPalPresentationModeOptions; /** * Hook for managing one-time payment sessions with PayPal. * * The hook returns an `isPending` flag that indicates whether the SDK instance is still being * initialized. This is useful when using deferred clientToken loading - buttons should wait * to render until `isPending` is false. * * @returns Object with: `error` (any session error), `isPending` (SDK loading), `handleClick` (starts session), `handleCancel` (cancels session), `handleDestroy` (cleanup) * * @example * function PayPalCheckoutButton() { * const { isPending, error, handleClick, handleCancel } = usePayPalOneTimePaymentSession({ * orderId: "ORDER-123", * presentationMode: "auto", * onApprove: (data) => console.log("Approved:", data), * }); * * if (isPending) return null; * if (error) return
Error: {error.message}
; * * return ( * * ); * } */ export declare function usePayPalOneTimePaymentSession({ presentationMode, fullPageOverlay, autoRedirect, createOrder, orderId, savePayment, testBuyerCountry, ...callbacks }: UsePayPalOneTimePaymentSessionProps): BasePaymentSessionReturn;