/** The buyer's Link authentication outcome. */ type StripeAuthenticationResult = { crypto_customer_id?: string; result: 'success' | 'abandoned' | 'declined'; }; /** collectPaymentMethod's completion payload — the token the commit needs. */ type StripeCollectPaymentMethodResult = { cryptoPaymentToken: string; paymentMethodDetails: { type: string; } | null; }; export type StripeKycInfo = { given_name?: string; surname?: string; address?: { country: string; city?: string; line1?: string; line2?: string; postal_code?: string; state?: string; }; id_number?: { type: 'us_ssn'; value: string; }; date_of_birth?: { day: number; month: number; year: number; }; /** ISO-3166 alpha-2 codes. REQUIRED for buyers with an EU address. */ nationalities?: string[]; /** Required by Stripe for buyers with an EU address. */ birth_city?: string; birth_country?: string; }; /** How a wallet sheet is offered in the payment element. */ type StripeWalletPreference = 'auto' | 'never' | 'always'; /** The EU regimes that make Stripe ask for more than basic identity. */ type StripeRegulationType = 'eu_carf' | 'eu_mica'; /** One national identifier, e.g. `{ type: 'de_stn', value: '…' }`. */ type StripeIdentifier = { type: string; value: string; }; type StripeIdentifierRequirement = { type: string; regulation: StripeRegulationType; }; /** * A requirement Stripe will accept in more than one form — e.g. Malta takes an * identity card OR a passport. Satisfying any member of the alternative set * clears the originals. */ type StripeAlternativeGroup = { original_missing_identifiers: string[]; alternative_missing_identifiers: string[]; }; export type StripeIdentifierRequirements = { identifiers: StripeIdentifierRequirement[]; alternatives: StripeAlternativeGroup[]; carf_tin_required: boolean; }; /** updateKycInfo's verdict: `completed` ends the loop, anything listed repeats it. */ type StripeUpdateKycResult = StripeIdentifierRequirements & { completed: boolean; invalid_identifiers: string[]; }; /** The destination wallet as Link holds it; unverified ones need a signature. */ type StripeConsumerWallet = { id: string; verified_ownership?: boolean; }; /** A message the buyer's wallet must sign to prove ownership (EU travel rule). */ type StripeWalletOwnershipChallenge = { challengeId: string; message: string; walletAddress?: string; network?: string; expiresAt?: string; }; type StripeAttestationResult = { result: 'confirmed' | 'abandoned'; }; /** * The subset of Stripe's OnrampCoordinator the widget uses. `authenticate` and * `collectPaymentMethod` resolve with elements the caller mounts; the rest are * plain calls. * * Hand-written against `@stripe/crypto` because the runtime is script-injected * rather than bundled. Keep member types identical to the published ones: a * narrower copy silently hides capability — this declared the wallet * preferences as 'auto' | 'never', which is why nothing caught the payment * element being asked for a card form on an Apple Pay purchase. */ export type StripeOnrampCoordinator = { registerLinkUser: (email: string, phone: string, country: string, fullName?: string) => Promise<{ created: boolean; }>; authenticate: (linkAuthIntentId: string, onCompletion: (result: StripeAuthenticationResult) => void) => Promise; submitKycInfo: (params: StripeKycInfo) => Promise; registerWalletAddress: (walletAddress: string, network: string) => Promise; /** Which national identifiers this buyer still owes, per EU regulation. */ getMissingIdentifiers: () => Promise; /** Submit identifiers; repeat while `completed` is false. */ updateKycInfo: (identifiers: StripeIdentifier[]) => Promise; /** Mounts the CARF/CRS self-declaration element the buyer confirms. */ promptUserAttestation: (regulation: StripeRegulationType, onCompletion: (result: StripeAttestationResult) => void) => Promise; /** Mounts the document-capture element for the L2 step-up. */ verifyDocuments: () => Promise<{ result: 'success' | 'abandoned'; }>; getWalletOwnershipChallenge: (params: { walletAddress: string; network: string; }) => Promise; submitWalletOwnershipSignature: (params: { challengeId: string; signature: string; }) => Promise; collectPaymentMethod: (options: { payment_method_types: string[]; wallets: { applePay: StripeWalletPreference; googlePay: StripeWalletPreference; }; }, onCompletion: (result: StripeCollectPaymentMethodResult) => void) => Promise; performCheckout: (onrampSessionId: string, checkout: (onrampSessionId: string) => Promise) => Promise<{ successful: boolean; }>; destroy: () => void; }; type CoordinatorConstructor = (publishableKey: string, options?: { theme?: 'stripe' | 'night' | 'flat'; }) => StripeOnrampCoordinator; declare global { interface Window { loadCryptoOnrampAndInitialize?: CoordinatorConstructor; } } /** Load Stripe's script (once) and initialize a coordinator for the key. */ export declare function createStripeOnrampCoordinator(publishableKey: string, options?: { theme?: 'stripe' | 'night' | 'flat'; }): Promise; /** Stripe's network names, from the session target's CAIP-2 chain id. */ export declare function stripeNetworkForChain(chain: string): string | null; export {};