UNPKG

dodopayments-checkout

Version:

A TypeScript library for embedding Dodo Payments checkout (overlay and inline).

56 lines (55 loc) 1.5 kB
/** * DodoCheckout - A TypeScript library for embedding Dodo's overlay checkout iframe * Provides a singleton instance to manage iframe lifecycle, events, and communication * with the Dodo Payments checkout system. * * @example * ```typescript * // Initialize the SDK once * DodoPayments.Initialize({ * mode: 'test', * onEvent: (event) => { * console.log('Received event:', event); * } * }); * * // Open checkout for a specific product * DodoPayments.Checkout.open({ * productId: 'pdt_wtwBBM0TQc2WL1Kq9h0aW' * }); * ``` */ import { initializeCheckout, isCheckoutOpen, buildCheckoutUrl } from './checkout'; import { closeCheckout } from './events'; import { OpenCheckoutOptions } from './types'; export * from './types'; /** * Main SDK export with public API */ export declare const DodoPayments: { /** * Initialize the Dodo Payments checkout SDK */ Initialize: typeof initializeCheckout; /** * Checkout related operations */ Checkout: { /** * Open checkout with specified options */ open: (options: OpenCheckoutOptions) => void; /** * Close the checkout if open */ close: typeof closeCheckout; /** * Check if checkout is currently open */ isOpen: typeof isCheckoutOpen; /** * Build checkout URL by adding /overlay for session and payment link URLs */ buildUrl: typeof buildCheckoutUrl; }; };