import { Payment } from './usePaymentPolling'; import { ThreedsProvider } from './useThreeds'; export interface ApplePayToken { id: string; type: string; card: { bin: string; last4: string; expiration_month: number; expiration_year: number; brand: string; }; } export interface CardPaymentMethod { cardNumber: string; expiryDate: string; cvc: string; cardholderName?: string; } export interface Order { id: string; status: string; totalAmount: number; currency: string; } export interface PaymentResponse { paymentId: string; payment: Payment; order?: Order; } export interface PaymentOptions { enableThreeds?: boolean; threedsProvider?: ThreedsProvider; initiatedBy?: 'customer' | 'merchant'; source?: 'upsell' | 'checkout' | 'offer' | 'missing_club' | 'forced'; /** * Shipping rate selected by the customer. Forwarded on the payment * request so the order is created with the right shipping method * even if the session's stored rate hasn't fully round-tripped or * got cleared (race conditions). */ shippingRateId?: string; onSuccess?: (payment: Payment) => void; onFailure?: (error: string) => void; onRequireAction?: (payment: Payment) => void; } export interface PaymentInstrumentResponse { id: string; token: string; type: string; card?: { maskedCardNumber?: string; expirationMonth?: number; expirationYear?: number; brand?: string; }; } export interface PaymentInstrumentListItem { id: string; type: string; customerId: string; accountId: string; isActive: boolean; isDefault: boolean; tokenizer: string | null; createdAt: Date | null; updatedAt: Date | null; card?: { last4?: string; expirationMonth?: number; expirationYear?: number; brand?: string; bin?: string; }; metadata?: any; } export interface PaymentInstrumentCustomer { id: string; type: 'card'; card: { last4: string; exp_month: number; exp_year: number; brand: string; bin: string; }; us_bank_account: null; sepa_debit: null; tokenizer: string; token: string; isDefault: boolean; isActive: boolean; metadata: Record; customerId: string; accountId: string; createdAt: string; updatedAt: string; } export type PaymentInstrumentCustomerResponse = PaymentInstrumentCustomer[]; export interface PaymentHook { processCardPayment: (checkoutSessionId: string, cardData: CardPaymentMethod, options?: PaymentOptions) => Promise; processApplePayPayment: (checkoutSessionId: string, applePayToken: ApplePayToken, options?: PaymentOptions) => Promise; processPaymentWithInstrument: (checkoutSessionId: string, paymentInstrumentId: string, options?: PaymentOptions) => Promise; createCardPaymentInstrument: (cardData: CardPaymentMethod) => Promise; createApplePayPaymentInstrument: (applePayToken: ApplePayToken) => Promise; getCardPaymentInstruments: () => Promise; isLoading: boolean; error: string | null; clearError: () => void; currentPaymentId: string | null; } export declare function usePayment(): PaymentHook;