import { i as PaymentMethod, n as PaymentKitEnvironment } from "../types-Cjcc3xak.mjs"; import "../connect-card-CZhzK_Tp.mjs"; import "../connect-tunnel-x-BKtMfoGh.mjs"; import { a as ApplePayEncryptedToken } from "../airwallex-apple-pay-adapter-CnnZ7VL6.mjs"; import { t as ApplePayMockScenario } from "../stripe-apple-pay-adapter-D2OJRlAl.mjs"; //#region src/payment-methods/apple-pay.d.ts type ApplePayCustomerInfo = { first_name: string; last_name: string; email?: string; }; type ApplePayStartRequest = { processor_id: string; customer_info?: ApplePayCustomerInfo; fraud_metadata?: { ipAddress?: string; browserInfo?: { [key: string]: unknown; }; processorFraudInfo?: { [key: string]: unknown; }; }; mock_scenario?: string; validation_url?: string; initiative_context?: string; }; type ApplePayStartResponse = { amount: number; currency: string; country: string; stripe_pk?: string; checkout_attempt_id?: string; merchant_session?: { [key: string]: unknown; }; }; type Airwallex3dsNextAction = { type: "airwallex_3ds"; url: string; }; type ApplePayConfirmRequest = { processor_id?: string; customer_info?: ApplePayCustomerInfo; fraud_metadata?: { ipAddress?: string; browserInfo?: { [key: string]: unknown; }; processorFraudInfo?: { [key: string]: unknown; }; }; payment_method_id?: string; apple_pay_token?: ApplePayEncryptedToken | { [key: string]: unknown; }; payer_email?: string; payer_first_name?: string; payer_last_name?: string; mock_scenario?: string; }; type ApplePayConfirmResponse = { charge_status: "success" | "fail" | "pending"; transaction_id?: string; error_code?: string; error_message_for_customer?: string; error_message_for_debug?: string; checkout_attempt_id: string; checkout_session_id?: string; next_action?: Airwallex3dsNextAction; payment_intent_id?: string; customer_id?: string; payment_method_id?: string; processor_used?: string; subscription_id?: string; invoice_id?: string; invoice_number?: number; card_brand?: string; card_last4?: string; card_exp_month?: number; card_exp_year?: number; }; type ApplePaySubmitOptions = { /** Processor external ID — optional when using auto-prepare (SDK fetches from checkout session) */ processorId?: string; processorType?: "stripe" | "airwallex"; customerInfo: ApplePayCustomerInfo; mockScenario?: ApplePayMockScenario; amount?: number; currency?: string; /** Country code — optional when using auto-prepare (fetched from backend) */ country?: string; merchantName?: string; }; /** * Pre-fetch Apple Pay data and prepare the PaymentRequest. * Call this when the checkout page loads, NOT in the click handler. * * For Stripe: pre-fetches data and prepares PaymentRequest for immediate show. * For Airwallex: returns success with processor="airwallex" so submit uses native ApplePaySession. * * @deprecated The SDK now calls this automatically on init. Use `onApplePayReady` to observe * readiness and `notifyAmountChanged` to trigger re-prepare after amount changes. */ declare function prepareApplePay(apiBaseUrl: string, secureToken: string, options: ApplePaySubmitOptions, environment: PaymentKitEnvironment): Promise<{ success: boolean; error?: string; applePay?: boolean; }>; /** * Check if Apple Pay has been prepared and is ready. */ declare function isApplePayPrepared(): boolean; /** * Clear prepared state (call on unmount or when checkout changes). */ declare function clearPreparedApplePay(): void; declare const ApplePayPaymentMethod: PaymentMethod<{ /** * @deprecated The SDK now prepares automatically on init. Use `onApplePayReady` to observe * readiness and `notifyAmountChanged` to trigger re-prepare after amount changes. */ prepareApplePay: (options: ApplePaySubmitOptions) => Promise<{ success: boolean; error?: string; applePay?: boolean; }>; /** * Register a callback to be notified when Apple Pay becomes ready (or stops being ready). * Fires immediately with the current state, then on every state change. * Multiple registrations are all notified — none are silently overwritten. * * @example * paymentKit.apple_pay.onApplePayReady((isReady) => { * applePayButton.disabled = !isReady; * }); */ onApplePayReady: (callback: (isReady: boolean) => void) => void; /** * Notify the SDK that the payment amount has changed (e.g. coupon applied). * The SDK will disable Apple Pay, re-prepare with the new amount, then re-enable. * The returned promise resolves when re-prepare is fully complete. * * @example * await paymentKit.apple_pay.notifyAmountChanged(); */ notifyAmountChanged: () => Promise; }, "apple_pay">; //#endregion export { Airwallex3dsNextAction, ApplePayConfirmRequest, ApplePayConfirmResponse, ApplePayCustomerInfo, ApplePayMockScenario, ApplePayStartRequest, ApplePayStartResponse, ApplePaySubmitOptions, clearPreparedApplePay, ApplePayPaymentMethod as default, isApplePayPrepared, prepareApplePay }; //# sourceMappingURL=apple-pay.d.mts.map