Skip to main content
Overlay checkout opens a modal window on top of your page. Customers enter their payment details in the modal while your page stays visible behind it. When they close the modal, control returns to your page. When they complete payment, they are redirected to your return_url.
Overlay checkout modal displayed on top of a product page

Interactive Demo

See the overlay checkout in action with our live demo.

Quick Start

Install the SDK, initialize it, and open checkout with a checkout URL from the create checkout session API:

Step-by-Step Integration

1

Install the SDK

Install via npm, yarn, or pnpm:
2

Initialize the SDK

Call Initialize once when your app loads, typically in your main component or app entry point:
Always initialize the SDK before opening the checkout. Initialize it once when your application loads, not before every checkout attempt.
3

Create a Checkout Button

Build a component that opens the checkout modal:
4

Add the Button to Your Page

Use the checkout button component in your application:
5

Handle Redirects

Create pages to handle checkout redirects after payment:
6

Test Your Integration

  1. Start your development server:
  1. Test the checkout flow:
    • Click the checkout button
    • Verify the modal appears
    • Test the payment flow using test credentials
    • Confirm redirects work correctly
You should see checkout events logged in your browser console.
7

Go Live

When ready for production:
  1. Change the mode to 'live':
  1. Update your checkout URLs to use live checkout sessions from your backend
  2. Test the complete flow in production
  3. Monitor events and errors

API Reference

Initialize

Call Initialize once to set up the SDK:

Open Checkout

Open the checkout modal:

Close Checkout

Programmatically close the modal:

Check Status

Check if the modal is currently open:

Events

Listen for checkout events via the onEvent callback passed to Initialize:

CDN Implementation

For quick integration without a build step, load the SDK from CDN:

Theme Customization

Configure the checkout theme when you create the checkout session, with the customization.theme_config parameter. See Checkout Theme Customization. You can also configure it visually on the Design page in the dashboard. A theme set on the session applies to overlay, inline, and hosted checkout.
Checkout SDK 2.0.1 removes the client-side themeConfig option. If you still pass themeConfig in options, the SDK ignores it. Move the theme to customization.theme_config on the checkout session.

Error Handling

Always implement error handling in your onEvent callback:
Always handle the checkout.error event to provide a good user experience when errors occur.

Best Practices

  1. Initialize once: Call Initialize once when your app loads, not before every checkout
  2. Error handling: Implement proper error handling in your event callback
  3. Test mode: Use "test" mode during development and switch to "live" only when ready for production
  4. Event handling: Handle all relevant events for a complete user experience
  5. Valid URLs: Always use valid checkout URLs from the create checkout session API
  6. TypeScript: Use TypeScript for better type safety and developer experience
  7. Loading states: Show loading states while the checkout is opening to improve UX
  8. Timer management: Disable the timer (showTimer: false) if you want to handle session expiration manually

Troubleshooting

Possible causes:
  • SDK not initialized before calling open()
  • Invalid checkout URL
  • JavaScript errors in console
  • Network connectivity issues
Solutions:
  • Verify SDK initialization happens before opening checkout
  • Check browser console for errors
  • Ensure checkout URL is valid and from the create checkout session API
  • Verify network connectivity
Possible causes:
  • Event handler not properly set up
  • JavaScript errors preventing event propagation
  • SDK not initialized correctly
Solutions:
  • Confirm event handler is properly configured in Initialize()
  • Check browser console for JavaScript errors
  • Verify SDK initialization completed successfully
  • Test with a simple event handler first
Possible causes:
  • CSS conflicts with your application styles
  • Theme settings not applied correctly
  • Responsive design issues
Solutions:
  • Check for CSS conflicts in browser DevTools
  • Verify theme settings are correct
  • Test on different screen sizes
  • Ensure no z-index conflicts with modal

Digital Wallets

For detailed information about setting up Google Pay and other digital wallets, see the Digital Wallets page.
Apple Pay is not yet supported in overlay checkout.

Browser Support

The Dodo Payments Checkout SDK supports:
  • Chrome (latest)
  • Firefox (latest)
  • Safari (latest)
  • Edge (latest)
  • IE11+

Overlay vs Inline Checkout

Choose the right checkout type for your use case:
Use overlay checkout for faster integration with minimal changes to your existing pages. Use inline checkout when you want maximum control over the checkout experience and consistent branding.

Inline Checkout

Embed checkout directly into your page for fully integrated experiences.

Checkout Sessions API

Create checkout sessions to power your checkout experiences.

Webhooks

Handle payment events server-side with webhooks.

Integration Guide

Complete guide to integrating Dodo Payments.
For more help, visit our Discord community or contact our developer support team.
Last modified on November 12, 2026