return_url.

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: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
- Start your development server:
- 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:
- Change the mode to
'live':
- Update your checkout URLs to use live checkout sessions from your backend
- Test the complete flow in production
- Monitor events and errors
API Reference
Initialize
CallInitialize 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 theonEvent callback passed to Initialize:
CDN Implementation
For quick integration without a build step, load the SDK from CDN:Theme Customization
This section covers the deprecated client-side theme configuration using the Checkout SDK. The recommended approach is to configure themes server-side when creating a checkout session via the API using the
theme_config parameter. See Checkout Theme Customization for API-level configuration, or use the Design page in the dashboard to configure themes visually with live preview.themeConfig in the options parameter:
Theme Properties
All available theme properties for light and dark modes:Error Handling
Always implement error handling in youronEvent callback:
Best Practices
- Initialize once: Call
Initializeonce when your app loads, not before every checkout - Error handling: Implement proper error handling in your event callback
- Test mode: Use
"test"mode during development and switch to"live"only when ready for production - Event handling: Handle all relevant events for a complete user experience
- Valid URLs: Always use valid checkout URLs from the create checkout session API
- TypeScript: Use TypeScript for better type safety and developer experience
- Loading states: Show loading states while the checkout is opening to improve UX
- Timer management: Disable the timer (
showTimer: false) if you want to handle session expiration manually
Troubleshooting
Checkout modal not opening
Checkout modal not opening
Possible causes:
- SDK not initialized before calling
open() - Invalid checkout URL
- JavaScript errors in console
- Network connectivity issues
- 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
Events not firing
Events not firing
Possible causes:
- Event handler not properly set up
- JavaScript errors preventing event propagation
- SDK not initialized correctly
- 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
Styling issues
Styling issues
Possible causes:
- CSS conflicts with your application styles
- Theme settings not applied correctly
- Responsive design issues
- 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:Related Resources
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.