import { ListPaymentMethodsResponse, GetQuoteParams, Quote, ListAssetsResponse, Transaction, PaginationInfo, TransactionWithStages, SimulateBankTransferParams } from '@moonpay/platform-protocol/api'; export { AssetStatus, GetQuoteParams, ListAssetsResponse, ListPaymentMethodsResponse, PaginationInfo, PaymentMethodConfig, PaymentMethodType, PlatformAsset, Quote, SimulateBankTransferOutcome, SimulateBankTransferParams, SimulateSenderBankAccount, StoredCardPaymentMethod, StoredPaymentMethod, Transaction, TransactionWithStages } from '@moonpay/platform-protocol/api'; import { Customer } from '@moonpay/platform-protocol/api/customer'; export { Customer } from '@moonpay/platform-protocol/api/customer'; export { CardResponse } from '@moonpay/platform-protocol/frames/add-card'; import * as ApplePayFrameTypes from '@moonpay/platform-protocol/frames/apple-pay'; export { ApplePayButtonSettings } from '@moonpay/platform-protocol/frames/apple-pay'; export { Cancellation as ChallengeCancellation, CompleteResult as ChallengeCompleteResult } from '@moonpay/platform-protocol/frames/challenge'; import { Connection } from '@moonpay/platform-protocol/models/connection'; export { Connection, ConnectionStatus } from '@moonpay/platform-protocol/models/connection'; import { Result } from '@moonpay/platform-protocol/result'; export { Result } from '@moonpay/platform-protocol/result'; import * as AddCardSdk from '@moonpay/platform-protocol/sdks/add-card'; export { Event as AddCardEvent, SetupError as SetupAddCardError } from '@moonpay/platform-protocol/sdks/add-card'; import * as ApplePaySdk from '@moonpay/platform-protocol/sdks/apple-pay'; export { Event as ApplePayEvent, SetupError as SetupApplePayError } from '@moonpay/platform-protocol/sdks/apple-pay'; import * as AuthSdk from '@moonpay/platform-protocol/sdks/auth'; export { Event as AuthEvent, SetupError as SetupAuthError } from '@moonpay/platform-protocol/sdks/auth'; import * as BuySdk from '@moonpay/platform-protocol/sdks/buy'; export { Event as BuyEvent, SetupError as SetupBuyError } from '@moonpay/platform-protocol/sdks/buy'; import * as BuyButtonSdk from '@moonpay/platform-protocol/sdks/buy-button'; export { Event as BuyButtonEvent, SetupError as SetupBuyButtonError } from '@moonpay/platform-protocol/sdks/buy-button'; import * as ChallengeSdk from '@moonpay/platform-protocol/sdks/challenge'; export { Event as ChallengeEvent, SetupError as SetupChallengeError } from '@moonpay/platform-protocol/sdks/challenge'; import * as ConnectSdk from '@moonpay/platform-protocol/sdks/connect'; export { Event as ConnectEvent } from '@moonpay/platform-protocol/sdks/connect'; import * as CustomerExportSdk from '@moonpay/platform-protocol/sdks/customer-export'; export { Event as CustomerExportEvent, SetupError as SetupCustomerExportError } from '@moonpay/platform-protocol/sdks/customer-export'; import * as GooglePaySdk from '@moonpay/platform-protocol/sdks/google-pay'; export { Event as GooglePayEvent, SetupError as SetupGooglePayError } from '@moonpay/platform-protocol/sdks/google-pay'; import * as WidgetSdk from '@moonpay/platform-protocol/sdks/widget'; export { SetupError as SetupWidgetError, Event as WidgetEvent } from '@moonpay/platform-protocol/sdks/widget'; import { ThemeOptions, PresentationMode, Credentials, GetCredentialsError, GetPaymentMethodsParams, ListAssetsParams, ListTransactionsParams, FrameTransport, FrameOptions } from '@moonpay/platform-sdk-core'; export { Credentials, GetCredentialsError, GetPaymentMethodsParams, ListAssetsParams, ThemeOptions } from '@moonpay/platform-sdk-core'; import { GetPaymentMethodsError, GetQuoteError, GetAssetsError, GetTransactionsError, SimulateBankTransferError, DevPlatformApiError, GetCustomerError, SubmitCustomerKycError, GetCustomerUploadUrlError, SubmitCustomerFilesError, CreateIdentityError, GetIdentityError, UpdateIdentityError, VerifyIdentityError, GetIdentityUploadUrlError, SubmitIdentityFilesError } from '@moonpay/platform-protocol/api/errors'; import { UpdateIdentityRequestBody, IdentityFileUploadUrlRequestBody, IdentityFileUploadUrl, SubmitIdentityFilesRequestBody, CreateIdentityRequestBody, Identity, IdentityVerificationResponse } from '@moonpay/platform-protocol/api/identity'; import { ResetConnectionError } from '@moonpay/platform-protocol/sdks/reset'; import { ProtocolMessage } from '@moonpay/platform-protocol/protocol'; interface CreateClientOptions { /** Session token from your server (via createSession). */ sessionToken: string; /** Override the API base URL. Defaults to production. */ apiBaseUrl?: string; /** Override the frame base URL. Defaults to production. */ frameBaseUrl?: string; /** Theme applied to every visible MoonPay frame (connect, widget, Apple/Google Pay, …). */ theme?: ThemeOptions; } interface GetConnectionOptions { /** * Pass `true` for headless / Identity-API integrations so the check * frame opts out of KYC-based statuses. Legal (`termsAcceptanceRequired`) * is always surfaced regardless. Defaults to `false`. */ skipKyc?: boolean; } interface ConnectOptions { /** DOM element to render the connect frame into. */ container: HTMLElement; /** Theme for this connect frame. Overrides the client-level `theme`. */ theme?: ThemeOptions; /** Frame chrome. Defaults to the frame's own default (bare) when omitted. */ presentation?: PresentationMode; /** Callback for connect lifecycle events. */ onEvent?: (event: ConnectSdk.Event) => void; } interface ConnectFrame { dispose(): void; } interface SetupWidgetOptions { /** Quote signature from getQuote(). */ quote: string; /** DOM element to render the widget into. */ container: HTMLElement; /** Partner-assigned identifier for this transaction attempt. */ externalTransactionId?: string; /** Frame chrome. Defaults to the frame's own default (bare) when omitted. */ presentation?: PresentationMode; /** Callback for widget lifecycle events. */ onEvent?: (event: WidgetSdk.Event) => void; } interface WidgetFrame { dispose(): void; } interface SetupApplePayOptions { /** Quote signature from getQuote(). */ quote: string; /** DOM element to render the Apple Pay button into. */ container: HTMLElement; /** Partner-assigned identifier for this transaction attempt. */ externalTransactionId?: string; /** Frame chrome. Defaults to the frame's own default (bare) when omitted. */ presentation?: PresentationMode; /** Styling for the standalone Apple Pay button. Passed through to the frame, which is authoritative. */ applePayButtonSettings?: ApplePayFrameTypes.ApplePayButtonSettings; /** Callback for Apple Pay lifecycle events. */ onEvent?: (event: ApplePaySdk.Event) => void; } interface ApplePayFrame { /** Update the quote (e.g., after expiry). */ setQuote(signature: string): void; dispose(): void; } interface SetupGooglePayOptions { /** Quote signature from getQuote(). */ quote: string; /** DOM element to render the Google Pay button into. */ container: HTMLElement; /** Partner-assigned identifier for this transaction attempt. */ externalTransactionId?: string; /** Frame chrome. Defaults to the frame's own default (bare) when omitted. */ presentation?: PresentationMode; /** Callback for Google Pay lifecycle events. */ onEvent?: (event: GooglePaySdk.Event) => void; } interface GooglePayFrame { /** Update the quote (e.g., after expiry). */ setQuote(signature: string): void; dispose(): void; } interface SetupBuyOptions { /** Quote signature from getQuote(). */ quote: string; /** DOM element to attach the hidden buy frame to. */ container: HTMLElement; /** Partner-assigned identifier for this transaction attempt. */ externalTransactionId?: string; /** Callback for buy frame lifecycle events. */ onEvent?: (event: BuySdk.Event) => void; } interface BuyFrame { /** Update the quote (e.g., after expiry). */ setQuote(signature: string): void; dispose(): void; } interface SetupBuyButtonOptions { /** Quote signature from getQuote(). */ quote: string; /** DOM element to render the buy button into. */ container: HTMLElement; /** Partner-assigned identifier for this transaction attempt. */ externalTransactionId?: string; /** Frame chrome. Defaults to the frame's own default (bare) when omitted. */ presentation?: PresentationMode; /** Styling for the Apple Pay button variant. Passed through to the frame, which is authoritative. */ applePayButtonSettings?: ApplePayFrameTypes.ApplePayButtonSettings; /** Callback for buy-button frame lifecycle events. */ onEvent?: (event: BuyButtonSdk.Event) => void; } interface BuyButtonFrame { /** Update the quote (e.g., after expiry). */ setQuote(signature: string): void; dispose(): void; } interface SetupChallengeOptions { /** * Full challenge URL received from a frame's `challenge` event (buy, * buy-button, Apple Pay, or Google Pay), or from a quote's `challenge` * field (guest-checkout limit upgrade). `clientToken` is attached * automatically when the client holds one — do not add it yourself. */ url: string; /** DOM element to render the challenge frame into. */ container: HTMLElement; /** Frame chrome. Defaults to the frame's own default (bare) when omitted. */ presentation?: PresentationMode; /** Callback for challenge frame lifecycle events. */ onEvent?: (event: ChallengeSdk.Event) => void; } interface ChallengeFrame { dispose(): void; } interface SetupAddCardOptions { /** DOM element to render the add-card frame into. */ container: HTMLElement; /** Frame chrome. Defaults to the frame's own default (bare) when omitted. */ presentation?: PresentationMode; /** Callback for add-card frame lifecycle events. */ onEvent?: (event: AddCardSdk.Event) => void; } interface AddCardFrame { dispose(): void; } interface SetupCustomerExportOptions { /** DOM element to render the customer-export consent frame into. */ container: HTMLElement; /** Frame chrome. Defaults to the frame's own default (bare) when omitted. */ presentation?: PresentationMode; /** Callback for customer-export frame lifecycle events. */ onEvent?: (event: CustomerExportSdk.Event) => void; } interface CustomerExportFrame { dispose(): void; } interface SetupAuthOptions { /** DOM element to render the auth frame into. */ container: HTMLElement; /** Frame chrome. Defaults to the frame's own default (bare) when omitted. */ presentation?: PresentationMode; /** Callback for auth frame lifecycle events. */ onEvent?: (event: AuthSdk.Event) => void; } interface AuthFrame { dispose(): void; } interface Client { /** * Probe the customer's connection state via the hidden check-connection * frame. Returns the `Connection` discriminated union and populates the * internal context with bootstrap `accessToken` / `clientToken` for any * status that carries credentials (`active`, `connectionRequired`). * * Headless / Identity-API integrations should pass `skipKyc: true` so the * check frame opts out of KYC-related result codes — the frame still * surfaces `termsAcceptanceRequired` (legal can't be skipped) but won't * resolve to `pending` / `failed` due to KYC alone. * * A `connectionRequired` result may carry `mismatch: true` when the * session's email and phone number resolve to different MoonPay * customers — partners can branch on it to route the customer through * Connect proactively, before rendering payment UI. */ getConnection(options?: GetConnectionOptions): Promise>; connect(options: ConnectOptions): Promise>; /** * Launch the auth frame — the lighter-weight counterpart to `connect()` * for headless / Identity-API partners. Requires a `clientToken` to be * present in the client's context, which is populated automatically by a * prior `getConnection()` call that returned `connectionRequired`. * Call `getConnection()` first; if its status is `connectionRequired`, * call `setupAuth()` to drive the customer through email/OTP. */ setupAuth(options: SetupAuthOptions): Promise>; /** * Returns the connected customer's `{ accessToken, clientToken }` so you can * forward the `accessToken` to your own backend for customer-scoped Platform * API calls (e.g. server-side quote fetching). * * Advanced escape hatch — the SDK otherwise keeps these credentials internal. * The `accessToken` is short-lived and scoped to the connected customer. Errs * with `noActiveSession` until a customer session exists — call * `getConnection()` (and `connect()` / `setupAuth()` where needed) first. * Synchronous — returns a `Result`, not a Promise. */ getCredentials(): Result; getPaymentMethods(params?: GetPaymentMethodsParams): Promise>; getQuote(params: GetQuoteParams): Promise>; /** * Lists crypto assets (CeFi and DeFi) available for purchase. DeFi tokens are * returned with `status.verified: false`; quote them by `caip19` rather than `code`. */ getAssets(params?: ListAssetsParams): Promise>; listTransactions(params?: ListTransactionsParams): Promise>; getTransaction(id: string): Promise>; /** Simulate bank-transfer settlement for a test-mode transaction (sandbox only). */ simulateBankTransfer(id: string, params: SimulateBankTransferParams): Promise>; setupWidget(options: SetupWidgetOptions): Promise>; setupApplePay(options: SetupApplePayOptions): Promise>; setupGooglePay(options: SetupGooglePayOptions): Promise>; deletePaymentMethod(id: string): Promise>; /** * Clears the customer's MoonPay connection for this partner by running the * reset frame, authorized with the connect-flow `clientToken` held in the * client's context. Resolves when the reset completes or times out (5s). * Call this after clearing your own local auth state (the client reference * can be captured before disposal since the client token is held internally). */ resetConnection(): Promise>; setupBuy(options: SetupBuyOptions): Promise>; setupBuyButton(options: SetupBuyButtonOptions): Promise>; setupChallenge(options: SetupChallengeOptions): Promise>; setupAddCard(options: SetupAddCardOptions): Promise>; /** * Launch the customer-export consent frame. The customer reviews what's * being shared and authorizes the export; the `complete` event payload * carries a one-time consent token. Forward it to your backend, which * calls `exportCustomer` (node SDK) within the token's validity window. */ setupCustomerExport(options: SetupCustomerExportOptions): Promise>; /** Fetch the customer bound to the credential. */ getCustomer(id: string): Promise>; /** Submit one or more outstanding KYC requirements for the customer. */ submitCustomerKyc(id: string, body: UpdateIdentityRequestBody): Promise>; /** Issue a presigned URL to upload a customer's identity-related file. */ getCustomerUploadUrl(id: string, body: IdentityFileUploadUrlRequestBody): Promise>; /** Confirm one or more previously-uploaded customer files. */ submitCustomerFiles(id: string, body: SubmitIdentityFilesRequestBody): Promise>; /** * @deprecated Customers are created automatically now — call `getCustomer` * directly instead. */ createIdentity(body: CreateIdentityRequestBody): Promise>; /** @deprecated Use `getCustomer` instead. */ getIdentity(id: string): Promise>; /** @deprecated Use `submitCustomerKyc` instead. */ updateIdentity(id: string, body: UpdateIdentityRequestBody): Promise>; /** @deprecated No longer needed — Customer API verification has no direct replacement call. */ verifyIdentity(id: string): Promise>; /** @deprecated Use `getCustomerUploadUrl` instead. */ getIdentityUploadUrl(id: string, body: IdentityFileUploadUrlRequestBody): Promise>; /** @deprecated Use `submitCustomerFiles` instead. */ submitIdentityFiles(id: string, body: SubmitIdentityFilesRequestBody): Promise>; } declare function createClient(options: CreateClientOptions): Client; /** * FrameTransport implementation for web browsers using HTMLIFrameElement * and window.postMessage. */ declare class IframeTransport implements FrameTransport { private iframe; private container; private frameOrigin; private handlers; private boundListener; create(url: string, options: FrameOptions): void; sendMessage(message: ProtocolMessage): void; onMessage(handler: (msg: ProtocolMessage) => void): () => void; dispose(): void; private handleMessage; } export { type AddCardFrame, type ApplePayFrame, type AuthFrame, type BuyButtonFrame, type BuyFrame, type ChallengeFrame, type Client, type ConnectFrame, type ConnectOptions, type CreateClientOptions, type CustomerExportFrame, type GetConnectionOptions, type GooglePayFrame, IframeTransport, type SetupAddCardOptions, type SetupApplePayOptions, type SetupAuthOptions, type SetupBuyButtonOptions, type SetupBuyOptions, type SetupChallengeOptions, type SetupCustomerExportOptions, type SetupGooglePayOptions, type SetupWidgetOptions, type WidgetFrame, createClient };