/** * Central onpaymentauthorized orchestrator. * * The BFF /v1/wallet/purchase orchestrates ALL backend logic: * - Eligibility check * - Passwordless user registration (if anonymous) * - Basket creation * - Payment finalization * * This handler is responsible for: * 1. Local billing/shipping contact validation (keeps Apple Pay sheet open on error) * 2. Calling the single /v1/wallet/purchase endpoint * 3. Handling success → redirect to /checkout/complete * 4. Handling structured BFF errors → deterministic UI actions per errorType */ import type { SessionResponse } from './types'; import { ApplePayEntryPoint } from '../../constants'; export type PaymentHandlerConfig = { skuId: string; country: string; currency: string; /** `checkout-redirect` to persist, or `null` to leave the host's value untouched. */ returnUrl: string | null; supportedBillingCountries: string[]; recaptchaToken: string; /** When FREE_TRIAL_POPUP and the session is logged in, complete is opened with status=nspc. */ entryPoint?: ApplePayEntryPoint | ''; }; export declare function handlePaymentAuthorized(event: ApplePayJS.ApplePayPaymentAuthorizedEvent, session: ApplePaySession, sessionData: SessionResponse, config: PaymentHandlerConfig): Promise;