Skip to main content

Overview

The Dodo Payments Checkout SDK provides a seamless way to integrate our payment overlay into your web application. Built with TypeScript and modern web standards, it offers a robust solution for handling payments with real-time event handling and customizable themes.
Overlay Checkout Cover Image

Demo

Interactive Demo

See the overlay checkout in action with our live demo.

Quick Start

Get started with the Dodo Payments Checkout SDK in just a few lines of code:
Get your checkout URL from the create checkout session API.

Step-by-Step Integration Guide

1

Install the SDK

Install the Dodo Payments Checkout SDK using your preferred package manager:
2

Initialize the SDK

Initialize the SDK in your application, typically in your main component or app entry point:
Always initialize the SDK before attempting to open the checkout. Initialization should happen once when your application loads.
3

Create a Checkout Button Component

Create a component that opens the checkout overlay:
4

Add Checkout to Your Page

Use the checkout button component in your application:
5

Handle Success and Failure Pages

Create pages to handle checkout redirects:
6

Test Your Integration

  1. Start your development server:
  1. Test the checkout flow:
    • Click the checkout button
    • Verify the overlay 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 you’re 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

Configuration

Initialize Options

OptionTypeRequiredDescription
mode"test" | "live"YesEnvironment mode: 'test' for development, 'live' for production
displayType"overlay" | "inline"NoDisplay type: 'overlay' for modal checkout (default), 'inline' for embedded checkout
onEventfunctionYesCallback function for handling checkout events

Checkout Options

OptionTypeRequiredDescription
checkoutUrlstringYesCheckout session URL from the create checkout session API
options.showTimerbooleanNoShow or hide the checkout timer. Defaults to true. When disabled, you will receive the checkout.link_expired event when the session expires.
options.showSecurityBadgebooleanNoShow or hide the security badge. Defaults to true.

Methods

Open Checkout

Opens the checkout overlay with the specified checkout session URL.
You can also pass additional options to customize the checkout behavior:

Close Checkout

Programmatically closes the checkout overlay.

Check Status

Returns whether the checkout overlay is currently open.

Events

The SDK provides real-time events that you can listen to through the onEvent callback:
Event TypeDescription
checkout.openedCheckout overlay has been opened
checkout.form_readyCheckout form is ready to receive user input. Useful for hiding loading states.
checkout.payment_page_openedPayment page has been displayed
checkout.customer_details_submittedCustomer and billing details have been submitted
checkout.closedCheckout overlay has been closed
checkout.redirectCheckout will perform a redirect
checkout.errorAn error occurred during checkout
checkout.link_expiredFired when the checkout session expires. Only received when showTimer is set to false.

Implementation Options

Package Manager Installation

Install via npm, yarn, or pnpm as shown in the Step-by-Step Integration Guide.

CDN Implementation

For quick integration without a build step, you can use our CDN:

Theme Customization

You can customize the checkout appearance by passing a themeConfig object in the options parameter when opening checkout. The theme configuration supports both light and dark modes, allowing you to customize colors, borders, text, buttons, and border radius.
The client-side themeConfig option is deprecated and will be removed in the next major version of the Checkout SDK (v2.0.0). Passing it logs a deprecation warning in the browser console. Configure your theme when creating the checkout session via the API instead, using the customization.theme_config parameter — see Checkout Theme Customization — or visually on the Design page in the dashboard. Session-configured themes apply to overlay, inline, and hosted checkout alike.
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.

Basic Theme Configuration

Complete Theme Configuration

All available theme properties:

Light Mode Only

If you only want to customize the light theme:

Dark Mode Only

If you only want to customize the dark theme:

Partial Theme Override

You can override only specific properties. The checkout will use default values for properties you don’t specify:

Theme Configuration with Other Options

You can combine theme configuration with other checkout options:

TypeScript Types

For TypeScript users, all theme configuration types are exported:

Error Handling

The SDK provides detailed error information through the event system. Always implement proper 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: Initialize the SDK once when your application loads, not on every checkout attempt
  2. Error handling: Always 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 for console 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 overlay

Enabling 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. Support for Apple Pay is coming soon.

Browser Support

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

Overlay vs Inline Checkout

Choose the right checkout type for your use case:
FeatureOverlay CheckoutInline Checkout
Integration depthModal on top of pageFully embedded in page
Layout controlLimitedFull control
BrandingSeparate from pageSeamless
Implementation effortLowerHigher
Best forQuick integration, existing pagesCustom checkout pages, high-conversion flows
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 seamless 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 July 13, 2026