import type { PayPalGuestOneTimePaymentSessionOptions, PayPalGuestOneTimePaymentSessionPromise, PayPalGuestPresentationModeOptions } from "@paypal/paypal-js/sdk-v6"; import type { BasePaymentSessionReturn } from "../types"; interface PayPalGuestPaymentSessionReturn extends BasePaymentSessionReturn { buttonRef: { current: HTMLElement | null; }; } type PayPalGuestPresentationModeHookOptions = Omit; export type UsePayPalGuestPaymentSessionProps = ((Omit & { createOrder: () => PayPalGuestOneTimePaymentSessionPromise; orderId?: never; }) | (PayPalGuestOneTimePaymentSessionOptions & { createOrder?: never; orderId: string; })) & PayPalGuestPresentationModeHookOptions; /** * `usePayPalGuestPaymentSession` is used to interface with a guest checkout session. Guest checkout * sessions require a `` to target for displaying the guest checkout form. * * @returns Object with: `buttonRef` (ref for the target button element), `error` (any session error), `isPending` (SDK loading), `handleClick` (starts session), `handleCancel` (cancels session), `handleDestroy` (cleanup) * * @example * function GuestCheckoutButton() { * const { buttonRef, error, isPending, handleClick, handleCancel } = * usePayPalGuestPaymentSession({ * createOrder: async () => ({ orderId: 'ORDER-123' }), * onApprove: (data) => console.log('Approved:', data), * onCancel: () => console.log('Cancelled'), * }); * * if (isPending) return null; * if (error) return
Error: {error.message}
; * * return ( * * * * ); * } */ export declare function usePayPalGuestPaymentSession({ fullPageOverlay, createOrder, orderId, onShippingAddressChange, onShippingOptionsChange, ...callbacks }: UsePayPalGuestPaymentSessionProps): PayPalGuestPaymentSessionReturn; export {};